Skip to content

Commit

Permalink
[Vis Editor] - console error on opening the Inspector from visualizat…
Browse files Browse the repository at this point in the history
…ion editor

Closes: #65268
  • Loading branch information
alexwizp committed May 5, 2020
1 parent f2d1095 commit fb23482
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
const adapters = this.handler.inspect();
if (!adapters) return;

this.deps.start().plugins.inspector.open(adapters, {
return this.deps.start().plugins.inspector.open(adapters, {
title: this.getTitle() || '',
});
};
Expand Down
11 changes: 7 additions & 4 deletions src/plugins/visualize/public/application/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,13 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState
},
run() {
const inspectorSession = embeddableHandler.openInspector();
// Close the inspector if this scope is destroyed (e.g. because the user navigates away).
const removeWatch = $scope.$on('$destroy', () => inspectorSession.close());
// Remove that watch in case the user closes the inspector session herself.
inspectorSession.onClose.finally(removeWatch);

if (inspectorSession) {
// Close the inspector if this scope is destroyed (e.g. because the user navigates away).
const removeWatch = $scope.$on('$destroy', () => inspectorSession.close());
// Remove that watch in case the user closes the inspector session herself.
inspectorSession.onClose.finally(removeWatch);
}
},
tooltip() {
if (!embeddableHandler.hasInspector || !embeddableHandler.hasInspector()) {
Expand Down

0 comments on commit fb23482

Please sign in to comment.