Repository navigation
fix(renderer): preserve workspace shortcut order when sidebar closes - #9548
OnlyYu1996 wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughThe sidebar visible-worktree cache now tracks whether rendered ordering is active, prunes cached IDs against current visibility, and retains folder-workspace IDs. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
|
Rebased onto current Validation on the rebased head: 50 targeted tests, |
|
Rebased onto current The Validation: 2 related test files / 56 tests, |
|
Hi @OnlyYu1996 — thanks for digging into this one. Your diagnosis of the open-vs-closed split is correct, and it's what pointed me at the right area. I've opened #10693 with a different approach, so flagging it here rather than leaving two PRs silently competing. The difference: pruning the retained cache on unmount can only ever remove stale IDs, so a workspace created while the sidebar is closed still gets no number, and the ordering rules stay duplicated in two places. #10693 recomputes the order from the sidebar's own row pipeline ( Not a knock on yours — happy for maintainers to take whichever they prefer. Credit to you for finding it first. |
|
Hi @OnlyYu1996 — closing this in favour of #10693, and I want to be straight with you about why, since you got here first and your diagnosis was right. You correctly identified that the shortcut order goes wrong specifically when the sidebar is closed, and that Where the approaches differ: this PR retains the last rendered order and prunes stale ids. Pruning can only ever remove entries, so a workspace created while the sidebar is closed never enters the numbering at all — and the tests here assert order is preserved across unmount with an unchanged store, so they can't catch that case. It also leaves the ordering rules living in two places, which is how the sidebar and the shortcut drifted apart originally. #10693 recomputes the order by replaying the sidebar's own row pipeline ( This isn't a knock on your work — the pruning approach is a reasonable read of the problem, and your rebases through two conflicting refactors were diligent. Thank you for the report and the fix attempt; please do keep sending PRs. |
Summary
Fixes #9497
Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm typecheck:webpassed.pnpm testpnpm buildAdditional repository gates passed: touched-file Oxfmt,
git diff --check, max-lines ratchet, and reliability gates.AI Review Report
The review checked the rendered-order lifecycle when the sidebar mounts and unmounts, stale-ID pruning, duplicate removal, collapsed groups, empty rendered orders, pinned children, and folder-workspace retention. The rebase conflict was resolved by retaining both sides of the contract: the PR cache lifecycle and prune-only fallback, plus mainline lineage projection, cycle handling,
forcedVisibleWorktreeIds, andinjectLineageAncestors.Cross-platform compatibility was reviewed for macOS, Linux, and Windows. The change only manages renderer-side workspace IDs and does not alter shortcuts, labels, filesystem paths, shell behavior, Electron platform branches, SSH execution, or Git-provider behavior.
Security Audit
This change only reads and filters in-memory workspace IDs. It adds no command execution, path handling, authentication, secrets, dependencies, network access, or IPC behavior. IDs remain opaque and are deduplicated with sets. No follow-up security work is needed.
Notes
upstream/mainat41751dd90.