mirror of
https://github.com/stablyai/orca.git
synced 2026-10-21 00:03:46 +00:00
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>