mirror of
https://github.com/langgenius/dify.git
synced 2026-02-09 23:20:12 -05:00
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.
This commit is contained in:
@@ -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])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user