From c22229c205a0a4e1e7e9bbc415378ec88f34dab2 Mon Sep 17 00:00:00 2001 From: Jari Bakken Date: Mon, 27 Oct 2014 13:29:47 +0100 Subject: [PATCH] Stop timer in componentWillUnmount --- unleash-server/public/js/unleash.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/unleash-server/public/js/unleash.jsx b/unleash-server/public/js/unleash.jsx index 6f085b4706..3eda97aee5 100644 --- a/unleash-server/public/js/unleash.jsx +++ b/unleash-server/public/js/unleash.jsx @@ -209,7 +209,7 @@ var Unleash = React.createClass({ savedFeatures: [], unsavedFeatures: [], errors: [], - poller: null + timer: null }; }, @@ -219,6 +219,12 @@ var Unleash = React.createClass({ this.state.timer.start(); }, + componentWillUnmount: function () { + if (this.state.timer != null) { + this.state.timer.stop(); + } + }, + loadFeaturesFromServer: function () { reqwest('features').then(this.setFeatures, this.handleError); },