Преглед изворни кода

Fix console error when closing notebook (#10426)

Martha Cryan пре 3 година
родитељ
комит
c771579c20
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      packages/notebook-extension/src/index.ts

+ 4 - 1
packages/notebook-extension/src/index.ts

@@ -1440,7 +1440,10 @@ function addCommands(
   // Set up collapse signal for each header cell in a notebook
   tracker.currentChanged.connect(
     (sender: INotebookTracker, panel: NotebookPanel) => {
-      panel.content.model?.cells.changed.connect(
+      if (!panel?.content?.model?.cells) {
+        return;
+      }
+      panel.content.model.cells.changed.connect(
         (
           list: IObservableUndoableList<ICellModel>,
           args: IObservableList.IChangedArgs<ICellModel>