@@ -16,11 +16,13 @@ export const workspaceFilesKeys = {
1616 list : ( workspaceId : string , scope : WorkspaceFileQueryScope = 'active' ) =>
1717 [ ...workspaceFilesKeys . lists ( ) , workspaceId , scope ] as const ,
1818 contents : ( ) => [ ...workspaceFilesKeys . all , 'content' ] as const ,
19+ contentFile : ( workspaceId : string , fileId : string ) =>
20+ [ ...workspaceFilesKeys . contents ( ) , workspaceId , fileId ] as const ,
1921 content : (
2022 workspaceId : string ,
2123 fileId : string ,
2224 mode : 'text' | 'raw' | 'binary' = 'text'
23- ) => [ ...workspaceFilesKeys . contents ( ) , workspaceId , fileId , mode ] as const ,
25+ ) => [ ...workspaceFilesKeys . contentFile ( workspaceId , fileId ) , mode ] as const ,
2426 storageInfo : ( ) => [ ...workspaceFilesKeys . all , 'storageInfo' ] as const ,
2527}
2628
@@ -122,8 +124,7 @@ export function useWorkspaceFileBinary(workspaceId: string, fileId: string, key:
122124 queryKey : workspaceFilesKeys . content ( workspaceId , fileId , 'binary' ) ,
123125 queryFn : ( { signal } ) => fetchWorkspaceFileBinary ( key , signal ) ,
124126 enabled : ! ! workspaceId && ! ! fileId && ! ! key ,
125- staleTime : 5 * 60 * 1000 ,
126- refetchOnWindowFocus : false ,
127+ staleTime : 30 * 1000 ,
127128 } )
128129}
129130
@@ -239,7 +240,7 @@ export function useUpdateWorkspaceFileContent() {
239240 } ,
240241 onSettled : ( _data , _error , variables ) => {
241242 queryClient . invalidateQueries ( {
242- queryKey : [ ... workspaceFilesKeys . contents ( ) , variables . workspaceId , variables . fileId ] ,
243+ queryKey : workspaceFilesKeys . contentFile ( variables . workspaceId , variables . fileId ) ,
243244 } )
244245 queryClient . invalidateQueries ( { queryKey : workspaceFilesKeys . lists ( ) } )
245246 queryClient . invalidateQueries ( { queryKey : workspaceFilesKeys . storageInfo ( ) } )
@@ -345,7 +346,7 @@ export function useDeleteWorkspaceFile() {
345346 onSettled : ( _data , _error , variables ) => {
346347 queryClient . invalidateQueries ( { queryKey : workspaceFilesKeys . lists ( ) } )
347348 queryClient . removeQueries ( {
348- queryKey : workspaceFilesKeys . content ( variables . workspaceId , variables . fileId ) ,
349+ queryKey : workspaceFilesKeys . contentFile ( variables . workspaceId , variables . fileId ) ,
349350 } )
350351 queryClient . invalidateQueries ( { queryKey : workspaceFilesKeys . storageInfo ( ) } )
351352 } ,
0 commit comments