From 4eca86cbcd6a676346900c6d2f3346fb0c1ad5bc Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Thu, 20 Jan 2022 16:04:42 +0100 Subject: [PATCH] Wait for settings before opening the notebook --- packages/application-extension/src/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/application-extension/src/index.ts b/packages/application-extension/src/index.ts index 109fd19fc..fac2a0af9 100644 --- a/packages/application-extension/src/index.ts +++ b/packages/application-extension/src/index.ts @@ -159,10 +159,12 @@ const opener: JupyterFrontEndPlugin = { id: '@retrolab/application-extension:opener', autoStart: true, requires: [IRouter, IDocumentManager], + optional: [ISettingRegistry], activate: ( app: JupyterFrontEnd, router: IRouter, - docManager: IDocumentManager + docManager: IDocumentManager, + settingRegistry: ISettingRegistry | null ): void => { const { commands } = app; @@ -178,9 +180,12 @@ const opener: JupyterFrontEndPlugin = { const file = decodeURIComponent(path); const ext = PathExt.extname(file); - app.restored.then(() => { + app.restored.then(async () => { // TODO: get factory from file type instead? if (ext === '.ipynb') { + // TODO: fix upstream? + await settingRegistry?.load('@jupyterlab/notebook-extension:panel'); + await Promise.resolve(); docManager.open(file, NOTEBOOK_FACTORY, undefined, { ref: '_noref' });