Repository navigation
fix(desktop): render GitHub links in a stored cloud chat without a workspace host - #9698
Conversation
…rkspace host The stored cloud chat shown while a box wakes has no workspace tRPC provider. GithubWorkItemHoverCard called workspaceTrpc.useQuery unconditionally, which throws without a provider even when disabled. Gate it on ChatPaneActions.workspaceId, as WebsiteHoverCard does. Refs DESKTOP-1WB
|
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! 🎉 |
Problem
When a cloud workspace's box is asleep, the workspace route shows its newest stored chat while the box wakes. If that chat has a GitHub pull request or issue link, the render throws "Unable to find tRPC Context", and the dashboard content boundary shows its error page instead of the chat. The event came from a canary build made after #9623.
Root cause
StoredCloudChatrenders the chat transcript from the$workspaceIdlayout, outsideWorkspaceProvider. This is by design (#9623): the box has no host address yet, andChatPaneActions.workspaceIdis absent to say so. #9623 gated the transcript's host reads on that signal (changes card, image attachments).WebsiteHoverCardalready returns its children whenworkspaceIdis absent.GithubWorkItemHoverCarddid not: it calledworkspaceTrpc.github.getWorkItem.useQueryon every render. That hook reads the tRPC context first and throws when there is none, even withenabled: false. It is reached from assistant markdown links (ChatLink) and from user message link chips (MessageChip→LinkHoverCard).Fix
GithubWorkItemHoverCardis now the gate: with noworkspaceIdit returns the link unchanged, the same asWebsiteHoverCard. The old body moves unchanged intoHostGithubWorkItemHoverCard, except that it no longer checksworkspaceIditself. This is theAttachmentImage→HostAttachmentImagesplit from #9623.Behaviour change: a GitHub link in a chat with no workspace host now has no hover card. Before, it opened a card that could only say "unavailable".
ChatLinkalready shows the URL as the link title in that case.The existing no-host regression test
StoredChatTranscript.test.tsxnow includes an agent message with a GitHub PR link.Verification
error: Unable to find tRPC Context. Did you forget to wrap your App inside \withTRPC` HoC?/0 pass 1 fail`. The same error as the event.bunx biome check <GithubWorkItemHoverCard dir> <StoredChatTranscript dir>:Checked 9 files in 30ms. No fixes applied.cd apps/desktop && bun run typecheck:tsc --noEmitfinished with no errors.bun test 'src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/':1158 pass, 0 fail.Refs DESKTOP-1WB
Summary by cubic
Fixes a crash in the stored cloud chat render when a GitHub pull request or issue link appears while the workspace box is waking up.
The GitHub hover card called the workspace tRPC query even without a tRPC context, throwing "Unable to find tRPC Context". Now the hover card skips itself when no workspace host exists, exactly like
WebsiteHoverCard. The card logic moved to a newHostGithubWorkItemHoverCardthat only runs when a workspace host is present.Written for commit af6cd84. Summary will update on new commits.
Summary by CodeRabbit