From a320ca1fb34c8ff61f5dec47d81d225c42abe41e Mon Sep 17 00:00:00 2001 From: Dimitris-Rafail Katsampas Date: Wed, 23 Oct 2024 23:14:04 +0300 Subject: [PATCH] revert: "perf(core): avoid setting the same value to view properties" (#10618) Revert "perf(core): avoid setting the same value to view properties (#10602)" This reverts commit 499fe8dc82db623550a38d3f91eb9f9252304e31. --- packages/core/ui/styling/style-scope.ts | 35 +++++++------------------ 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/packages/core/ui/styling/style-scope.ts b/packages/core/ui/styling/style-scope.ts index 9c48bde1b..e8dcd5ed8 100644 --- a/packages/core/ui/styling/style-scope.ts +++ b/packages/core/ui/styling/style-scope.ts @@ -721,40 +721,25 @@ export class CssState { cssExpsProperties[property] = value; continue; } - - if (property in oldProperties) { - const oldValue = oldProperties[property]; - - delete oldProperties[property]; - - if (oldValue === value) { - // Skip unchanged values - continue; - } + delete oldProperties[property]; + if (property in oldProperties && oldProperties[property] === value) { + // Skip unchanged values + continue; } - if (isCssVariable(property)) { view.style.setScopedCssVariable(property, value); delete newPropertyValues[property]; continue; } - valuesToApply[property] = value; } - - // we need to parse CSS vars first before evaluating css expressions + //we need to parse CSS vars first before evaluating css expressions for (const property in cssExpsProperties) { + delete oldProperties[property]; const value = evaluateCssExpressions(view, property, cssExpsProperties[property]); - - if (property in oldProperties) { - const oldValue = oldProperties[property]; - - delete oldProperties[property]; - - if (oldValue === value) { - // Skip unchanged values - continue; - } + if (property in oldProperties && oldProperties[property] === value) { + // Skip unchanged values + continue; } if (value === unsetValue) { delete newPropertyValues[property]; @@ -776,11 +761,9 @@ export class CssState { view[camelCasedProperty] = unsetValue; } } - // Set new values to the style for (const property in valuesToApply) { const value = valuesToApply[property]; - try { if (property in view.style) { view.style[`css:${property}`] = value;