From 49de78a20ba8b8b5f381e5c0ae8f6aa30f04fffd Mon Sep 17 00:00:00 2001 From: yyh Date: Wed, 4 Feb 2026 18:14:02 +0800 Subject: [PATCH] fix: use oRPC query keys for sandbox file download and invalidation Replaced plain array query key in useSandboxFileDownloadUrl with oRPC-generated queryKey for type safety and consistency. Added downloadFile cache invalidation to useInvalidateSandboxFiles so stale download URLs are cleared after workflow/chatflow runs. --- web/service/use-sandbox-file.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/service/use-sandbox-file.ts b/web/service/use-sandbox-file.ts index 030205860d..fa494de1f4 100644 --- a/web/service/use-sandbox-file.ts +++ b/web/service/use-sandbox-file.ts @@ -41,7 +41,9 @@ export function useSandboxFileDownloadUrl( path: string | undefined, ) { return useQuery({ - queryKey: ['sandboxFileDownloadUrl', appId, path], + queryKey: consoleQuery.sandboxFile.downloadFile.queryKey({ + input: { params: { appId: appId! }, body: { path: path! } }, + }), queryFn: () => consoleClient.sandboxFile.downloadFile({ params: { appId: appId! }, body: { path: path! }, @@ -56,6 +58,9 @@ export function useInvalidateSandboxFiles() { queryClient.invalidateQueries({ queryKey: consoleQuery.sandboxFile.listFiles.key(), }) + queryClient.invalidateQueries({ + queryKey: consoleQuery.sandboxFile.downloadFile.key(), + }) }, [queryClient]) }