Skip to content

Commit

Permalink
Invalidate workflow query after save (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
ykeremy authored Sep 9, 2024
1 parent d6193bc commit 2697991
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useParams } from "react-router-dom";
import { useWorkflowQuery } from "../hooks/useWorkflowQuery";
import { getElements } from "./workflowEditorUtils";
import { useMutation } from "@tanstack/react-query";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import {
BlockYAML,
ParameterYAML,
Expand All @@ -18,6 +18,7 @@ import { AxiosError } from "axios";
function WorkflowEditor() {
const { workflowPermanentId } = useParams();
const credentialGetter = useCredentialGetter();
const queryClient = useQueryClient();

const { data: workflow, isLoading } = useWorkflowQuery({
workflowPermanentId,
Expand Down Expand Up @@ -60,6 +61,9 @@ function WorkflowEditor() {
description: "Your changes have been saved",
variant: "success",
});
queryClient.invalidateQueries({
queryKey: ["workflow", workflowPermanentId],
});
},
onError: (error: AxiosError) => {
toast({
Expand Down

0 comments on commit 2697991

Please sign in to comment.