()
| 573 | } |
| 574 | |
| 575 | export function useRevertToVersion() { |
| 576 | const queryClient = useQueryClient() |
| 577 | |
| 578 | return useMutation({ |
| 579 | mutationFn: async ({ workflowId, version }: RevertToVersionVariables): Promise<void> => { |
| 580 | await requestJson(revertToDeploymentVersionContract, { |
| 581 | params: { id: workflowId, version }, |
| 582 | }) |
| 583 | }, |
| 584 | onSettled: (_data, _error, variables) => { |
| 585 | return Promise.all([ |
| 586 | queryClient.invalidateQueries({ |
| 587 | queryKey: workflowKeys.state(variables.workflowId), |
| 588 | }), |
| 589 | queryClient.invalidateQueries({ |
| 590 | queryKey: deploymentKeys.info(variables.workflowId), |
| 591 | }), |
| 592 | queryClient.invalidateQueries({ |
| 593 | queryKey: deploymentKeys.deployedState(variables.workflowId), |
| 594 | }), |
| 595 | queryClient.invalidateQueries({ |
| 596 | queryKey: deploymentKeys.versions(variables.workflowId), |
| 597 | }), |
| 598 | ]) |
| 599 | }, |
| 600 | }) |
| 601 | } |
| 602 | |
| 603 | interface ReorderWorkflowsVariables { |
| 604 | workspaceId: string |
no test coverage detected