Skip to content

fix(desktop): restore recently-viewed dropdown + tighten topbar chrome#4370

Merged
saddlepaddle merged 2 commits into
mainfrom
fix-recently-viewed
May 10, 2026
Merged

fix(desktop): restore recently-viewed dropdown + tighten topbar chrome#4370
saddlepaddle merged 2 commits into
mainfrom
fix-recently-viewed

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented May 10, 2026

Summary

  • Recently-viewed was rendering as a permanently-disabled icon in v2 because the path matcher only knew /workspace/$id (v1) and the slug capture greedily ate search params and nested subroutes — so /v2-workspace/$id never matched and /tasks/SUP-123?tab=… never resolved to a slug. Now matches /v2-workspace/$id and /automations/$id, strips ?…/#…, anchors to the first path segment, and dedupes by the canonical path.
  • Filter cross-version workspace entries so clicking a v1 entry from v2 mode (or vice versa) doesn't drop the user on CrossVersionMismatchState ("Pick a workspace").
  • Re-show the dropdown trigger in both topbar and v2 sidebar header ([codex] Restore v2 resource monitor #4314 hardcoded showHistoryDropdown={false} because the regex was broken and it was always rendering as the disabled icon — fixing the underlying matcher means we can drop the prop).
  • Resource monitor trigger collapsed to an icon-only ghost button and floated to the far right of its row in both surfaces (right-side cluster in the topbar, ml-auto + pr-2 in the v2 sidebar header).

Test plan

  • In v2 mode, visit a v2 workspace, a task, and an automation — open the clock dropdown and confirm all three appear with the correct project/agent labels.
  • Visit /tasks/SUP-XYZ?tab=… and /tasks/SUP-XYZ/issue/123 — confirm the dropdown collapses both into a single /tasks/SUP-XYZ entry.
  • In v1 mode (toggle off v2 cloud), confirm v2-workspace entries are hidden; v1 entries still work.
  • In v2 mode, confirm v1 workspace entries are hidden (no cross-version mismatch screen on click).
  • Confirm resource monitor icon sits on the far right in both the topbar (sidebar closed/collapsed) and the v2 sidebar header (sidebar open).

Summary by cubic

Restores the Recently Viewed dropdown in v2 by fixing route matching and adding support for v2 workspaces and automations. Also tightens topbar chrome by making the resource monitor an icon-only button aligned to the right.

  • Bug Fixes

    • Parse paths correctly: strip query/hash, anchor to first segment, and dedupe by canonical path (e.g., collapse /tasks/KEY?tab=x to /tasks/KEY).
    • Add v2-workspace and automation resource types with correct labels/icons; include v2 project/branch and automation agent metadata.
    • Respect the v2 Cloud toggle: hide v2 entries (including automations) when v1 is active and hide v1 entries in v2 to avoid the mismatch screen.
    • Re-enable the History dropdown in both the topbar and v2 sidebar header; remove the showHistoryDropdown prop.
  • UI Improvements

    • Resource monitor is now an icon-only ghost button with a status dot and clearer tooltip; floated to the far right in the topbar and v2 sidebar header.

Written for commit 301bd5a. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • History dropdown now includes V2 workspaces and automations in recently viewed items.
    • History dropdown is shown by default in navigation controls.
  • Style

    • Resource consumption button restyled to use the shared button and accepts positioning classes.
    • Simplified resource tooltip content and adjusted header/sidebar control layout.

Review Change Stack

…r chrome

Recently-viewed dropdown was permanently disabled in v2: the path matcher
only knew about /workspace/$id (v1) and the slug capture greedily consumed
search params and nested subroutes, so /tasks/SUP-123?tab=… and
/v2-workspace/$id never resolved to a known entity. Add a v2-workspace
resource type, an automation resource type, strip search/hash before
matching, anchor to the first path segment, and dedupe by canonical path.
Filter cross-version workspace entries so clicking a v1 entry while in v2
mode no longer drops you on the cross-version mismatch screen. Re-show
the dropdown trigger in both topbar and v2 sidebar header (was hardcoded
to false in #4314 because it was always rendering as the disabled icon).

Also: collapse the resource monitor trigger to an icon-only ghost button
and float it to the far right of its row in both surfaces.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 73332510-c620-49dd-8036-9c2ba04ab8c2

📥 Commits

Reviewing files that changed from the base of the PR and between aa06b11 and 301bd5a.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx

📝 Walkthrough

Walkthrough

Adds v2-workspace and automation to recently-viewed parsing and dropdown; HistoryDropdown is always rendered. ResourceConsumption gains optional className and uses shared Button. DashboardSidebarHeader and TopBar layouts adjusted to reflect the new component positioning.

Changes

History Dropdown Expansion and Navigation Refactoring

Layer / File(s) Summary
Data Contracts
apps/desktop/.../useRecentlyViewed/useRecentlyViewed.ts
RecentlyViewedEntry type union extended from "workspace" | "task" to "workspace" | "v2-workspace" | "task" | "automation".
History Path Parsing
apps/desktop/.../useRecentlyViewed/useRecentlyViewed.ts
New pathnameOf() helper strips query/hash fragments. parseResourceEntry() rewritten to recognize /v2-workspace/:id, /workspace/:id, /tasks/:id, /automations/:id, extract entityId, and normalize paths. persistentHistory iteration deduplicates by normalized path and filters falsy entries.
History Dropdown UI and Data
apps/desktop/.../HistoryDropdown/HistoryDropdown.tsx
New V2WorkspaceRow and AutomationRow components render V2 workspace (with branch icon) and automation (with preset/CPU icon) entries. useLiveQuery fetches V2 workspace data (joined with projects) and automation data. Cloud-enabled flag gates v2-workspace vs legacy workspace filtering. Row rendering uses type-based dispatch with new row components.
Navigation Controls Refactoring
apps/desktop/.../NavigationControls/NavigationControls.tsx
Component signature simplified to accept no props; showHistoryDropdown prop and NavigationControlsProps interface removed. HistoryDropdown rendered unconditionally instead of conditionally gated.
Resource Consumption Styling
apps/desktop/.../ResourceConsumption/ResourceConsumption.tsx
ResourceConsumptionProps gains optional className?: string. Popover trigger changed from native <button> to shared Button component (ghost, icon-xs). Tooltip simplified to show "Resources · " or "Resources" based on metric availability.
Header and TopBar Layout
apps/desktop/.../DashboardSidebarHeader/DashboardSidebarHeader.tsx, apps/desktop/.../TopBar/TopBar.tsx
DashboardSidebarHeader expanded row adds pr-2 padding and applies ml-auto to ResourceConsumption. TopBar removes showHistoryDropdown={false} from NavigationControls and relocates ResourceConsumption from header block to right-side control group, preserving cloud-enabled surface behavior.

🐰 With V2 workspaces and automations in view,
The history dropdown now shows what is true—
No more prop gates, just always there, neat,
ResourceConsumption finds its own seat,
The UI layout bounces anew!

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two main changes: restoring the recently-viewed dropdown and tightening the topbar chrome with resource monitor improvements.
Description check ✅ Passed The description comprehensively covers the problem, solution, and includes a detailed test plan with multiple verification steps across v1/v2 modes and entry types.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 fix-recently-viewed

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 May 10, 2026

Greptile Summary

This PR restores the recently-viewed history dropdown in both v1 and v2 modes by fixing path matching (adding /v2-workspace/, /automations/, stripping query/hash, deduplicating by canonical path) and cross-version filtering (hiding v1 workspace entries in v2 mode and vice versa). It also re-enables the HistoryDropdown in the v2 sidebar header and collapses the resource monitor to an icon-only ghost button floated to the far right of its row.

  • useRecentlyViewed: new pathnameOf helper strips ?/# before matching; all four route types (workspace, v2-workspace, task, automation) now produce a stable canonical path used for deduplication.
  • HistoryDropdown: new V2WorkspaceRow and AutomationRow render components backed by live queries; isV2CloudEnabled guards prevent v1 entries appearing in v2 mode and vice versa for workspace types, but automation entries lack this guard.
  • ResourceConsumption: trigger refactored to a ghost icon Button, accepts className for placement flexibility; tooltip now always visible.

Confidence Score: 3/5

Safe to merge for layout fixes; the history logic has one missing guard that can send v1-mode users to broken automation routes.

The automation filter in HistoryDropdown lacks the isV2CloudEnabled check that workspace types use. A user who has visited automation pages in v2, then switches to v1, could see those entries in the dropdown and navigate to /automations/... — a route that only exists in v2 — likely landing on an error state. The rest of the changes look correct.

HistoryDropdown.tsx — the automation entry filter at line 298 needs an isV2CloudEnabled guard consistent with the workspace type guards above it.

Important Files Changed

Filename Overview
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx Adds V2WorkspaceRow, AutomationRow components and live-query data for v2 workspaces and automations; automation filter is missing the isV2CloudEnabled guard that workspace types have, risking broken navigation in v1 mode.
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/hooks/useRecentlyViewed/useRecentlyViewed.ts Adds v2-workspace, task, and automation path patterns with proper query/hash stripping and canonical-path deduplication; logic is clean and correctly ordered (newest-first).
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/NavigationControls.tsx Removes the now-unnecessary showHistoryDropdown prop and always renders HistoryDropdown; straightforward cleanup.
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/TopBar.tsx Moves ResourceConsumption to the right-side cluster behind the !sidebarHostsChrome guard; placement logic is consistent with sidebarHostsChrome semantics.
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/ResourceConsumption/ResourceConsumption.tsx Collapses trigger to icon-only ghost Button with absolute dot positioning; tooltip simplified to always-visible with inline memory reading.
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarHeader/DashboardSidebarHeader.tsx Re-enables NavigationControls, adds ml-auto to ResourceConsumption and pr-2 to the drag row; minimal layout changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[persistentHistory.getEntries] --> B[pathnameOf: strip ?/#]
    B --> C{match route prefix}
    C -->|/v2-workspace/:id| D[type: v2-workspace]
    C -->|/workspace/:id| E[type: workspace]
    C -->|/tasks/:id| F[type: task]
    C -->|/automations/:id| G[type: automation]
    C -->|no match| H[null - skip]
    D & E & F & G --> I[dedup by canonical path]
    I --> J[useRecentlyViewed returns entries]
    J --> K{filteredEntries}
    K -->|workspace| L{isV2CloudEnabled?}
    L -->|yes| M[hide]
    L -->|no| N[show if in workspaceData]
    K -->|v2-workspace| O{isV2CloudEnabled?}
    O -->|no| P[hide]
    O -->|yes| Q[show if in v2WorkspaceData]
    K -->|automation| R[show if in automationData - no v2 guard]
    K -->|task| S[show if in taskData]
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx:298-300
**Automation entries not guarded by `isV2CloudEnabled`**

v1-mode and v2-mode workspace entries both have explicit `isV2CloudEnabled` guards that prevent cross-version navigation, but `automation` entries have no such guard. If a user has automation visit history from a prior v2 session and then switches to v1 mode, any matching automation record still present in the live DB will pass the `automationData.some(...)` filter and appear in the dropdown. Clicking one navigates to `/automations/${id}`, a route that presumably does not exist in v1 mode, likely landing the user on an error or blank screen.

Reviews (1): Last reviewed commit: "fix(desktop): restore recently-viewed dr..." | Re-trigger Greptile

Comment on lines +298 to +300
if (entry.type === "automation") {
return (automationData ?? []).some((a) => a.id === entry.entityId);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Automation entries not guarded by isV2CloudEnabled

v1-mode and v2-mode workspace entries both have explicit isV2CloudEnabled guards that prevent cross-version navigation, but automation entries have no such guard. If a user has automation visit history from a prior v2 session and then switches to v1 mode, any matching automation record still present in the live DB will pass the automationData.some(...) filter and appear in the dropdown. Clicking one navigates to /automations/${id}, a route that presumably does not exist in v1 mode, likely landing the user on an error or blank screen.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx
Line: 298-300

Comment:
**Automation entries not guarded by `isV2CloudEnabled`**

v1-mode and v2-mode workspace entries both have explicit `isV2CloudEnabled` guards that prevent cross-version navigation, but `automation` entries have no such guard. If a user has automation visit history from a prior v2 session and then switches to v1 mode, any matching automation record still present in the live DB will pass the `automationData.some(...)` filter and appear in the dropdown. Clicking one navigates to `/automations/${id}`, a route that presumably does not exist in v1 mode, likely landing the user on an error or blank screen.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx`:
- Around line 298-300: The current branch in HistoryDropdown that returns
automation entries (when entry.type === "automation") should also ensure the app
is in V2 mode; change the condition to only allow automation history when a
V2-mode boolean (e.g., isV2Mode or isV2) is true and the automation still exists
(replace the existing early return with a check like: entry.type ===
"automation" && isV2Mode && (automationData ?? []).some(a => a.id ===
entry.entityId)); locate this logic in the HistoryDropdown component where
entry.type and automationData are used and gate it on the V2-mode flag available
on the component (prop, state, or context).
🪄 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: 90add3d8-2741-4dc4-9322-deb7178ff7f5

📥 Commits

Reviewing files that changed from the base of the PR and between c2c7eb1 and aa06b11.

📒 Files selected for processing (6)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarHeader/DashboardSidebarHeader.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/NavigationControls.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/hooks/useRecentlyViewed/useRecentlyViewed.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/TopBar.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/ResourceConsumption/ResourceConsumption.tsx

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

@saddlepaddle saddlepaddle merged commit 19b60b7 into main May 10, 2026
10 checks passed
@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