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

Commit f2a9044

Browse files
committed
fix(panel): handle refresh better
1 parent ca0dc69 commit f2a9044

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function inspectedAppService($rootScope, $q) {
6363
$rootScope.$applyAsync(function () {
6464
if (msg === 'refresh') {
6565
onRefreshMessage();
66+
$rootScope.$broadcast('refresh');
6667
} else if (typeof msg === 'string') {
6768
var hint = JSON.parse(msg);
6869
onHintMessage(hint);

panel/components/json-tree/json-tree.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ function batJsonTreeDirective() {
4242

4343
scope.$watch('batModel', function (val) {
4444
if (!val) {
45+
root = angular.element(BAT_JSON_TREE_TEMPLATE);
46+
element.html('');
47+
element.append(root);
48+
branches = {
49+
'': root
50+
};
51+
4552
return;
4653
}
4754
Object.

panel/components/scope-tree/scope-tree.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ function batScopeTreeDirective($compile) {
3636
renderScopeDescriptorElement(data.id, data.descriptor);
3737
});
3838

39+
scope.$on('refresh', function () {
40+
map = {};
41+
element.html('');
42+
});
43+
3944
function renderScopeElement (id, parentId) {
4045
if (map[id]) {
4146
return;

panel/scopes/scopes.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ function ScopesController($scope, inspectedApp) {
1616

1717
$scope.inspectedScope = null;
1818

19+
$scope.$on('refresh', function () {
20+
$scope.inspectedScope = null;
21+
});
22+
1923
// expand models the fist time we inspect a scope
2024
var cancelWatch = $scope.$watch('inspectedScope', function (newScope) {
2125
if (newScope) {
2226
$scope.modelsExpanded = true;
2327
cancelWatch();
2428
}
25-
})
29+
});
30+
2631

2732
$scope.$on('inspected-scope:change', function (ev, data) {
2833
inspectScope(data.id);

0 commit comments

Comments
 (0)