(workflowId: string, executionId: string, contextId?: string)
| 130 | * no longer exists (404). `staleTime: 0` because pause state is live. |
| 131 | */ |
| 132 | export function usePauseContextDetail(workflowId: string, executionId: string, contextId?: string) { |
| 133 | return useQuery({ |
| 134 | queryKey: resumeKeys.context(workflowId, executionId, contextId), |
| 135 | queryFn: async ({ signal }): Promise<PauseContextDetail | null> => { |
| 136 | try { |
| 137 | const raw = await requestJson(getPauseContextDetailContract, { |
| 138 | params: { workflowId, executionId, contextId: contextId as string }, |
| 139 | signal, |
| 140 | }) |
| 141 | // double-cast-allowed: contract models the pause point as z.record; the resume UI uses the richer PauseContextDetail interface |
| 142 | return raw as unknown as PauseContextDetail |
| 143 | } catch (error) { |
| 144 | if (isApiClientError(error) && error.status === 404) return null |
| 145 | throw error |
| 146 | } |
| 147 | }, |
| 148 | enabled: Boolean(workflowId && executionId && contextId), |
| 149 | staleTime: 0, |
| 150 | }) |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * Submits a resume for a pause context and invalidates the execution + context |
no test coverage detected