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.

update ref before depending on it

Oleg Isonenbdb9fa50d133
diff --git a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx
index fb51f98c7a..966b135482 100644
--- a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx
+++ b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx
@@ -139,6 +139,10 @@ const useScrub = (options: {
hasScrubbed.current = false;
};
+ useEffect(() => {
+ optionsRef.current = options;
+ }, [options]);
+
useEffect(() => {
const { value, onChange, onChangeComplete } = optionsRef.current;
if (value.type !== "unit" || inputRef.current === null) return;
@@ -165,10 +169,6 @@ const useScrub = (options: {
};
}, [options.value.type]);
- useEffect(() => {
- optionsRef.current = options;
- }, [options]);
-
return {
handlePointerUp,
inputRef,