From b4b0e92fd49c50d5e5125a1092d71fc5832b468b Mon Sep 17 00:00:00 2001
From: Reed Garmsen <rgarmsen2295@gmail.com>
Date: Thu, 9 Jul 2015 18:23:14 -0700
Subject: Moved check for existing timer interrupt outside of if-else block for
 sanity

---
 web/react/components/textbox.jsx | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'web/react/components/textbox.jsx')

diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx
index 718ecbe4c..b5b696124 100644
--- a/web/react/components/textbox.jsx
+++ b/web/react/components/textbox.jsx
@@ -49,6 +49,11 @@ module.exports = React.createClass({
     _onError: function() {
         var errorState = getStateFromStores();
 
+        if (this.state.timerInterrupt != null) {
+            window.clearInterval(this.state.timerInterrupt);
+            this.setState({ timerInterrupt: null });
+        }
+
         if (errorState.message === "There appears to be a problem with your internet connection") {
             this.setState({ connection: " bad-connection" });
             var timerInterrupt = window.setInterval(this._onTimerInterrupt, 5000);
@@ -56,10 +61,6 @@ module.exports = React.createClass({
         }
         else {
             this.setState({ connection: "" });
-            if (this.state.timerInterrupt != null) {
-                window.clearInterval(this.state.timerInterrupt);
-                this.setState({ timerInterrupt: null });
-            }
         }
     },
     _onTimerInterrupt: function() {
-- 
cgit v1.2.3-1-g7c22

