Files
orca/src
Neil 2d770c8af7 perf(worktrees): stop worktree removal from replacing maps it never touched (#19058)
* perf(worktrees): stop worktree removal from replacing maps it never touched

applyRemoveWorktreeSuccessState spread-then-deleted about 50 store maps on every
worktree removal. A removed worktree has an entry in only a few of them, so the
rest were handed back with a new reference and identical contents — rerendering
every component selecting them, git status caches and split-tab layout included.

The sibling purge path already had the right contract (`return changed ? out :
obj`) inlined into nine near-identical closures. That contract moves to
omitRecordKey/omitRecordKeys, the removal cascade adopts it, and the purge
omitters drop their duplicated copies.

The one behaviour to preserve carefully: `{ ...undefined }` normalised an omitted
slice to `{}`, and some worktree-isolation callers do hand over states with
slices missing. The helper keeps that, so a nullish record still yields `{}`
rather than throwing on `in` or leaking undefined into the store.

* refactor(worktrees): fold removeWorktree cleanup onto one omitRecordKeys helper

Drop the single-key omitRecordKey twin and build the removal patch inline
from three scoped omitters (worktree / tab / file), keeping every purged
field and its why-comment. 273 -> 137 lines.

* style: format the teardown files with oxfmt

The review pass reformatted these with prettier — semicolons and double quotes —
which is not this repo's formatter. oxfmt --check failed on all three.
2026-09-06 14:50:27 -07:00
..