Skip to content

Commit

Permalink
Merge pull request #7633 from jtpio/close-output-views
Browse files Browse the repository at this point in the history
Close output views on notebook closed
  • Loading branch information
Steven Silvester committed Dec 17, 2019
2 parents 8b37871 + f909bc3 commit e16485e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/notebook-extension/src/index.ts
Expand Up @@ -1668,16 +1668,17 @@ function addCommands(
const updateCloned = () => {
void clonedOutputs.save(widget);
};

current.context.pathChanged.connect(updateCloned);
current.content.model.cells.changed.connect(updateCloned);
current.context.model.cells.changed.connect(updateCloned);

// Add the cloned output to the output widget tracker.
void clonedOutputs.add(widget);

// Remove the output view if the parent notebook is closed.
current.content.disposed.connect(() => {
current.context.pathChanged.disconnect(updateCloned);
current.content.model.cells.changed.disconnect(updateCloned);
current.context.model.cells.changed.disconnect(updateCloned);
widget.dispose();
});
},
Expand Down

0 comments on commit e16485e

Please sign in to comment.