From 02fbb294ca745911c41e8c04fc22c9619ff69bb6 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Thu, 10 Dec 2020 22:08:17 +0100 Subject: [PATCH] Do not activate lab-extension if no notebook tracker --- packages/lab-extension/src/index.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/lab-extension/src/index.ts b/packages/lab-extension/src/index.ts index fdced51b8..1ee39b1f5 100644 --- a/packages/lab-extension/src/index.ts +++ b/packages/lab-extension/src/index.ts @@ -73,15 +73,17 @@ class ClassicButton const openClassic: JupyterFrontEndPlugin = { id: '@jupyterlab-classic/lab-extension:open-classic', autoStart: true, - requires: [INotebookTracker], - optional: [ICommandPalette, IMainMenu], + optional: [INotebookTracker, ICommandPalette, IMainMenu], activate: ( app: JupyterFrontEnd, notebookTracker: INotebookTracker, palette: ICommandPalette | null, menu: IMainMenu | null ) => { - // TODO: do not activate if already in a IClassicShell + // TODO: do not activate if already in a IClassicShell? + if (!notebookTracker) { + return; + } const { commands, docRegistry, shell } = app; const baseUrl = PageConfig.getBaseUrl();