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
* fix: avoid pseudo-selector duplicate when conditional and pseudo overrides target the same property
Two related bugs caused 'the same pseudo selector or at-rule cannot be used more than once'
for components like:
styled.textarea`
border: ${themedBorder('bgBorder')};
border-color: ${(p) => p.$hasError ? p.theme.color.redBase : undefined};
&:focus {
border-color: ${(p) => p.$hasError ? p.theme.color.redBase : p.theme.color.controlPrimary};
}
`;
1. `(p) => p.$x ? value : undefined` (or `null`/`false`/`""`) now resolves to a
single positive variant bucket via `splitVariantsResolved*` instead of falling
through to a dynamic style function, matching the semantics of `p.$x && value`
and avoiding pseudo-map collisions.
2. When seeding `default` of a new pseudo map from an inherited base value, the
inherited value's own `default` is now unwrapped instead of being nested,
preventing malformed shapes like `{ default: { default: A, ":focus": B }, ":focus": C }`.
Co-authored-by: Kenneth Skovhus <skovhus@users.noreply.github.com>
* fix: drop unsafe negative-only variant lowering for `prop ? undefined : value`
The negative-only branch added in the previous commit emitted a single
`splitVariantsResolvedValue` variant with a `!prop` `when` key, but
`handleSplitVariantsResolvedValue` treats negated entries as the
unconditional default and applies them directly to the base `styleObj`.
That silently dropped the `!prop` gate and produced always-on styles.
Restrict `buildOneSidedVariantResult` to the positive-only direction
(`prop ? value : undefined/null/false/""`) — which was the originally
reported pattern — and let the inverse fall through to the dynamic
style-function fallback. Add a regression test that fails if the
unconditional-leak ever reappears.
Addresses Codex review on PR #391.
Co-authored-by: Kenneth Skovhus <skovhus@users.noreply.github.com>
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
0 commit comments