Clearing the timeout

This commit is contained in:
Belen Curcio
2017-06-26 16:08:32 -03:00
parent b00d2f569e
commit fa9a4ecc50
2 changed files with 5 additions and 2 deletions
@@ -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;
@@ -2,7 +2,6 @@
display: none;
background-color: white;
position: absolute;
border-radius: 3px;
padding: 15px 10px;
box-sizing: border-box;