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.

clean on newImages

Sara Vieira59e339c59b11
diff --git a/apps/designer/app/designer/features/sidebar-left/panels/asset-manager.tsx b/apps/designer/app/designer/features/sidebar-left/panels/asset-manager.tsx
index f0726989eb..6dc23b7eda 100644
--- a/apps/designer/app/designer/features/sidebar-left/panels/asset-manager.tsx
+++ b/apps/designer/app/designer/features/sidebar-left/panels/asset-manager.tsx
@@ -1,7 +1,7 @@
import { ImageIcon } from "~/shared/icons";
import { Button, Flex, Grid, Heading } from "~/shared/design-system";
import { ChangeEvent, useEffect, useRef, useState } from "react";
-import { Form, useSubmit } from "@remix-run/react";
+import { Form, useActionData, useSubmit } from "@remix-run/react";
import type { Asset } from "@webstudio-is/prisma-client";
import { AssetManagerImage } from "./components/image";
import ObjectID from "bson-objectid";
@@ -36,6 +36,7 @@ type ParsedFiles = {
}[];
export const TabContent = ({ assets }: { assets: Array<Asset> }) => {
+ const newImages = useActionData();
const inputRef = useRef<HTMLInputElement | null>(null);
const submit = useSubmit();
const [uploadedImages, setUploadedImages] = useState<ParsedFiles>([]);
@@ -52,8 +53,10 @@ export const TabContent = ({ assets }: { assets: Array<Asset> }) => {
};
useEffect(() => {
- setUploadedImages([]);
- }, [assets?.length]);
+ if (newImages?.assets.length) {
+ setUploadedImages([]);
+ }
+ }, [newImages]);
return (
<Flex gap="3" direction="column" css={{ padding: "$1" }}>