MCPcopy
hub / github.com/simstudioai/sim / useRevertToVersion

Function useRevertToVersion

apps/sim/hooks/queries/workflows.ts:575–601  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

573}
574
575export 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
603interface ReorderWorkflowsVariables {
604 workspaceId: string

Callers 1

GeneralDeployFunction · 0.90

Calls 3

requestJsonFunction · 0.90
stateMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected