Browse Source

🐛 Fix handling of disposed widgets after closing a panel

Sebastián Ramírez 4 years ago
parent
commit
4dbd1e3304
1 changed files with 2 additions and 1 deletions
  1. 2 1
      docs/source/developer/extension_tutorial.rst

+ 2 - 1
docs/source/developer/extension_tutorial.rst

@@ -819,8 +819,9 @@ Finally, rewrite the ``activate`` function so that it:
       app.commands.addCommand(command, {
         label: 'Random Astronomy Picture',
         execute: () => {
-          if (!widget) {
+          if (!widget || widget.isDisposed) {
             // Create a new widget if one does not exist
+            // or if the previous one was disposed after closing the panel
             const content = new APODWidget();
             widget = new MainAreaWidget({content});
             widget.id = 'apod-jupyterlab';