From 8ebd16b312bc106764c2c673a047801ee487673d Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Sun, 18 Feb 2024 23:09:39 -0800 Subject: [PATCH] Don't remove URL parameters after loading This allows users to simply share the URL again, but may cause problems with overwriting if the page is reloaded. So perhaps this needs to be optional? Alternatively, we can make a fork specifically focused on jupyterlite only? --- src/index.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2647fc2..93f288c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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'; @@ -53,15 +53,6 @@ const plugin: JupyterFrontEndPlugin = { } 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 => { let type = ''; @@ -108,13 +99,11 @@ const plugin: JupyterFrontEndPlugin = { 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(); }); } });