Skip to content

Commit

Permalink
fix: stop rendering inherited styles in css preview (#4478)
Browse files Browse the repository at this point in the history
Huge amount of css variables adds something like 8k of dom elements to
highlighted css preview.

Here as fast fix killed inherited styles so at least only root will lag
and everything else will not get performance hit.
  • Loading branch information
TrySound authored Nov 27, 2024
1 parent fc38c4f commit 6ed4b92
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions apps/builder/app/builder/features/navigator/css-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const getCssText = (
instanceId: string
) => {
const sourceStyles: StyleMap = new Map();
const inheritedStyles: StyleMap = new Map();
const cascadedStyles: StyleMap = new Map();
const presetStyles: StyleMap = new Map();

Expand All @@ -55,8 +54,6 @@ const getCssText = (
if (group) {
if (styleDecl.source.instanceId === instanceId) {
group.set(property, styleDecl.cascadedValue);
} else {
inheritedStyles.set(property, styleDecl.cascadedValue);
}
}
}
Expand All @@ -73,7 +70,6 @@ const getCssText = (

add("Style Sources", sourceStyles);
add("Cascaded", cascadedStyles);
add("Inherited", inheritedStyles);
add("Preset", presetStyles);

return result.join("\n");
Expand Down

0 comments on commit 6ed4b92

Please sign in to comment.