diff --git a/panel/components/inspected-app/inspected-app.js b/panel/components/inspected-app/inspected-app.js index 1f752ce..d21a053 100644 --- a/panel/components/inspected-app/inspected-app.js +++ b/panel/components/inspected-app/inspected-app.js @@ -63,6 +63,7 @@ function inspectedAppService($rootScope, $q) { $rootScope.$applyAsync(function () { if (msg === 'refresh') { onRefreshMessage(); + $rootScope.$broadcast('refresh'); } else if (typeof msg === 'string') { var hint = JSON.parse(msg); onHintMessage(hint); diff --git a/panel/components/json-tree/json-tree.js b/panel/components/json-tree/json-tree.js index e0477fe..93c383e 100644 --- a/panel/components/json-tree/json-tree.js +++ b/panel/components/json-tree/json-tree.js @@ -42,6 +42,13 @@ function batJsonTreeDirective() { scope.$watch('batModel', function (val) { if (!val) { + root = angular.element(BAT_JSON_TREE_TEMPLATE); + element.html(''); + element.append(root); + branches = { + '': root + }; + return; } Object. diff --git a/panel/components/scope-tree/scope-tree.js b/panel/components/scope-tree/scope-tree.js index 528e5c0..8671c01 100644 --- a/panel/components/scope-tree/scope-tree.js +++ b/panel/components/scope-tree/scope-tree.js @@ -36,6 +36,11 @@ function batScopeTreeDirective($compile) { renderScopeDescriptorElement(data.id, data.descriptor); }); + scope.$on('refresh', function () { + map = {}; + element.html(''); + }); + function renderScopeElement (id, parentId) { if (map[id]) { return; diff --git a/panel/scopes/scopes.js b/panel/scopes/scopes.js index 8032c93..fedb572 100644 --- a/panel/scopes/scopes.js +++ b/panel/scopes/scopes.js @@ -16,13 +16,18 @@ function ScopesController($scope, inspectedApp) { $scope.inspectedScope = null; + $scope.$on('refresh', function () { + $scope.inspectedScope = null; + }); + // expand models the fist time we inspect a scope var cancelWatch = $scope.$watch('inspectedScope', function (newScope) { if (newScope) { $scope.modelsExpanded = true; cancelWatch(); } - }) + }); + $scope.$on('inspected-scope:change', function (ev, data) { inspectScope(data.id);