Repository navigation
perf(renderer): scope editor Git subscriptions by worktree - #8107
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughEditor Git status and branch data is now selected for the active file’s worktree using dedicated typed selectors. The editor content-state hook and render-model function accept scoped entries instead of whole worktree maps. Selector tests cover background-worktree invalidation, entry replacement, and missing worktrees, while related editor tests update their fixtures to pass active-worktree entries. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Why
EditorPanelsubscribed to the completegitStatusByWorktreeandgitBranchChangesByWorktreemaps. Zustand compares selector results by reference, so every immutable map replacement woke every mounted Monaco or rich-editor pane—even when only a different worktree changed.The store already preserves unchanged per-worktree array references. Selecting those arrays directly keeps active data live and removes cross-worktree subscription fanout.
Performance evidence
Synthetic subscription scenario: 200 mounted editor panels, 200 background status-map replacements, and 200 background branch-map replacements.
Owning status and branch entry replacements continue to publish. This measures subscription invalidations directly; it does not infer a render-time speedup from a microbenchmark.
Validation
pnpm typecheckpassed.git diff --checkpassed.pnpm lintreaches only the unchanged mainline Japanese interpolation mismatch forcomponents.native-chat.composer.uploadingAttachments.ELI5
A Git refresh in one worktree used to wake editors that belonged to other worktrees. Editors now listen only to Git changes for the worktree they display.