Files
orca/src
brennanb2025andOrca ffaca13be9 fix(editor): dispose leaked Monaco models in Changes mode and split-pane diff tabs
Two leaks surfaced in PR #1353 review (see docs/changes-mode-followups.md):

1. ChangesModeView rotates the original-side model URI on each HEAD
   content change, but @monaco-editor/react's `keepCurrentOriginalModel`
   flag prevents the wrapper from disposing the rotated-out model. Track
   the previous URI in a ref and dispose it explicitly on rotation and
   on unmount.

2. EditorPanel's tab-close cleanup disposed only the plain edit model
   for `case 'edit'`, leaving the kept Changes-mode diff models in the
   registry. The `case 'diff'` branch had the analogous bug for
   split-pane URIs. Replace exact-URI lookups with a prefix scan that
   covers single-pane, split-pane (`::scope`), and rotated-original
   (`:original:hash`) URI shapes. Extract the predicate to
   editor-model-leak.ts and unit-test both modes.

Also tightens two comments (SourceControl Changes-mode carve-out and
EditorPanel inFlightDiffKey IPC sharing scope) to match actual behavior.

Co-authored-by: Orca <help@stably.ai>
2026-05-05 15:21:07 -07:00
..