Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| * Track the current iframe and placeholder widgets so we can dispose them. | ||
| */ | ||
| private _activeIframe: IFrameWidget | null = null; | ||
| private _activePlaceholder: PlaceholderWidget | null = null; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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); | ||
| } |
There was a problem hiding this comment.
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.


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.
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
NotebookViewModePluginthat 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
StreamlitPreviewPlugininto a pure process manager (startPreview/editPreview/stopPreview) and updates AI chat/agent execution to depend on the newINotebookViewModeservice for creating/editing Streamlit apps. Removes the notebook-level toolbar button config for Streamlit preview (toolbar-buttons.jsonnow has an emptyNotebooktoolbar). 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.