fix(desktop): open in IDE broken in v2 workspaces — isolate workspaceTrpc React context
Summary
Fixes SUPER-1599: "Open in IDE" failing with No procedure found on path "external.openInApp" since the latest release.
Root cause: every createTRPCReact() client shares @trpc/react-query's default React context, so workspaceTrpc.Provider (mounted by the v2 WorkspaceProvider) shadowed the electron IPC provider for any electronTrpc hook rendered under it — the hook silently resolved the host-service HTTP client, which has no external router. #5824 exposed this by moving the open-in button, window controls, and a getPlatform query into the v2 workspace subtree. The same mechanism also left platform undefined in the v2 page (hiding window controls on Windows/Linux).
Fix (structural, not per-callsite):
- Give
workspaceTrpcits own React context viacreateTRPCReact({ context }), so the two providers can never collide. AllelectronTrpchooks now work anywhere in the tree; #5824's moved components need no changes. useV2FileSearchwas the one bareworkspaceTrpchook outside anyWorkspaceClientProvider(v1 CommandPalette mounts) — it previously coasted on the shared context and would throw under the isolated one. Converted to a plainuseQueryover the provider's imperative client via a newuseMaybeWorkspaceClient(), which returns null outside the provider.- Removed the now-stale shared-context caveat comment in the v2 layout.
Audited all other workspaceTrpc hook call sites: everything else renders under a WorkspaceClientProvider (v2 workspace tree, or self-wrapping dialogs/settings sections).
Test Plan
-
bun run lintexits 0 - Full monorepo
bun run typecheckpasses (35/35) - v2 workspace: sidebar "Open in " button opens the worktree; copy path works
- v1 workspace: CMD+P file search still works (CommandPalette mounts without a WorkspaceClientProvider)
- Windows/Linux v2 workspace: window min/max/close controls render and work
https://claude.ai/code/session_018igf49z4TsXxgbdKH6t3Nf
Summary by cubic
Fixes SUPER-1599: “Open in IDE” in v2 workspaces by isolating the workspaceTrpc React context so electronTrpc hooks resolve correctly. Keeps v1 CommandPalette file search working without a WorkspaceClientProvider and restores window controls on Windows/Linux.
- Bug Fixes
- Gave
workspaceTrpcits own React context viacreateTRPCReact({ context }), preventing collisions withelectronTrpc; fixes “No procedure found on path 'external.openInApp'” and restores platform detection in v2. - Converted
useV2FileSearchto a plainuseQueryover the provider’s imperative client; addeduseMaybeWorkspaceClient()to safely run outside aWorkspaceClientProvider. - Removed mock-heavy
packages/trpcrouter tests and dropped the packagetestscript to stop CI failures when@superset/db/clientloads without a rootDATABASE_URL.
- Gave
Summary by CodeRabbit
- Bug Fixes
- Improved workspace command palette file search reliability and timing.
- Search now only runs when a workspace is available and the search term is non-empty.
- Preserved existing results/loading behavior, including empty-state placeholders.
- Refactor
- Improved workspace client handling in UI screens that may run outside a workspace context.
- Adjusted workspace search to use the workspace client directly to avoid query routing conflicts.
- Tests / Chores
- Added test runner setup and default CI database environment variables.