Skip to content
Snippets Groups Projects
Commit d77176bc authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

fix(autosave): fix timer on autosave indicator

parent 8ab0c3e6
No related branches found
No related tags found
1 merge request!43Sprint #19
......@@ -15,14 +15,22 @@ class AutosaveIndicator extends Component {
this.timer = null
}
componentDidMount() {
this.setTimer()
}
componentWillReceiveProps({ autosave: nextAutosave }) {
const { autosave, toggleVisible } = this.props
if (autosave && !isEqual(autosave, nextAutosave)) {
if (!isEqual(autosave, nextAutosave)) {
toggleVisible()
this.setTimer()
}
}
componentWillUnmount() {
clearTimeout(this.timer)
}
setTimer = () => {
const { toggleVisible, delay = 2000 } = this.props
if (this.timer) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment