Add better cache invalidation for history (#1838)

Co-authored-by: Muhammed Salih Altun <muhammedsalihaltun@gmail.com>
This commit is contained in:
Shuchang Zheng 2025-02-25 12:59:26 -08:00 committed by GitHub
parent 13213d4523
commit ae9380f03f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 0 deletions

View file

@ -173,6 +173,9 @@ function CreateNewTaskForm({ initialValues }: Props) {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: ["tasks"], queryKey: ["tasks"],
}); });
queryClient.invalidateQueries({
queryKey: ["runs"],
});
}, },
}); });

View file

@ -40,6 +40,9 @@ function ExampleCasePill({ exampleId, version, icon, label, prompt }: Props) {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: ["workflows"], queryKey: ["workflows"],
}); });
queryClient.invalidateQueries({
queryKey: ["runs"],
});
navigate( navigate(
`/workflows/${response.data.workflow_permanent_id}/${response.data.workflow_run_id}`, `/workflows/${response.data.workflow_permanent_id}/${response.data.workflow_run_id}`,
); );

View file

@ -184,6 +184,9 @@ function PromptBox() {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: ["workflows"], queryKey: ["workflows"],
}); });
queryClient.invalidateQueries({
queryKey: ["runs"],
});
navigate( navigate(
`/workflows/${response.data.workflow_permanent_id}/${response.data.workflow_run_id}`, `/workflows/${response.data.workflow_permanent_id}/${response.data.workflow_run_id}`,
); );

View file

@ -136,6 +136,9 @@ function RunWorkflowForm({
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: ["workflowRuns"], queryKey: ["workflowRuns"],
}); });
queryClient.invalidateQueries({
queryKey: ["runs"],
});
navigate( navigate(
`/workflows/${workflowPermanentId}/${response.data.workflow_run_id}/overview`, `/workflows/${workflowPermanentId}/${response.data.workflow_run_id}/overview`,
); );

View file

@ -69,6 +69,9 @@ function WorkflowRunStream() {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: ["workflowTasks", workflowRunId], queryKey: ["workflowTasks", workflowRunId],
}); });
queryClient.invalidateQueries({
queryKey: ["runs"],
});
if ( if (
message.status === "failed" || message.status === "failed" ||
message.status === "terminated" message.status === "terminated"