fix(desktop): wire up Quick Create Workspace (Cmd+Shift+N) in v2

Merged
AV
3mo ago
+154-3

Summary

  • QUICK_CREATE_WORKSPACE (⌘⇧N) has been in the hotkey registry with no bound handler since CreateWorkspaceButton — the component that used to own it — was deleted in #586 (Workbench/Review mode rewrite), before v2 existed. Confirmed via git log -S that no handler has referenced it since.
  • Wires it into apps/desktop/src/renderer/routes/_authenticated/_dashboard/layout.tsx, gated to v2 (isV2CloudEnabled). On trigger it skips the new-workspace modal and creates directly via useWorkspaceCreates().submit(...) against the local host, in the current project.
  • "Current project" fallback chain: current v2 workspace route (currentV2Workspace.projectId) → last-used project (useV2WorkspaceCreateDefaultsStore) → first known project (useHostProjects). If none resolve (or no local host), falls back to opening the new-workspace modal so the user can add/pick a project — mirroring v1's old handleQuickCreate → handleOpenNewProject fallback.

Context

Reported in #6041 ("Quick Create Workspace is not working in v2"). Investigation showed this was never actually v1-vs-v2 behavior — the one-shot quick-create flow has been dead code in both versions since #586; it just happened to be noticed now by a v2 user. The issue's second complaint (new-workspace modal preselecting the wrong project) is a separate, still-open gap and not addressed by this PR.

Test plan

  • bun run typecheck passes for apps/desktop
  • bunx biome check passes on the changed file
  • Manually verify in the running desktop app: with v2 enabled, open a v2 workspace, hit ⌘⇧N elsewhere in a different project's view, confirm a new workspace is created in the expected project without the modal appearing
  • Verify the modal-fallback path when no project can be inferred (fresh profile, no projects added yet)

https://claude.ai/code/session_01NDYjeZY5haNbjmg5gv94Xu


Summary by cubic

Connects the Quick Create Workspace hotkey (Cmd+Shift+N) in v2 and adds a command palette entry so users can create a workspace immediately in the inferred project. Previously the hotkey did nothing; now it creates instantly when v2 is enabled and falls back to the modal if no project or local host can be inferred.

  • Hotkey: handled in the v2 dashboard layout; creates via useWorkspaceCreates().submit on the local host (machineId), navigates to /v2-workspace/$workspaceId, and shows progress/success/error toasts via @superset/ui/sonner.
  • Command palette: new “Quick create workspace” command (shows ⌘⇧N), available from any v2 dashboard view; gated by isV2CloudEnabled; triggers via a quick-create-workspace-intent store and a globally mounted QuickCreateWorkspaceMount that performs the create.
  • Project inference order: current v2 workspace route → last-used from useV2WorkspaceCreateDefaultsStore → first from useHostProjects; otherwise opens the new-workspace modal.
  • Extracts shared logic into useQuickCreateWorkspace(). No change to v1 behavior; no migrations or config changes.

Summary by CodeRabbit

  • New Features
    • Added a keyboard shortcut and command palette action for quickly creating a workspace.
    • Automatically selects an available project and opens the newly created workspace.
    • Provides a new-workspace prompt when no suitable project or machine is available.
    • Displays notifications for workspace creation status.
    • Quick workspace creation is available for supported cloud workspaces.