From d82230dea438b17da167d97d23afdbd6420fd9b7 Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Tue, 4 Jul 2017 17:03:25 -0700 Subject: [PATCH] [Resize] don't trigger callback when destroyed Prevent MCTResize from triggering a callback after it is destroyed. Fixes https://github.com/nasa/openmct/issues/1509 --- platform/commonUI/general/src/directives/MCTResize.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/commonUI/general/src/directives/MCTResize.js b/platform/commonUI/general/src/directives/MCTResize.js index d16384620d..130f0ce9e2 100644 --- a/platform/commonUI/general/src/directives/MCTResize.js +++ b/platform/commonUI/general/src/directives/MCTResize.js @@ -83,13 +83,14 @@ define( // Callback to fire after each timeout; // update bounds and schedule another timeout function onInterval() { + if (!active) { + return; + } fireEval({ width: element[0].offsetWidth, height: element[0].offsetHeight }); - if (active) { - $timeout(onInterval, currentInterval(), false); - } + $timeout(onInterval, currentInterval(), false); } // Stop running in the background