feat(desktop): label main workspace as "local · <branch>" in dashboard sidebar#4527
feat(desktop): label main workspace as "local · <branch>" in dashboard sidebar#4527AviPeltz wants to merge 5 commits into
Conversation
Replaces the workspace name with "local" plus the current branch in smaller muted monospace text so the main workspace row is recognizable at a glance without hiding which branch it points to.
|
Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews. |
|
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 (3)
📝 WalkthroughWalkthroughFetches a live git branch for local main workspaces, computes displayedBranch/displayedWorkspace, propagates those into hover/actions/rows/delete dialogs, renders main workspace labels as host · monospace branch, and makes the Rename context-menu item optional while disabling rename/double-click for main workspaces. ChangesMain workspace branch display and context menu tweaks
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
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)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 |
Greptile SummaryThis PR updates the dashboard sidebar to render the main workspace row as
Confidence Score: 4/5Safe to merge — the change is isolated to the label rendering path for main workspaces and does not affect data flow, routing, or actions. The logic is straightforward and well-scoped: No files require special attention; the single changed file is self-contained.
|
| Filename | Overview |
|---|---|
| apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx | Adds an inline local · <branch> rendering path for main-workspace rows; logic is sound and branch is typed as a non-nullable string. Minor: the middle-dot separator is missing aria-hidden, and truncate on the outer flex container is partially redundant. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[DashboardSidebarExpandedWorkspaceRow renders label] --> B{isRenaming?}
B -- yes --> C[RenameInput]
B -- no --> D{isMainWorkspace?}
D -- yes --> E["local · branch\n(new in this PR)"]
D -- no --> F["name || branch\n(worktree path, unchanged)"]
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx:247-258
The outer `<span>` is a flex container but also carries `truncate` (`overflow: hidden; text-overflow: ellipsis; white-space: nowrap`). On a flex container `text-overflow: ellipsis` is a no-op — it only applies to the element whose own inline text overflows, not to flex children. The actual ellipsis is correctly produced by `truncate` on the inner branch `<span>`. Swapping `truncate` for `overflow-hidden` on the outer element would express intent more precisely, though the visual output is the same.
### Issue 2 of 2
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx:254
The `·` middle-dot separator is a Unicode character that screen readers may announce aloud (e.g., "local centered-dot branch-name"). Adding `aria-hidden="true"` to this `<span>` keeps the accessible label coherent for assistive technology.
Reviews (1): Last reviewed commit: "feat(desktop): label main workspace as "..." | Re-trigger Greptile
| <span | ||
| className={cn( | ||
| "flex min-w-0 items-baseline gap-1.5 truncate text-[13px] leading-tight transition-colors", | ||
| isActive ? "text-foreground" : "text-foreground/80", | ||
| )} | ||
| > | ||
| <span className="shrink-0">local</span> | ||
| <span className="text-muted-foreground/60">·</span> | ||
| <span className="truncate font-mono text-[11px] text-muted-foreground/60"> | ||
| {branch} | ||
| </span> | ||
| </span> |
There was a problem hiding this comment.
The outer
<span> is a flex container but also carries truncate (overflow: hidden; text-overflow: ellipsis; white-space: nowrap). On a flex container text-overflow: ellipsis is a no-op — it only applies to the element whose own inline text overflows, not to flex children. The actual ellipsis is correctly produced by truncate on the inner branch <span>. Swapping truncate for overflow-hidden on the outer element would express intent more precisely, though the visual output is the same.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx
Line: 247-258
Comment:
The outer `<span>` is a flex container but also carries `truncate` (`overflow: hidden; text-overflow: ellipsis; white-space: nowrap`). On a flex container `text-overflow: ellipsis` is a no-op — it only applies to the element whose own inline text overflows, not to flex children. The actual ellipsis is correctly produced by `truncate` on the inner branch `<span>`. Swapping `truncate` for `overflow-hidden` on the outer element would express intent more precisely, though the visual output is the same.
How can I resolve this? If you propose a fix, please make it concise.| )} | ||
| > | ||
| <span className="shrink-0">local</span> | ||
| <span className="text-muted-foreground/60">·</span> |
There was a problem hiding this comment.
The
· middle-dot separator is a Unicode character that screen readers may announce aloud (e.g., "local centered-dot branch-name"). Adding aria-hidden="true" to this <span> keeps the accessible label coherent for assistive technology.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx
Line: 254
Comment:
The `·` middle-dot separator is a Unicode character that screen readers may announce aloud (e.g., "local centered-dot branch-name"). Adding `aria-hidden="true"` to this `<span>` keeps the accessible label coherent for assistive technology.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
No issues found across 1 file
You’re at about 99% of the monthly review limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Polls the host service's workspace.gitStatus for local-device main workspaces so the sidebar label reflects whichever branch is actually checked out, not the branch the workspace was created on.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx`:
- Around line 119-131: The query key for the live-branch react-query is
currently only scoped by workspace.id which allows branch data to bleed across
different hosts; update the queryKey used in the useQuery (the queryKey array)
to include activeHostUrl (e.g., ["dashboardSidebarLiveBranch", activeHostUrl,
workspace.id]) so cache entries are host-specific, leaving the queryFn, enabled,
and other options unchanged.
- Around line 267-279: The code in DashboardSidebarExpandedWorkspaceRow
currently hardcodes the prefix "local" when isMainWorkspace is true; change this
so the prefix is derived from the workspace's hostType (or only render this
layout when isLocalMainWorkspace is true). Locate the block that renders the
"local" span inside the isMainWorkspace branch and replace the fixed string with
a conditional that uses hostType (or checks isLocalMainWorkspace) to produce the
correct label for remote/cloud main workspaces, keeping displayedBranch and the
existing styling/structure intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: cb934e6e-13af-42cc-89a6-05debd9d5c32
📒 Files selected for processing (1)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx
| queryKey: ["dashboardSidebarLiveBranch", workspace.id], | ||
| queryFn: async () => { | ||
| if (!activeHostUrl) return null; | ||
| const status = await getHostServiceClientByUrl( | ||
| activeHostUrl, | ||
| ).workspace.gitStatus.query({ id: workspace.id }); | ||
| return status?.branch ?? null; | ||
| }, | ||
| enabled: isLocalMainWorkspace && !!activeHostUrl && !creationStatus, | ||
| refetchInterval: 10_000, | ||
| refetchOnWindowFocus: true, | ||
| staleTime: 5_000, | ||
| }); |
There was a problem hiding this comment.
Scope the live-branch query key by host URL.
Line 119 keys only by workspace.id; if the active host changes, cached branch data can be reused across hosts before the next refetch. Include activeHostUrl in the key so cache entries are host-specific.
Suggested diff
- const { data: liveBranch } = useQuery({
- queryKey: ["dashboardSidebarLiveBranch", workspace.id],
+ const { data: liveBranch } = useQuery({
+ queryKey: ["dashboardSidebarLiveBranch", activeHostUrl, workspace.id],📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| queryKey: ["dashboardSidebarLiveBranch", workspace.id], | |
| queryFn: async () => { | |
| if (!activeHostUrl) return null; | |
| const status = await getHostServiceClientByUrl( | |
| activeHostUrl, | |
| ).workspace.gitStatus.query({ id: workspace.id }); | |
| return status?.branch ?? null; | |
| }, | |
| enabled: isLocalMainWorkspace && !!activeHostUrl && !creationStatus, | |
| refetchInterval: 10_000, | |
| refetchOnWindowFocus: true, | |
| staleTime: 5_000, | |
| }); | |
| queryKey: ["dashboardSidebarLiveBranch", activeHostUrl, workspace.id], | |
| queryFn: async () => { | |
| if (!activeHostUrl) return null; | |
| const status = await getHostServiceClientByUrl( | |
| activeHostUrl, | |
| ).workspace.gitStatus.query({ id: workspace.id }); | |
| return status?.branch ?? null; | |
| }, | |
| enabled: isLocalMainWorkspace && !!activeHostUrl && !creationStatus, | |
| refetchInterval: 10_000, | |
| refetchOnWindowFocus: true, | |
| staleTime: 5_000, | |
| }); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx`
around lines 119 - 131, The query key for the live-branch react-query is
currently only scoped by workspace.id which allows branch data to bleed across
different hosts; update the queryKey used in the useQuery (the queryKey array)
to include activeHostUrl (e.g., ["dashboardSidebarLiveBranch", activeHostUrl,
workspace.id]) so cache entries are host-specific, leaving the queryFn, enabled,
and other options unchanged.
Picks the prefix from the workspace's hostType so remote-device main workspaces show "remote" and cloud-hosted ones show "cloud" instead of always being labeled "local".
Lifts the live-branch query from the row component to the workspace item so it runs once per row (not once per render variant), adds a cheap workspace.currentBranch host-service procedure that just runs `git rev-parse --abbrev-ref HEAD` instead of a full status scan, and includes activeHostUrl in the query key so cache entries are scoped per host. Refetch cadence drops from 10s to 30s with a 15s stale window; window-focus refetch still keeps it snappy when the user comes back.
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
Summary
local · <branch>instead of its raw name, matching the existingWorkspaceListItemconvention from the main-screen sidebarTest plan
local · <branch>instead of the workspace nameSummary by cubic
Show the main workspace in the dashboard sidebar as
<host> · <branch>to match the main-screen sidebar and improve scanability. The branch live‑updates for local main workspaces; styling stays small muted monospace, the row remains single-line with truncation, and worktree workspaces keep their labels.Refactors
workspace.currentBranch(usesgit rev-parse --abbrev-ref HEAD) with a 30s refetch, 15s stale time, and cache scoped byactiveHostUrl.Bug Fixes
Written for commit ed1788b. Summary will update on new commits.
Summary by CodeRabbit