Skip to content

Commit

Permalink
Fix handling of default factory in the URL (#6873)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpio authored May 16, 2023
1 parent d518364 commit e976dfd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/docmanager-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const opener: JupyterFrontEndPlugin<IDocumentWidgetOpener> = {
provides: IDocumentWidgetOpener,
activate: (app: JupyterFrontEnd) => {
const baseUrl = PageConfig.getBaseUrl();
const docRegistry = app.docRegistry;
let id = 0;
return new (class {
open(widget: IDocumentWidget, options?: DocumentRegistry.IOpenOptions) {
Expand All @@ -42,7 +43,8 @@ const opener: JupyterFrontEndPlugin<IDocumentWidgetOpener> = {
}
let url = `${baseUrl}${route}/${path}`;
// append ?factory only if it's not the default
if (widgetName !== 'default') {
const defaultFactory = docRegistry.defaultWidgetFactory(path);
if (widgetName !== defaultFactory.name) {
url = `${url}?factory=${widgetName}`;
}
window.open(url);
Expand Down

0 comments on commit e976dfd

Please sign in to comment.