feat(desktop): add "All devices" option to the Workspaces device filter

Merged
KI
3mo ago
+48-18

Summary

  • Add an All devices option to the device filter on the v2 Workspaces page. Until now the filter could only show one host at a time — this device (the default) or a single remote host.

Why / Context

With workspaces spread across several hosts (laptop, dev boxes, sandboxes), there was no way to see everything in one view; you had to flip through hosts one by one.

How It Works

  • New DEVICE_FILTER_ALL_DEVICES = "all-devices" sentinel in v2WorkspacesFilterStore, next to the existing this-device one. Default and reset() still point at This device, and the choice round-trips through the URL as ?device=all-devices like any other selection.
  • When selected, useAccessibleV2Workspaces passes undefined to useHostWorkspacesSource — that source's existing fan-out mode, which queries every known host and shares query keys with the always-running HostWorkspacesProvider, so nothing fetches twice. Offline hosts contribute their last-seen cached rows, same as the sidebar.
  • PR chips, live agent statuses, and the board's archived tombstones keep working across hosts: derivePullRequestQueryTargets already groups workspaces per host and skips offline hosts, and the archived queries iterate the same targets.
  • Header select gets the new option first (monitor-and-phone icon), and DeviceFilterTriggerLabel renders it instead of falling through to "Unknown device".

Manual QA Checklist

Verified end-to-end over CDP against the dev app built from this branch (real clicks, signed-in session, screenshots captured at each step):

  • Filter defaults to This device; dropdown shows All devices first, This device checked, remote hosts under "Other devices" with online dots
  • Selecting All devices updates the trigger label and syncs the URL to ?device=all-devices
  • List renders local rows immediately; remote hosts were offline with no cached snapshots in the dev profile, so no extra rows — expected offline-first behavior
  • "No results" empty-state logic treats All devices as an active filter (it's broader than the default)

Testing

  • bun run typecheck (apps/desktop)
  • biome check on the touched directory

Design Decisions

  • Route All devices through the scoped source's fan-out mode instead of the provider's shared result: the provider path (used by the palette) deliberately skips PR/agent-status queries and can't fetch archived tombstones; the scoped source in fan-out mode gets all three while still deduping fetches via shared query keys.

Summary by cubic

Adds an “All devices” option to the Workspaces device filter so users can view workspaces across all hosts. Previously the filter showed only one host; now “All devices” fans out across known hosts without duplicate fetching and preserves PR, agent status, and archived data.

  • Introduces DEVICE_FILTER_ALL_DEVICES in the v2 Workspaces filter store; selection round-trips as ?device=all-devices. Default and reset remain “This device.”
  • When selected, useAccessibleV2Workspaces passes undefined to useHostWorkspacesSource to invoke the existing fan-out, sharing query keys with HostWorkspacesProvider (no double fetch; offline hosts contribute cached rows).
  • PR chips, live agent statuses, and archived tombstones resolve per host via derivePullRequestQueryTargets; unscoped callers (palette/dev seeding) are unchanged.
  • UI: the header select shows “All devices” first with a monitor-and-phone icon; the trigger label renders “All devices” instead of falling back to “Unknown device.”

Summary by CodeRabbit

  • New Features
    • Added an “All devices” filter to the Workspaces dashboard.
    • View workspace items across all connected devices in a single view.
    • Added clear device-specific icons and labels for the new filter option.
    • Improved pull request target visibility when viewing workspaces across devices.