( workspaceId: string | undefined, filters: LogFilters, options?: UseLogsListOptions )
| 159 | } |
| 160 | |
| 161 | export function useLogsList( |
| 162 | workspaceId: string | undefined, |
| 163 | filters: LogFilters, |
| 164 | options?: UseLogsListOptions |
| 165 | ) { |
| 166 | return useInfiniteQuery({ |
| 167 | queryKey: logKeys.list(workspaceId, filters), |
| 168 | queryFn: ({ pageParam, signal }) => |
| 169 | fetchLogsPage(workspaceId as string, filters, pageParam, signal), |
| 170 | enabled: Boolean(workspaceId) && (options?.enabled ?? true), |
| 171 | refetchInterval: options?.refetchInterval ?? false, |
| 172 | staleTime: 30 * 1000, |
| 173 | placeholderData: keepPreviousData, |
| 174 | initialPageParam: null as string | null, |
| 175 | getNextPageParam: (lastPage) => lastPage.nextCursor, |
| 176 | }) |
| 177 | } |
| 178 | |
| 179 | interface UseLogDetailOptions { |
| 180 | enabled?: boolean |
no test coverage detected