diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/StoredCloudChat/StoredCloudChat.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/StoredCloudChat/StoredCloudChat.tsx index fe94808db9b..35cb6694a46 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/StoredCloudChat/StoredCloudChat.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/StoredCloudChat/StoredCloudChat.tsx @@ -1,9 +1,14 @@ import { useLingui } from "@lingui/react/macro"; +import type { AppRouter } from "@superset/host-service/trpc"; +import { workspaceTrpc } from "@superset/workspace-client"; import { keepPreviousData, + QueryClient, useQuery, useQueryClient, } from "@tanstack/react-query"; +import { TRPCClientError } from "@trpc/client"; +import { observable } from "@trpc/server/observable"; import { type ReactNode, useEffect } from "react"; import { cloudTrpc } from "renderer/lib/cloud-trpc"; import { electronQueryClient } from "renderer/providers/ElectronTRPCProvider"; @@ -23,6 +28,21 @@ const PREFETCHED_CHATS = 5; const STALE_MS = 60_000; const NO_PROMPTS: never[] = []; +/** Transcript rows call workspace hooks, which need a client even with no box to reach. */ +const noHostClient = workspaceTrpc.createClient({ + links: [ + () => () => + observable((observer) => + observer.error( + new TRPCClientError("The workspace has no host yet"), + ), + ), + ], +}); +const noHostQueryClient = new QueryClient({ + defaultOptions: { queries: { retry: false } }, +}); + /** * A cloud workspace's newest chat as the database holds it, while the * workspace waits for its box to answer, else `fallback`. It is cached under @@ -86,11 +106,16 @@ export function StoredCloudChat({ }) } /> - + + +
);