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.

why do we have excessive renders?

Sultane277de6bd7c8
diff --git a/apps/designer/app/designer/features/style-panel/controls/color/color-control.tsx b/apps/designer/app/designer/features/style-panel/controls/color/color-control.tsx
index 4b23382581..124d74513e 100644
--- a/apps/designer/app/designer/features/style-panel/controls/color/color-control.tsx
+++ b/apps/designer/app/designer/features/style-panel/controls/color/color-control.tsx
@@ -54,7 +54,7 @@ const ColorPicker = ({
>
<Tooltip
content={styleConfig.label}
- delayDuration={150}
+ delayDuration={700 / 4}
disableHoverableContent={true}
>
<Box
diff --git a/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx b/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx
index 4073e156ed..e020d9c85e 100644
--- a/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx
+++ b/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx
@@ -33,7 +33,10 @@ export const TextControl = ({
const props = isNaN(parseFloat(String(value.value)))
? {
type: "text",
- onChange: (event: ChangeEvent<HTMLInputElement>) => {},
+ spellCheck: "false",
+ onChange: (event: ChangeEvent<HTMLInputElement>) => {
+ setValue(event.target.value);
+ },
}
: {
type: "number",
@@ -41,7 +44,6 @@ export const TextControl = ({
setValue(event.target.value + "px");
},
};
- console.log(value, styleConfig);
const Icon = iconConfigs[styleConfig.property]?.normal || "noscript";
return (
<Grid
diff --git a/apps/designer/app/designer/features/style-panel/shared/lock.tsx b/apps/designer/app/designer/features/style-panel/shared/lock.tsx
index cc8e0de9cf..dd57ec709d 100644
--- a/apps/designer/app/designer/features/style-panel/shared/lock.tsx
+++ b/apps/designer/app/designer/features/style-panel/shared/lock.tsx
@@ -17,15 +17,15 @@ export const Lock = ({
}) => {
const aKey = pairedKeys[0];
const bKey = pairedKeys[1];
- const aVal = currentStyle[aKey]?.value;
- const bVal = currentStyle[bKey]?.value;
+ const aVal = parseFloat(currentStyle[aKey]?.value as string);
+ const bVal = parseFloat(currentStyle[bKey]?.value as string);
const [isPaired, setIsPaired] = useState(aVal === bVal);
useEffect(() => {
if (!isPaired) return;
if (aVal === bVal) return;
- batchUpdate.setProperty(aKey)(String(aVal));
- batchUpdate.setProperty(bKey)(String(aVal));
+ batchUpdate.setProperty(aKey)(String(aVal) + "px");
+ batchUpdate.setProperty(bKey)(String(aVal) + "px");
batchUpdate.publish();
}, [batchUpdate, isPaired, aKey, bKey, aVal, bVal]);
diff --git a/packages/react-sdk/src/css/get-browser-style.ts b/packages/react-sdk/src/css/get-browser-style.ts
index bd0586e918..60b787496d 100644
--- a/packages/react-sdk/src/css/get-browser-style.ts
+++ b/packages/react-sdk/src/css/get-browser-style.ts
@@ -3,9 +3,11 @@ import { properties } from "./properties";
import { units } from "./units";
const unitRegex = new RegExp(`${units.join("|")}`);
+const unitProps = ["columnGap", "rowGap"];
// @todo use a parser
const parseValue = (property: StyleProperty, value: string): StyleValue => {
+ if (value === "normal" && unitProps.includes(property)) value = "0";
const number = parseFloat(value);
const parsedUnit = unitRegex.exec(value);
if (value === "rgba(0, 0, 0, 0)") value = "transparent";