Skip to content

Automate browser based workflows with AI

Fix a bug caused by setting staleTime to zero (#388)

Kerem Yilmazcaa974974cef
diff --git a/skyvern-frontend/src/routes/tasks/create/CreateNewTaskFormPage.tsx b/skyvern-frontend/src/routes/tasks/create/CreateNewTaskFormPage.tsx
index c5ab56c35..bf137c472 100644
--- a/skyvern-frontend/src/routes/tasks/create/CreateNewTaskFormPage.tsx
+++ b/skyvern-frontend/src/routes/tasks/create/CreateNewTaskFormPage.tsx
@@ -20,6 +20,7 @@ function CreateNewTaskFormPage() {
.then((response) => response.data);
},
enabled: !!template && !sampleCases.includes(template as SampleCase),
+ refetchOnWindowFocus: false,
});
if (!template) {
diff --git a/skyvern-frontend/src/routes/tasks/create/SavedTaskForm.tsx b/skyvern-frontend/src/routes/tasks/create/SavedTaskForm.tsx
index a0074b2e3..5906da52c 100644
--- a/skyvern-frontend/src/routes/tasks/create/SavedTaskForm.tsx
+++ b/skyvern-frontend/src/routes/tasks/create/SavedTaskForm.tsx
@@ -38,6 +38,7 @@ import {
webhookCallbackUrlDescription,
} from "../data/descriptionHelperContent";
import { SubmitEvent } from "@/types";
+import { AxiosError } from "axios";
const savedTaskFormSchema = z
.object({
@@ -148,7 +149,23 @@ function SavedTaskForm({ initialValues }: Props) {
{ data: { task_id: string } }
>("/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({
variant: "destructive",
title: "Error",