Skip to content

fix(desktop): render pending workspaces at top of sidebar#3655

Merged
Kitenite merged 2 commits into
mainfrom
when-creating-a-new-workspace-we-have-the-pending-at-the-bottom-of-the-sidebar-and-the-new-workspace
Apr 22, 2026
Merged

fix(desktop): render pending workspaces at top of sidebar#3655
Kitenite merged 2 commits into
mainfrom
when-creating-a-new-workspace-we-have-the-pending-at-the-bottom-of-the-sidebar-and-the-new-workspace

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Apr 22, 2026

Summary

  • New workspaces are inserted at the top via getPrependTabOrder, but pending placeholders were pinned to Number.MAX_SAFE_INTEGER — so the "creating"/"failed" row appeared at the bottom while the real workspace showed up at the top.
  • Flip PENDING_WORKSPACE_TAB_ORDER to Number.MIN_SAFE_INTEGER so pending rows render at the top, right where the real workspace will land once creation succeeds.

Test plan

  • Create a new workspace; confirm the pending indicator appears at the top of the project list (not the bottom).
  • After creation finishes, the pending row is replaced in-place by the real workspace (no visual jump from bottom to top).
  • Trigger a failed creation; the failed pending row stays at the top until dismissed.
  • Projects with sections still render pending above any sections as an ungrouped top-level row.

Summary by cubic

Fixes sidebar ordering so pending workspace rows (“creating/failed”) render at the top, matching where the new workspace is inserted and preventing a bottom-to-top jump. Changes PENDING_WORKSPACE_TAB_ORDER from Number.MAX_SAFE_INTEGER to Number.MIN_SAFE_INTEGER and clarifies the inline comment.

Written for commit db66c92. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the ordering of pending workspaces in the dashboard sidebar. Pending workspaces now appear at the top of the workspace list instead of at the bottom.

New workspaces are inserted with a prepend tabOrder (top), but the pending placeholder was pinned to MAX_SAFE_INTEGER (bottom), so the creating/failed indicator visually separated from the row it represents. Flip the constant to MIN_SAFE_INTEGER so the pending sits alongside the just-created workspace at the top.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4452ffaf-d6da-4326-98eb-175d07d5ade6

📥 Commits

Reviewing files that changed from the base of the PR and between b21a3b9 and db66c92.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useDashboardSidebarData/useDashboardSidebarData.ts

📝 Walkthrough

Walkthrough

The dashboard sidebar now displays pending workspaces at the top of the list instead of at the bottom by changing the tab order sentinel value from Number.MAX_SAFE_INTEGER to Number.MIN_SAFE_INTEGER in the ordering logic.

Changes

Cohort / File(s) Summary
Dashboard Sidebar Ordering
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useDashboardSidebarData/useDashboardSidebarData.ts
Changed pending workspace tab order sentinel from Number.MAX_SAFE_INTEGER to Number.MIN_SAFE_INTEGER to render pending workspaces above real entries rather than after them, with updated explanatory comment.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐰✨ A hop and a shift, a reorder so spry,
Pending workspaces now reach for the sky!
From bottom to top, they leap with delight,
MIN beats MAX—now the order is right! 🚀

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch when-creating-a-new-workspace-we-have-the-pending-at-the-bottom-of-the-sidebar-and-the-new-workspace

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 22, 2026

Greptile Summary

This PR fixes a visual ordering bug where pending workspace placeholders (status: "creating" or "failed") were being displayed at the bottom of the sidebar's workspace list, while the real workspace—once creation succeeded—would appear at the top. The fix is a one-line change: flipping PENDING_WORKSPACE_TAB_ORDER from Number.MAX_SAFE_INTEGER to Number.MIN_SAFE_INTEGER.

Confidence Score: 5/5

Safe to merge — minimal, targeted fix with no regressions to existing logic.

The change is a single constant swap that correctly aligns the pending workspace's sort position with the eventual insertion point of the real workspace. The surrounding sort and section-reparenting logic handles Number.MIN_SAFE_INTEGER safely. No unrelated code is touched.

No files require special attention.

Important Files Changed

Filename Overview
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useDashboardSidebarData/useDashboardSidebarData.ts Single-line constant change from Number.MAX_SAFE_INTEGER to Number.MIN_SAFE_INTEGER; logic is correct and the updated comment accurately describes the intent.

Reviews (1): Last reviewed commit: "fix(desktop): render pending workspaces ..." | Re-trigger Greptile

@Kitenite Kitenite merged commit 1771c72 into main Apr 22, 2026
6 of 7 checks passed
@Kitenite Kitenite deleted the when-creating-a-new-workspace-we-have-the-pending-at-the-bottom-of-the-sidebar-and-the-new-workspace branch April 22, 2026 20:55
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant