diff --git a/src/client/components/Ephemere.js b/src/client/components/Ephemere.js index f4b02cda..80489505 100644 --- a/src/client/components/Ephemere.js +++ b/src/client/components/Ephemere.js @@ -9,19 +9,43 @@ class Ephemere extends Component { ); } + componentWillMount() { + this.setTimer(); + } + + componentDidMount() { + this.makeVisible(); + } + + componentDidUpdate() { + this.makeVisible(); + } + componentWillUpdate() { - if (this.refs.ephemere) { - this.refs.ephemere.style.display = 'block'; - } + this.clearTimer(); + this.setTimer(); + } + + componentWillUnmount() { + this.clearTimer(); + } + makeVisible() { if (this.timeout) { - clearTimeout(this.timeout); + if (this.refs.ephemere) { + this.refs.ephemere.style.display = 'block'; + } } } - - componentDidUpdate() { - this.timeout = setTimeout(() => { - this.refs.ephemere.style.display = 'none'; - }, this.props.timeout || 3000); + clearTimer() { + clearTimeout(this.timeout); + this.timeout = null; + } + setTimer() { + if (!this.timeout) { + this.timeout = setTimeout(() => { + this.refs.ephemere.style.display = 'none'; + }, this.props.timeout || 3000); + } } } diff --git a/src/client/components/GroupEditor.js b/src/client/components/GroupEditor.js index 07f71055..50f2e698 100644 --- a/src/client/components/GroupEditor.js +++ b/src/client/components/GroupEditor.js @@ -67,9 +67,7 @@ class GroupEditor extends PureComponent { /> - - {group.success ?
{group.success}
: null } -
+ {group.success ?
{group.success}
: null } {group.error ?
{group.error}
: null }