From ae9380f03f4a4c326bca72b7adc4cf0bc3faf5f2 Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Tue, 25 Feb 2025 12:59:26 -0800 Subject: [PATCH] Add better cache invalidation for history (#1838) Co-authored-by: Muhammed Salih Altun --- skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx | 3 +++ skyvern-frontend/src/routes/tasks/create/ExampleCasePill.tsx | 3 +++ skyvern-frontend/src/routes/tasks/create/PromptBox.tsx | 3 +++ skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx | 3 +++ .../src/routes/workflows/workflowRun/WorkflowRunStream.tsx | 3 +++ 5 files changed, 15 insertions(+) diff --git a/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx b/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx index aaf809c4..1609d9d4 100644 --- a/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx +++ b/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx @@ -173,6 +173,9 @@ function CreateNewTaskForm({ initialValues }: Props) { queryClient.invalidateQueries({ queryKey: ["tasks"], }); + queryClient.invalidateQueries({ + queryKey: ["runs"], + }); }, }); diff --git a/skyvern-frontend/src/routes/tasks/create/ExampleCasePill.tsx b/skyvern-frontend/src/routes/tasks/create/ExampleCasePill.tsx index df9b8baf..d68169a3 100644 --- a/skyvern-frontend/src/routes/tasks/create/ExampleCasePill.tsx +++ b/skyvern-frontend/src/routes/tasks/create/ExampleCasePill.tsx @@ -40,6 +40,9 @@ function ExampleCasePill({ exampleId, version, icon, label, prompt }: Props) { queryClient.invalidateQueries({ queryKey: ["workflows"], }); + queryClient.invalidateQueries({ + queryKey: ["runs"], + }); navigate( `/workflows/${response.data.workflow_permanent_id}/${response.data.workflow_run_id}`, ); diff --git a/skyvern-frontend/src/routes/tasks/create/PromptBox.tsx b/skyvern-frontend/src/routes/tasks/create/PromptBox.tsx index 0a8a018e..6e408755 100644 --- a/skyvern-frontend/src/routes/tasks/create/PromptBox.tsx +++ b/skyvern-frontend/src/routes/tasks/create/PromptBox.tsx @@ -184,6 +184,9 @@ function PromptBox() { queryClient.invalidateQueries({ queryKey: ["workflows"], }); + queryClient.invalidateQueries({ + queryKey: ["runs"], + }); navigate( `/workflows/${response.data.workflow_permanent_id}/${response.data.workflow_run_id}`, ); diff --git a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx index b6e0cc55..53b84be9 100644 --- a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx +++ b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx @@ -136,6 +136,9 @@ function RunWorkflowForm({ queryClient.invalidateQueries({ queryKey: ["workflowRuns"], }); + queryClient.invalidateQueries({ + queryKey: ["runs"], + }); navigate( `/workflows/${workflowPermanentId}/${response.data.workflow_run_id}/overview`, ); diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunStream.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunStream.tsx index 574f548e..388a8d68 100644 --- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunStream.tsx +++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunStream.tsx @@ -69,6 +69,9 @@ function WorkflowRunStream() { queryClient.invalidateQueries({ queryKey: ["workflowTasks", workflowRunId], }); + queryClient.invalidateQueries({ + queryKey: ["runs"], + }); if ( message.status === "failed" || message.status === "terminated"