From 78654efa5ecce46e81ef637392e126cae52b8e07 Mon Sep 17 00:00:00 2001 From: AdrySky Date: Mon, 14 Feb 2022 16:50:00 +0800 Subject: [PATCH 1/3] Clean import spacing --- src/kernel/panel.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/kernel/panel.ts b/src/kernel/panel.ts index 19162de5..f4475b6c 100644 --- a/src/kernel/panel.ts +++ b/src/kernel/panel.ts @@ -3,23 +3,16 @@ import { SessionContext, sessionContextDialogs, } from '@jupyterlab/apputils'; - import { OutputAreaModel, SimplifiedOutputArea } from '@jupyterlab/outputarea'; - import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; - import { KernelMessage, ServiceManager } from '@jupyterlab/services'; - import { ITranslator, nullTranslator, TranslationBundle, } from '@jupyterlab/translation'; - import { Message } from '@lumino/messaging'; - import { StackedPanel } from '@lumino/widgets'; - import { Log } from '../log/LogPlugin'; import { XircuitFactory } from '../xircuitFactory'; From ca00e20382a33887c1f2615313f5b04aa57a0d6f Mon Sep 17 00:00:00 2001 From: AdrySky Date: Mon, 14 Feb 2022 16:50:54 +0800 Subject: [PATCH 2/3] Dispose output panel when closing browser or tab --- src/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index c072fa77..2c60af44 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -212,6 +212,11 @@ const xircuits: JupyterFrontEndPlugin = { return outputPanel; } + // Dispose the output panel when closing browser or tab + window.addEventListener('beforeunload', function (e) { + outputPanel.dispose(); + }); + async function requestToSparkSubmit(path: string, addArgs: string) { const dataToSend = { "currentPath": path, "addArgs": addArgs }; From 66a08399651a4f2eb71c95f4343c7d6220a1855e Mon Sep 17 00:00:00 2001 From: AdrySky Date: Mon, 14 Feb 2022 16:54:15 +0800 Subject: [PATCH 3/3] Use the same kernel as long as panel still exist --- src/index.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 2c60af44..6957a36d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -99,7 +99,7 @@ const xircuits: JupyterFrontEndPlugin = { }), name: widget => widget.context.path }); - + // Creating the sidebar widget for the xai components const sidebarWidget = ReactWidget.create(); sidebarWidget.id = 'xircuits-component-sidebar'; @@ -248,9 +248,6 @@ const xircuits: JupyterFrontEndPlugin = { // Create the panel if it does not exist if (!outputPanel || outputPanel.isDisposed) { await createPanel(); - } else { - outputPanel.dispose(); - await createPanel(); } outputPanel.session.ready.then(async () => {