()
| 323 | * Invalidates deployment info and versions queries on success. |
| 324 | */ |
| 325 | export function useUndeployWorkflow() { |
| 326 | const queryClient = useQueryClient() |
| 327 | |
| 328 | return useMutation({ |
| 329 | mutationFn: async ({ workflowId }: UndeployWorkflowVariables) => { |
| 330 | return requestJson(undeployWorkflowContract, { |
| 331 | params: { id: workflowId }, |
| 332 | }) |
| 333 | }, |
| 334 | onSettled: (_data, error, variables) => { |
| 335 | if (error) { |
| 336 | logger.error('Failed to undeploy workflow', { error }) |
| 337 | } else { |
| 338 | logger.info('Workflow undeployed successfully', { workflowId: variables.workflowId }) |
| 339 | } |
| 340 | return Promise.all([ |
| 341 | invalidateDeploymentQueries(queryClient, variables.workflowId), |
| 342 | queryClient.invalidateQueries({ |
| 343 | queryKey: deploymentKeys.chatStatus(variables.workflowId), |
| 344 | }), |
| 345 | ]) |
| 346 | }, |
| 347 | }) |
| 348 | } |
| 349 | |
| 350 | /** |
| 351 | * Variables for update deployment version mutation |
no test coverage detected