Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix double toasts

Sara Vieira5e1b0eb4d622
diff --git a/apps/designer/app/routes/designer/$id.tsx b/apps/designer/app/routes/designer/$id.tsx
index 95d59275dc..0dfe516950 100644
--- a/apps/designer/app/routes/designer/$id.tsx
+++ b/apps/designer/app/routes/designer/$id.tsx
@@ -15,6 +15,7 @@ import {
loadByProject,
} from "@webstudio-is/asset-uploader/index.server";
import { zfd } from "zod-form-data";
+import { useEffect } from "react";
export { links };
@@ -90,12 +91,16 @@ const DesignerRoute = () => {
const actionData = useActionData();
const data = useLoaderData<Data | Error>();
+ useEffect(() => {
+ if (actionData && "errors" in actionData) {
+ toast.error(actionData.errors);
+ }
+ }, [actionData]);
+
if ("errors" in data) {
return <ErrorMessage message={data.errors} />;
}
- if (actionData && "errors" in actionData) {
- toast.error(actionData.errors, { id: "upload-error" });
- }
+
return <Designer {...data} />;
};
diff --git a/packages/asset-uploader/src/schema.ts b/packages/asset-uploader/src/schema.ts
index 12205c9724..d9124afdb3 100644
--- a/packages/asset-uploader/src/schema.ts
+++ b/packages/asset-uploader/src/schema.ts
@@ -29,5 +29,5 @@ export const fsEnvVariables = z.object({
});
export const assetEnvVariables = z.object({
- MAX_UPLOAD_SIZE: z.string().optional().default("10"),
+ MAX_UPLOAD_SIZE: z.string().optional().default("1"),
});