File tree Expand file tree Collapse file tree 1 file changed +1
-16
lines changed
Expand file tree Collapse file tree 1 file changed +1
-16
lines changed Original file line number Diff line number Diff line change 33 type QueryClient ,
44 useInfiniteQuery ,
55 useQuery ,
6- useQueryClient ,
76} from '@tanstack/react-query'
87import { getEndDateFromTimeRange , getStartDateFromTimeRange } from '@/lib/logs/filters'
98import { parseQuery , queryToApiParams } from '@/lib/logs/query-parser'
@@ -159,27 +158,13 @@ interface UseLogDetailOptions {
159158}
160159
161160export function useLogDetail ( logId : string | undefined , options ?: UseLogDetailOptions ) {
162- const queryClient = useQueryClient ( )
163161 return useQuery ( {
164162 queryKey : logKeys . detail ( logId ) ,
165163 queryFn : ( ) => fetchLogDetail ( logId as string ) ,
166164 enabled : Boolean ( logId ) && ( options ?. enabled ?? true ) ,
167165 refetchInterval : options ?. refetchInterval ?? false ,
168166 staleTime : 30 * 1000 ,
169- initialData : ( ) => {
170- if ( ! logId ) return undefined
171- const listQueries = queryClient . getQueriesData < {
172- pages : { logs : WorkflowLog [ ] } [ ]
173- } > ( {
174- queryKey : logKeys . lists ( ) ,
175- } )
176- for ( const [ , data ] of listQueries ) {
177- const match = data ?. pages ?. flatMap ( ( p ) => p . logs ) . find ( ( l ) => l . id === logId )
178- if ( match ) return match
179- }
180- return undefined
181- } ,
182- initialDataUpdatedAt : 0 ,
167+ placeholderData : keepPreviousData ,
183168 } )
184169}
185170
You can’t perform that action at this time.
0 commit comments