Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {

import { showErrorMessage } from '@jupyterlab/apputils';

import { PageConfig, PathExt, URLExt } from '@jupyterlab/coreutils';
import { PathExt } from '@jupyterlab/coreutils';

import { IDefaultFileBrowser } from '@jupyterlab/filebrowser';

Expand Down Expand Up @@ -53,15 +53,6 @@ const plugin: JupyterFrontEndPlugin<void> = {
}
const urls = paths.map(path => decodeURIComponent(path));

// handle the route and remove the fromURL parameter
const handleRoute = () => {
const url = new URL(URLExt.join(PageConfig.getBaseUrl(), request));
// only remove the fromURL parameter
url.searchParams.delete(paramName);
const { pathname, search } = url;
router.navigate(`${pathname}${search}`, { skipRouting: true });
};

// fetch the file from the URL and open it with the docmanager
const fetchAndOpen = async (url: string): Promise<void> => {
let type = '';
Expand Down Expand Up @@ -108,13 +99,11 @@ const plugin: JupyterFrontEndPlugin<void> = {
if (match?.includes('/notebooks') || match?.includes('/edit')) {
const [first] = urls;
await fetchAndOpen(first);
handleRoute();
return;
}

app.restored.then(async () => {
await Promise.all(urls.map(url => fetchAndOpen(url)));
handleRoute();
});
}
});
Expand Down