diff options
author | 2019-10-02 17:26:34 +0200 | |
---|---|---|
committer | 2019-10-02 17:26:34 +0200 | |
commit | bd9fa0d0fb153db0ebccfaa39b8e06728ddc147b (patch) | |
tree | ddb422580fb14ce0b4278dc7382bbf10708b65c5 /src/components | |
parent | feat(App): Update to electron 6.0.11 (diff) | |
download | ferdium-app-bd9fa0d0fb153db0ebccfaa39b8e06728ddc147b.tar.gz ferdium-app-bd9fa0d0fb153db0ebccfaa39b8e06728ddc147b.tar.zst ferdium-app-bd9fa0d0fb153db0ebccfaa39b8e06728ddc147b.zip |
Clear confetti timeout on component unmount
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/services/content/Services.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/components/services/content/Services.js b/src/components/services/content/Services.js index 73c27bfb6..b6291666b 100644 --- a/src/components/services/content/Services.js +++ b/src/components/services/content/Services.js | |||
@@ -56,16 +56,24 @@ export default @observer @injectSheet(styles) class Services extends Component { | |||
56 | 56 | ||
57 | state = { | 57 | state = { |
58 | showConfetti: true, | 58 | showConfetti: true, |
59 | } | 59 | }; |
60 | |||
61 | _confettiTimeout = null; | ||
60 | 62 | ||
61 | componentDidMount() { | 63 | componentDidMount() { |
62 | window.setTimeout(() => { | 64 | this._confettiTimeout = window.setTimeout(() => { |
63 | this.setState({ | 65 | this.setState({ |
64 | showConfetti: false, | 66 | showConfetti: false, |
65 | }); | 67 | }); |
66 | }, ms('8s')); | 68 | }, ms('8s')); |
67 | } | 69 | } |
68 | 70 | ||
71 | componentWillUnmount() { | ||
72 | if (this._confettiTimeout) { | ||
73 | clearTimeout(this._confettiTimeout); | ||
74 | } | ||
75 | } | ||
76 | |||
69 | render() { | 77 | render() { |
70 | const { | 78 | const { |
71 | services, | 79 | services, |