Skip to content
Snippets Groups Projects

Shared data model

Merged lit_git requested to merge shared-data-model into dev
2 files
+ 26
8
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -27,6 +27,9 @@ const SearchArea = styled.div`
flex-wrap: wrap;
}
`
let errorTimer
class SearchBoxes extends React.Component {
state = {
id: SearchBoxes.id ? SearchBoxes.id : '',
@@ -34,19 +37,32 @@ class SearchBoxes extends React.Component {
errors: [],
}
componentDidUpdate() {
if (this.state.errors && this.area) {
setTimeout(() => {
const { errors } = this.state
if (errorTimer) {
clearTimeout(errorTimer)
}
if (errors && this.area) {
errorTimer = setTimeout(() => {
this.setState({ errors: [] })
}, 10000)
}
}
componentWillUnmount() {
clearTimeout(errorTimer)
}
static id = ''
static search = ''
setRef = area => {
this.area = area
}
onSearchValChanged = e => {
this.setState({ [e.target.name]: e.target.value })
this.setState({
[e.target.name]: e.target.value,
errors: [],
})
SearchBoxes[e.target.name] = e.target.value
}
onSearchValSubmitted = (where, e) => {