From 6e0b32e4b86d950dd2a879b7a80a57c66481b28c Mon Sep 17 00:00:00 2001 From: "Afshin T. Darian" Date: Mon, 23 Dec 2019 16:16:22 +0000 Subject: [PATCH] Fix strict null check errors. --- packages/application-extension/src/index.tsx | 4 ++-- packages/application/src/frontend.ts | 2 +- packages/filebrowser-extension/src/index.ts | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/application-extension/src/index.tsx b/packages/application-extension/src/index.tsx index ce75423bb774..14e5fabd7cdf 100644 --- a/packages/application-extension/src/index.tsx +++ b/packages/application-extension/src/index.tsx @@ -282,10 +282,10 @@ const tree: JupyterFrontEndPlugin = { const treeMatch = args.path.match(treePattern); const workspaceMatch = args.path.match(workspacePattern); const match = treeMatch || workspaceMatch; - const file = match ? decodeURI(match[1]) : undefined; + const file = match ? decodeURI(match[1]) : ''; const workspace = PathExt.basename(resolver.name); const query = URLExt.queryStringToObject(args.search ?? ''); - const browser = query['file-browser-path']; + const browser = query['file-browser-path'] || ''; // Remove the file browser path from the query string. delete query['file-browser-path']; diff --git a/packages/application/src/frontend.ts b/packages/application/src/frontend.ts index ee07b75f5efc..b615b0459a6c 100644 --- a/packages/application/src/frontend.ts +++ b/packages/application/src/frontend.ts @@ -334,7 +334,7 @@ export namespace JupyterFrontEnd { export namespace ITreeResolver { /** * The browser and file paths if the tree resolver encountered and handled - * a tree URL or `null` if not. + * a tree URL or `null` if not. Empty string paths should be ignored. */ export type Paths = { browser: string; file: string } | null; } diff --git a/packages/filebrowser-extension/src/index.ts b/packages/filebrowser-extension/src/index.ts index 198668e3b695..514c4317c12a 100644 --- a/packages/filebrowser-extension/src/index.ts +++ b/packages/filebrowser-extension/src/index.ts @@ -230,7 +230,8 @@ async function activateFactory( manager: docManager, driveName: options.driveName || '', refreshInterval: options.refreshInterval, - state: options.state === null ? undefined : options.state || state + state: + options.state === null ? undefined : options.state || state || undefined }); const restore = options.restore; const widget = new FileBrowser({ id, model, restore });