Fix a bug caused by setting staleTime to zero (#388)
This commit is contained in:
@@ -20,6 +20,7 @@ function CreateNewTaskFormPage() {
|
|||||||
.then((response) => response.data);
|
.then((response) => response.data);
|
||||||
},
|
},
|
||||||
enabled: !!template && !sampleCases.includes(template as SampleCase),
|
enabled: !!template && !sampleCases.includes(template as SampleCase),
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!template) {
|
if (!template) {
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import {
|
|||||||
webhookCallbackUrlDescription,
|
webhookCallbackUrlDescription,
|
||||||
} from "../data/descriptionHelperContent";
|
} from "../data/descriptionHelperContent";
|
||||||
import { SubmitEvent } from "@/types";
|
import { SubmitEvent } from "@/types";
|
||||||
|
import { AxiosError } from "axios";
|
||||||
|
|
||||||
const savedTaskFormSchema = z
|
const savedTaskFormSchema = z
|
||||||
.object({
|
.object({
|
||||||
@@ -148,7 +149,23 @@ function SavedTaskForm({ initialValues }: Props) {
|
|||||||
{ data: { task_id: string } }
|
{ data: { task_id: string } }
|
||||||
>("/tasks", taskRequest);
|
>("/tasks", taskRequest);
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error: AxiosError) => {
|
||||||
|
if (error.response?.status === 402) {
|
||||||
|
toast({
|
||||||
|
variant: "destructive",
|
||||||
|
title: "Failed to create task",
|
||||||
|
description:
|
||||||
|
"You don't have enough credits to run this task. Go to billing to see your credit balance.",
|
||||||
|
action: (
|
||||||
|
<ToastAction altText="Go to Billing">
|
||||||
|
<Button asChild>
|
||||||
|
<Link to="billing">Go to Billing</Link>
|
||||||
|
</Button>
|
||||||
|
</ToastAction>
|
||||||
|
),
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
toast({
|
toast({
|
||||||
variant: "destructive",
|
variant: "destructive",
|
||||||
title: "Error",
|
title: "Error",
|
||||||
|
|||||||
Reference in New Issue
Block a user