fix(desktop): stable createdAt tiebreaker in v2 workspaces list sort#3967
fix(desktop): stable createdAt tiebreaker in v2 workspaces list sort#3967saddlepaddle merged 1 commit intomainfrom
Conversation
…aces The within-host createdAt order was being flipped by the host sort direction toggle. Apply the directional flip to the primary field only, then always use newest-first createdAt as the tiebreaker.
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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. Review rate limit: 3/8 reviews remaining, refill in 34 minutes and 26 seconds.Comment |
Greptile SummaryThis PR fixes a one-liner sort bug in Confidence Score: 5/5Safe to merge — the change is a minimal, correct fix with no logic regressions. Single-file, three-line change that correctly separates the directional flip from the stable tiebreaker. The old and new tiebreaker activation conditions are equivalent (both fire when cmp === 0), and the 'created' field edge case is handled cleanly. No new state, no new dependencies, no security surface. No files require special attention.
|
| Filename | Overview |
|---|---|
| apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/V2WorkspacesList.tsx | Fixed compareWorkspaces tiebreaker so the createdAt newest-first fallback is applied after the directional flip rather than before, making it stable regardless of sort direction. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["compareWorkspaces(a, b, field, direction)"] --> B["switch(field): compute cmp"]
B --> C["directional = direction==='asc' ? cmp : -cmp"]
C --> D{directional !== 0?}
D -- Yes --> E["return directional\n(primary sort wins)"]
D -- No --> F["return b.createdAt - a.createdAt\n(always newest-first tiebreaker)"]
Reviews (1): Last reviewed commit: "fix(desktop): keep createdAt tiebreaker ..." | Re-trigger Greptile
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
createdAtas the final tiebreaker. After grouping by device, workspaces on the same device now sort by createdAt consistently regardless of direction.Test plan
Summary by cubic
Fixes sorting in the v2 workspaces list by making
createdAta stable, newest-first tiebreaker. Within each device, the newest workspace stays first regardless of Host sort direction; Created sorting still respects asc/desc.createdAtconsistently across Host, Name, Branch, and Sidebar.Written for commit d98e36b. Summary will update on new commits.
Summary by CodeRabbit