Clearing the timeout

This commit is contained in:
Belen Curcio committed 2017-06-26 16:08:32 -03:00
1 parent b00d2f569e
commit fa9a4ecc50
2 files changed
+5 -2

No files matched your search

@@ -48,7 +48,7 @@ export default class PermalinkButton extends React.Component {
});
}
setTimeout(() => {
this.timeout = window.setTimeout(() => {
this.setState({
copyFailure: null,
copySuccessful: null
@@ -56,6 +56,10 @@ export default class PermalinkButton extends React.Component {
}, 3000);
}
componentWillUnmount() {
window.clearTimeout(this.timeout);
}
render () {
const {copySuccessful, copyFailure, popoverOpen} = this.state;
const {asset} = this.props;