Skip to content
This repository was archived by the owner on Feb 9, 2020. It is now read-only.

Commit fce0052

Browse files
committed
fix(inspectedApp): handle refresh better
1 parent 287074b commit fce0052

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

panel/components/inspected-app/inspected-app.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,25 @@ function inspectedAppService($rootScope, $q) {
8080
if (hint.event === 'scope:new') {
8181
addNewScope(hint);
8282
} else if (hint.id && scopes[hint.id]) {
83-
if (hint.event === 'model:change') {
84-
scopes[hint.id].models[hint.path] = (typeof hint.value === 'undefined') ?
83+
var scope = scopes[hint.id];
84+
if (hint.event === 'scope:destroy') {
85+
if (scope.parent) {
86+
scope.parent.children.splice(scope.parent.children.indexOf(child), 1);
87+
}
88+
delete scopes[hint.id];
89+
} else if (hint.event === 'model:change') {
90+
scope.models[hint.path] = (typeof hint.value === 'undefined') ?
8591
undefined : JSON.parse(hint.value);
8692
} else if (hint.event === 'scope:link') {
87-
scopes[hint.id].descriptor = hint.descriptor;
93+
scope.descriptor = hint.descriptor;
8894
}
8995
}
9096
$rootScope.$broadcast(hint.event, hint);
9197
}
9298
}
9399

94100
function onRefreshMessage() {
101+
clear(scopes);
95102
hints.length = 0;
96103
}
97104

@@ -106,4 +113,10 @@ function inspectedAppService($rootScope, $q) {
106113
}
107114
}
108115

116+
function clear (obj) {
117+
Object.keys(obj).forEach(function (key) {
118+
delete obj[key];
119+
});
120+
}
121+
109122
}

0 commit comments

Comments
 (0)