From fa9a4ecc501178a265cc50cc4d5bd10dc14c3972 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 26 Jun 2017 16:08:32 -0300 Subject: [PATCH] Clearing the timeout --- .../client/components/PermalinkButton.js | 6 +++++- plugins/talk-plugin-permalink/client/components/styles.css | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/talk-plugin-permalink/client/components/PermalinkButton.js b/plugins/talk-plugin-permalink/client/components/PermalinkButton.js index 6a92d69ce..7eba9ddd0 100644 --- a/plugins/talk-plugin-permalink/client/components/PermalinkButton.js +++ b/plugins/talk-plugin-permalink/client/components/PermalinkButton.js @@ -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; diff --git a/plugins/talk-plugin-permalink/client/components/styles.css b/plugins/talk-plugin-permalink/client/components/styles.css index 6401dbece..56d069755 100644 --- a/plugins/talk-plugin-permalink/client/components/styles.css +++ b/plugins/talk-plugin-permalink/client/components/styles.css @@ -2,7 +2,6 @@ display: none; background-color: white; position: absolute; - border-radius: 3px; padding: 15px 10px; box-sizing: border-box;