universe icon indicating copy to clipboard operation
universe copied to clipboard

SX: implement styles rehydration

Open mrtnzlml opened this issue 2 years ago • 0 comments

I have these changes sitting locally for a very long time, and it's time to offload them. The idea behind the styles rehydration is very simple: we collect all existing styles from <style data-adeira-sx /> (once) and use this information later for deciding whether the styles should be injected or not (this is what I call rehydration).

The difference from the current solution is that we do it only once and we don't have to go through all the styles everytime there is something to inject.

Motivation for this change is performance: this should significantly improve the runtime style perf + be much easier to deal with (for example, we are basically brute-forcing @at rules and pseudo rules now).

Note: this is just a partial solution, there are other changes coming (custom styles printer and @at nodes/pseudo nodes optimization).

Related issue: https://github.com/adeira/universe/issues/1579

mrtnzlml avatar Mar 04 '22 01:03 mrtnzlml