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 critical css extraction on canvas

Oleg Isonen64ad1445da1a
diff --git a/apps/designer/app/canvas/shared/breakpoints.ts b/apps/designer/app/canvas/shared/breakpoints.ts
index 6194233984..8b30f4fb09 100644
--- a/apps/designer/app/canvas/shared/breakpoints.ts
+++ b/apps/designer/app/canvas/shared/breakpoints.ts
@@ -1,4 +1,4 @@
-import { useEffect } from "react";
+import { useEffect, useMemo } from "react";
import store from "immerhin";
import {
type Breakpoint,
@@ -15,7 +15,8 @@ import {
export const useInitializeBreakpoints = (breakpoints: Array<Breakpoint>) => {
const [, setCurrentBreakpoints] = useBreakpoints();
- useEffect(() => {
+ // Using useMemo instead of useEffect to run it server-side too.
+ useMemo(() => {
setBreakpoints(breakpoints);
setCurrentBreakpoints(breakpoints);
}, [breakpoints, setCurrentBreakpoints]);