From a521bb9ea3c4c51b2038e6062c45a4029db52c98 Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Thu, 11 Dec 2014 11:20:20 -0800 Subject: [PATCH] fix(inspectedApp): ignore events with missing scope info --- .../components/inspected-app/inspected-app.js | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/panel/components/inspected-app/inspected-app.js b/panel/components/inspected-app/inspected-app.js index 0b49106..fc39256 100644 --- a/panel/components/inspected-app/inspected-app.js +++ b/panel/components/inspected-app/inspected-app.js @@ -64,19 +64,21 @@ function inspectedAppService($rootScope) { function onHintMessage(hint) { if (hint.message) { hints.push(hint); - } else if (hint.event === 'model:change') { - scopes[hint.id].models[hint.path] = (typeof hint.value === 'undefined') ? - undefined : JSON.parse(hint.value); - } else if (hint.event === 'scope:new') { - addNewScope(hint); - } else if (hint.event === 'scope:link') { - scopes[hint.id].descriptor = hint.descriptor; - } - - if (hint.event) { + } else if (hint.event) { + if (hint.id) { + if (hint.event === 'scope:new') { + addNewScope(hint); + } else if (scopes[hint.id]) { + if (hint.event === 'model:change') { + scopes[hint.id].models[hint.path] = (typeof hint.value === 'undefined') ? + undefined : JSON.parse(hint.value); + } else if (hint.event === 'scope:link') { + scopes[hint.id].descriptor = hint.descriptor; + } + } + } $rootScope.$broadcast(hint.event, hint); } - } function onRefreshMessage() {