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.

load before setting src

Sara Vieirab6277b42087b
diff --git a/apps/designer/app/designer/features/sidebar-left/panels/components/image.tsx b/apps/designer/app/designer/features/sidebar-left/panels/components/image.tsx
index b3afc8c114..9115d181bb 100644
--- a/apps/designer/app/designer/features/sidebar-left/panels/components/image.tsx
+++ b/apps/designer/app/designer/features/sidebar-left/panels/components/image.tsx
@@ -9,10 +9,9 @@ const useImageWithFallback = ({ path }: { path: string }) => {
useEffect(() => {
const newImage = new Image();
- newImage.src = path;
-
newImage.onload = () => setSrc(path);
newImage.onerror = () => setSrc(brokenImage);
+ newImage.src = path;
}, [path]);
return src;