Repository navigation
fix(desktop): give the stored cloud chat a workspace tRPC context while its box wakes - #9621
Conversation
…le its box wakes The stored-chat screen renders the chat pane's transcript before the box has an address, outside WorkspaceProvider. Image attachments, attachment parts and changed-files cards call workspaceTrpc hooks, which throw without a provider even when the query is disabled, so the dashboard content boundary showed its error page until the user navigated away. Mount a workspaceTrpc provider whose client fails every call. With no ChatPaneActions workspaceId the host queries stay disabled and the rows fall back to file cards, as they were written to. Refs DESKTOP-1V4
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
… (SUPER-3412) (#9623) A cloud workspace opens on its stored chat while its box wakes. That screen draws the chat pane's transcript before WorkspaceProvider mounts, because the sandbox has no address yet. TurnChangesCard, AttachmentImage and AttachmentPartImage called workspaceTrpc hooks, which throw outside a provider even when their query is disabled, so the view showed "Unable to find tRPC Context" instead of the chat. The transcript now reads the host only where the pane gives it one: - TurnChangesCard takes worktreePath from ChatPaneActions (SessionView supplies it) instead of querying workspace.get. - AttachmentImage and AttachmentPartImage mount their host-reading part only when ChatPaneActions has a workspaceId. Otherwise they show file cards; cloud-stored attachments still load without a host. - DraftChat's ChatPaneActionsProvider wraps the whole pane, so its warm transcript keeps host reads. This removes the provider whose client failed every call, added to StoredCloudChat in #9621. A fake provider hid the missing host instead of the transcript stating it. Adds a StoredChatTranscript test that renders a stored chat with a changes card and image attachments and no workspace tRPC provider. It fails with the original error when the fix is reverted.
Problem
When a cloud workspace's box is asleep and has no address yet, the workspace route shows the newest stored chat (
StoredCloudChat, un-flagged in #9565). If that chat shows an image attachment, the render throws a "no tRPC context" error. The dashboardContentBoundarythen shows its error page, and the page stays there after the box wakes, until the user navigates away.Root cause
layout.tsxreturnsStoredCloudChatbefore it mountsWorkspaceProvider, so noworkspaceTrpc.Providerexists above it. The chat pane's transcript callsworkspaceTrpchooks inAttachmentImage→useChatImageSource, inuseAttachmentSource(useUtils) and inTurnChangesCard. In@trpc/react-query11.16.0 these hooks read the context first and throw when it is absent, even when the query isenabled: false.The transcript already handles "no workspace": with no
ChatPaneActions.workspaceId, those queries are disabled and the rows fall back to file cards. Only the context itself was missing.Fix
StoredCloudChatwraps the transcript in aworkspaceTrpc.Providerwhose client fails every call, with its own query client. Disabled host queries never run. A host read that is attempted (an attachment part with only a host attachment id) fails and shows the file card. The provider goes inStoredCloudChat, notStoredChatTranscript, becauseAcpChatPanerendersStoredChatTranscriptunder the real workspace provider.Verification
AttachmentImagewith noworkspaceTrpc.ProviderthrowsUnable to find tRPC Context, the same error as the event. Under a provider whose link always fails, it renders the file card and the link is called 0 times. Result:2 pass, 0 fail.bunx biome check StoredCloudChat.tsx:Checked 1 file in 10ms. No fixes applied.cd apps/desktop && bun run typecheck:tsc --noEmitfinished with no errors.bun test 'src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/':1155 pass, 0 fail.Refs DESKTOP-1V4
Summary by cubic
Fixes a crash in the stored cloud chat view shown while a cloud workspace's box is waking. The transcript renders image attachments and other elements that call workspace tRPC hooks, which previously threw without a provider and sent the dashboard to its error page.
The transcript now sits inside a workspace tRPC provider whose client fails every call, and with no workspace ID the queries stay disabled, so rows fall back to file cards as designed. This addresses DESKTOP-1V4.
Written for commit 581804b. Summary will update on new commits.
Summary by CodeRabbit