Home > @lynx-js/react-rsbuild-plugin > PluginReactLynxOptions > enableCSSInvalidation

PluginReactLynxOptions.enableCSSInvalidation property

CSS Invalidation refers to the process of determining which elements need to have their styles recalculated when the element is updated.

Signature:

enableCSSInvalidation?: boolean;

Remarks

When using combinator to determine the styles of various elements (including descendants, adjacent siblings, etc.), it is recommended to enable this feature. Otherwise, only the initial class setting can match the corresponding combinator, and subsequent updates will not recalculate the related styles.

We find that collecting invalidation nodes and updating them is a relatively time-consuming process. If there is no such usage and better style matching performance is needed, this feature can be selectively disabled.

Example

If a descendant selector .a .b is defined in a CSS file, then when an element's class changes to .a, all nodes in its subtree with the className .b need to have their styles recalculated.

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.