Repository navigation
fix(desktop): make sidebar project ordering deterministic and prepend new projects - #5999
Merged
Merged
Conversation
|
Ready to review this PR? Stage has broken it down into 3 individual chapters for you:
Chapters generated by Stage for commit b7a6bbe on Jul 27, 2026 10:03pm UTC. |
Contributor
📝 WalkthroughWalkthroughDashboard sidebar LiveQuery pipelines now produce deterministic project, section, and workspace ordering when tab-order values collide. ChangesDashboard sidebar ordering
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Sidebar project/section/workspace queries ordered by tabOrder alone, but tabOrders can collide (bulk ensure paths can mint duplicates), and a tie left to the query engine flips arbitrarily on unrelated re-emissions — projects visibly jumped when a workspace reorder recomputed the pipeline. Chain a stable id as the secondary orderBy on all three queries. Claude-Session: https://claude.ai/code/session_01SSUQYFamkYAjs5sDQC5RLS
The live query's incremental orderBy does not reliably re-sort when placement rows are inserted or renumbered — a newly added project with tabOrder 1 stayed appended at the bottom of the sidebar until a full reload re-materialized the query. Workspaces and sections are immune because buildDashboardSidebarProjects re-sorts them in JS; project order was taken straight from the query emission. Select tabOrder and sort the rows in a memo instead (tabOrder, then projectId for duplicate-proof determinism). Claude-Session: https://claude.ai/code/session_01SSUQYFamkYAjs5sDQC5RLS
AviPeltz
force-pushed
the
fix-sidebar-order-tiebreak
branch
from
July 27, 2026 21:57
a9de473 to
dc65159
Compare
New workspaces already prepend to the top of their project's lane; new projects appended to the bottom of the project list. Use the existing prepend helper so the project you just added — the one you're about to work in — lands first, consistent with workspace placement. Claude-Session: https://claude.ai/code/session_01SSUQYFamkYAjs5sDQC5RLS
Contributor
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Sidebar projects were observed jumping position after reordering a workspace inside a project — an operation that never writes project order.
Root cause: the sidebar's project/section/workspace queries order by
tabOrderalone, and tabOrders can collide (bulk ensure paths like the dev sidebar seeder can mint duplicates). A tie left to the query engine is broken arbitrarily, so any unrelated re-emission of the sidebar data pipeline — e.g. the flurry of local-state writes a workspace drag commits — can flip tied rows. Dragging a project self-heals the data (reorderProjectsrenumbers 1..n), which is why the issue is intermittent and stops reproducing after a manual project drag.Fix
Chain a stable id as a secondary
orderByon all three queries inuseDashboardSidebarData(projectId/sectionId/workspaceId). Order is now fully deterministic even with duplicate tabOrders.Validation
https://claude.ai/code/session_01SSUQYFamkYAjs5sDQC5RLS
Summary by cubic
Fixes sidebar item jumping by making project, section, and workspace ordering deterministic. New projects now prepend to the top of the list; project rows sort in JS with a stable tiebreak so order stays correct after inserts or updates.
Bug Fixes
tabOrderand sort rows in JS bytabOrderthenprojectId(fixes incrementalorderBynot re-sorting; new projects no longer stick at the bottom until reload).orderByonsectionId/workspaceIdaftertabOrderinuseDashboardSidebarData.New Features
tabOrder), consistent with workspace placement.Written for commit b7a6bbe. Summary will update on new commits.
Summary by CodeRabbit