From d2e046a98ca235506ee74b34887ac9f5b13c2ac3 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Fri, 10 Jul 2015 08:39:37 -0700 Subject: Changed spacing model of connection flag & removed unnecessary duplication of logic --- web/react/components/textbox.jsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'web/react/components/textbox.jsx') diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx index b5b696124..7e5f8e2f4 100644 --- a/web/react/components/textbox.jsx +++ b/web/react/components/textbox.jsx @@ -55,7 +55,7 @@ module.exports = React.createClass({ } if (errorState.message === "There appears to be a problem with your internet connection") { - this.setState({ connection: " bad-connection" }); + this.setState({ connection: "bad-connection" }); var timerInterrupt = window.setInterval(this._onTimerInterrupt, 5000); this.setState({ timerInterrupt: timerInterrupt }); } @@ -66,21 +66,18 @@ module.exports = React.createClass({ _onTimerInterrupt: function() { //Since these should only happen when you have no connection and slightly briefly after any //performance hit should not matter - if (this.state.connection === " bad-connection") { + if (this.state.connection === "bad-connection") { AppDispatcher.handleServerAction({ type: ActionTypes.RECIEVED_ERROR, err: null }); this.setState({ numPresses: 0 }); - window.clearInterval(this.state.timerInterrupt); - this.setState({ timerInterrupt: null }); AsyncClient.updateLastViewedAt(); } - else { - window.clearInterval(this.state.timerInterrupt); - this.setState({ timerInterrupt: null }); - } + + window.clearInterval(this.state.timerInterrupt); + this.setState({ timerInterrupt: null }); }, componentDidUpdate: function() { if (this.caret >= 0) { @@ -337,7 +334,7 @@ module.exports = React.createClass({
-