Skip to content

[WIP] Documents#2184

Open
aarondr77 wants to merge 9 commits intodevfrom
documents
Open

[WIP] Documents#2184
aarondr77 wants to merge 9 commits intodevfrom
documents

Conversation

@aarondr77
Copy link
Member

@aarondr77 aarondr77 commented Feb 13, 2026

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context, and the specification if there is one.

Testing

Please provide a list of the ways you can "access" or use the functionality. Please try and be exhaustive here, and make sure that you test everything you list.

  • I have tested this on real data that is reasonable and large
  • If I changed the interaction with JupyterLab, I tested that it does not break other programs (like VS Code), and tested that it works "multiple times" in the same notebook.

Documentation

Note if any new documentation needs to addressed or reviewed.


Note

Medium Risk
Touches JupyterLab notebook UI composition (toolbars/content swapping) and Streamlit preview lifecycle management, which could introduce regressions in notebook rendering, disposal/cleanup, or preview process handling across tab switches.

Overview
Introduces a new NotebookViewModePlugin that adds a three-state mode switcher (Notebook/Document/App) per notebook, including a Document mode that hides code inputs via CSS and supports double-clicking outputs to jump back to edit mode.

Reworks App preview behavior to be in-place within the existing notebook tab: App mode swaps notebook content for a placeholder/iframe and provides an app toolbar (Edit/Recreate/Deploy), while also ensuring Streamlit preview processes are stopped when leaving App mode or disposing the panel.

Refactors StreamlitPreviewPlugin into a pure process manager (startPreview/editPreview/stopPreview) and updates AI chat/agent execution to depend on the new INotebookViewMode service for creating/editing Streamlit apps. Removes the notebook-level toolbar button config for Streamlit preview (toolbar-buttons.json now has an empty Notebook toolbar). Adds unit tests and new styles for the mode switcher and toolbar layout.

Written by Cursor Bugbot for commit 95e031c. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
monorepo Ready Ready Preview, Comment Feb 17, 2026 3:49am

Request Review

* Track the current iframe and placeholder widgets so we can dispose them.
*/
private _activeIframe: IFrameWidget | null = null;
private _activePlaceholder: PlaceholderWidget | null = null;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Singleton preview state breaks multi-notebook App mode

Medium Severity

_activePreviewId, _activeIframe, and _activePlaceholder are stored as singleton instance variables, but _notebookModes is a per-notebook Map. If a second notebook enters App mode, _showPlaceholder calls _disposeTransientWidgets, which disposes the first notebook's iframe (leaving it visually empty), and overwrites _activePreviewId, leaking the first notebook's Streamlit process. Worse, when the first panel is disposed, _cleanupPanel calls _killActiveProcess which kills the second notebook's process. These fields need to be keyed per-notebook to match the per-notebook mode tracking.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

this._disposeTransientWidgets();
}
this._notebookModes.delete(panel.id);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memory leak from unreleased dblclick listener

Medium Severity

_cleanupPanel only cleans up resources for panels in App mode, missing cleanup for Document mode's dblclick event listener. When a notebook panel is disposed while in Document mode, the DOM event listener attached via addEventListener (line 498) is never removed, causing a memory leak. The listener remains attached to the disposed panel's DOM node and holds references preventing garbage collection.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant