You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Guard against infinitely recursive theme key lookup (#1332)
When constructing the design system we compute color swatches for all
classes. This process involves:
- Computing the CSS for a utility
- Inlining any values from the theme, recursively
- Scanning for CSS color syntax that we can compute a swatch for
We guard against directly self-recursive replacements because of how the
replacement itself functions. However, if you wrapped the variable in
something then we would effectively recurse into the expression and try
to replace the variable again. This caused the expansion to then be
wrapped and then try again resulting in an infinite loop.
This fixes it by keeping track of seen variables during a replacement
and if we've seen it _and_ the expansion contains a var(…) anywhere
we'll only replace it once. This logic is not perfect as the thing that
matters is that the replacement _itself_ results in a recursion but this
is good enough for now.
Fixes#1329
0 commit comments