( workspaceId: string | undefined, executionId: string | null | undefined )
| 201 | } |
| 202 | |
| 203 | export function useLogByExecutionId( |
| 204 | workspaceId: string | undefined, |
| 205 | executionId: string | null | undefined |
| 206 | ) { |
| 207 | const queryClient = useQueryClient() |
| 208 | return useQuery({ |
| 209 | queryKey: logKeys.byExecution(workspaceId, executionId ?? undefined), |
| 210 | queryFn: async ({ signal }) => { |
| 211 | const { data } = await requestJson(getLogByExecutionIdContract, { |
| 212 | params: { executionId: executionId as string }, |
| 213 | query: { workspaceId: workspaceId as string }, |
| 214 | signal, |
| 215 | }) |
| 216 | queryClient.setQueryData(logKeys.detail(workspaceId, data.id), data) |
| 217 | return data |
| 218 | }, |
| 219 | enabled: Boolean(workspaceId) && Boolean(executionId), |
| 220 | staleTime: 30 * 1000, |
| 221 | }) |
| 222 | } |
| 223 | |
| 224 | export function prefetchLogDetail(queryClient: QueryClient, logId: string, workspaceId: string) { |
| 225 | queryClient.prefetchQuery({ |
no test coverage detected