From 4b33fb54c6f252f84d3128d4067fdcdc6add5c6f Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Mon, 11 Sep 2017 17:24:42 -0700 Subject: [PATCH] Ensure we don't doubletime the marquee when changing skins --- js/components/MainWindow/Marquee.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/components/MainWindow/Marquee.js b/js/components/MainWindow/Marquee.js index eafcf134..eb763960 100644 --- a/js/components/MainWindow/Marquee.js +++ b/js/components/MainWindow/Marquee.js @@ -76,11 +76,12 @@ class Marquee extends React.Component { this.state = { stepping: true, dragOffset: 0 }; this.handleMouseDown = this.handleMouseDown.bind(this); this.getText = this.getText.bind(this); + this.stepHandle = null; } componentDidMount() { const step = () => { - setTimeout(() => { + this.stepHandle = setTimeout(() => { if (this.state.stepping) { this.props.dispatch({ type: STEP_MARQUEE }); } @@ -92,6 +93,12 @@ class Marquee extends React.Component { } } + componentWillUnmount() { + if (this.stepHandle) { + clearTimeout(this.stepHandle); + } + } + getText() { switch (this.props.userInput.focus) { case "balance":