Skip to content

fix(editor): restore notebook undo after file tab switches - #35008

Closed
OrcaWin wants to merge 2 commits into
OrcaWin/notebook-cell-undofrom
OrcaWin/notebook-tab-undo
Closed

OrcaWin wants to merge 2 commits into
OrcaWin/notebook-cell-undofrom
OrcaWin/notebook-tab-undo

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​183 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​181
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​14

ELI5

Notebook cell Undo stopped working after editing a cell, switching to an ordinary file tab, and returning. Give cell models a stable identity so the existing bounded undo cache restores history when the notebook view returns.

What Changed

  • Scope named cell models by file, view, cell and discard generation. Other notebooks, split views and discarded edits cannot borrow that history.
  • Continue disposing the cell model when the whole notebook view unmounts. Reuse Monaco's existing disposed-model undo restoration, including its content check and shared history budget.
  • Keep the existing cell activation model lifetime from fix(editor): keep notebook cell undo across cell and tab switches #34952, external source synchronization and content publication.

Visual Proof

The actual UI flow types one character X, clicks the ordinary text file's tab, verifies the notebook view has unmounted, clicks the notebook tab, activates the cell and presses native Undo.

Original on #34952: X remains after Undo.

Original retains X after Undo

Fixed: Undo removes X after the same tab-return flow.

Fixed removes X after Undo

Testing

  • The new actual-model restoration regression fails on fix(editor): keep notebook cell undo across cell and tab switches #34952; nine controls pass there.
  • All 28 focused tests pass across the cell source lifecycle, notebook rendering and document editing. New coverage proves old-model disposal, restored Undo/Redo, independent file/view/discard owners and rejection of history after an absent-view source change. Existing external reload/reorder/settings and stale-draft controls pass.
  • All three final rendered repetitions pass (56.7s, 1.0m, 44.2s); each exercises the ordinary file tab and real native Undo after returning.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2: all 22 checks pass (360.5s).
  • Linux / Electron 43.8.1, hidden windows on isolated Xvfb. Live macOS, Windows, SSH and mobile were not exercised. Renderer identity adds no host-specific paths or wire fields and applies to git and folder files.

Review

Uses #34952 as its base to extend that cell lifecycle. No new cache, subscription, timer, IPC or close-controller path. The existing native cache shares a 20 MiB history budget and a source-size admission limit; large histories may be evicted under that existing policy. No unbounded live model retention or runtime speed/heap claim. The document-ownership refactor #28995 needs to pass this identity through its cell row during integration.

@OrcaWin

OrcaWin commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

Folded into #34952, which now owns notebook cell undo lifetime across both cell deactivation and tab switches with a single mechanism.

@OrcaWin OrcaWin closed this Oct 29, 2026
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