zyratlo commented on code in PR #5271:
URL: https://github.com/apache/texera/pull/5271#discussion_r3693507227


##########
frontend/src/app/workspace/service/jupyter-panel/jupyter-panel.service.ts:
##########
@@ -209,19 +210,70 @@ export class JupyterPanelService {
     if (!this.enabled) return;
     if (panelName === "JupyterNotebookPanel") {
       this.jupyterNotebookPanelVisible.next(true);
+      // Opening the panel means the current workflow has an associated 
notebook, so
+      // surface the toolbar "expand" button (jupyterNotebookExists$) right 
away. Needed
+      // after an in-place import where the wid does not change and init() 
does not re-run
+      // to detect the notebook.
+      this.jupyterNotebookExists.next(true);
     }
   }
 
-  // Close the Jupyter Notebook panel
-  public closeJupyterNotebookPanel(): void {
+  // Delete the current workflow's stored notebook from the backend, then hide 
the
+  // panel and clear all local notebook state. This is the user-initiated 
action
+  // behind the panel's delete button, and is distinct from the workflow-switch
+  // cleanup (hideAndClearLocalState), which must never touch the backend.
+  public deleteJupyterNotebook(): void {
     if (!this.enabled) return;
+    const wid = this.workflowActionService.getWorkflow().wid;
+    if (wid === undefined) {
+      // Unsaved workflow: nothing persisted, so just reset local state.
+      this.hideAndClearLocalState();
+      this.jupyterNotebookExists.next(false);
+      this.clearHighlights();
+      return;
+    }

Review Comment:
   resolved in 
[f3671b9](https://github.com/apache/texera/pull/5271/commits/f3671b9cfb825c8ea7accf8d69ef92c480ee12cf)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to