( buildPath: (runId: string, vars: RunMutationVars) => string, method: HttpMethod = 'POST', )
| 207 | } |
| 208 | |
| 209 | function makeRunMutation( |
| 210 | buildPath: (runId: string, vars: RunMutationVars) => string, |
| 211 | method: HttpMethod = 'POST', |
| 212 | ) { |
| 213 | return function useRunMutation(runId: string) { |
| 214 | const qc = useQueryClient() |
| 215 | return useMutation({ |
| 216 | mutationFn: (vars: RunMutationVars) => { |
| 217 | const path = buildPath(runId, vars) |
| 218 | return method === 'PATCH' |
| 219 | ? apiClient.patch(path, vars.body) |
| 220 | : apiClient.post(path, vars.body) |
| 221 | }, |
| 222 | onSuccess: () => { |
| 223 | void qc.invalidateQueries({ queryKey: traceKeys.run(runId) }) |
| 224 | }, |
| 225 | }) |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | export type StatusKind = 'idle' | 'running' | 'blocked' | 'done' | 'error' |
| 230 |
no outgoing calls
no test coverage detected
searching dependent graphs…