Skip to content

Conversation

@philipp-spiess
Copy link
Member

Closes #15617

Summary

This PR ignores addVariant(…) legacy JS plugin calls for variants that are using the :merge(…) selector for parent and sibling states. We can ignore these now because in v4, group-* and peer-* variants compound automatically and you don't have to define them anymore.

Test plan

Added a unit test to ensure that the optional variant example from the v3 docs work as expected.

@philipp-spiess philipp-spiess requested a review from a team as a code owner May 14, 2025 13:56
if (variant.some((v) => v.includes(':merge('))) return
} else if (typeof variant === 'object') {
if (Object.keys(variant).some((v) => v.includes(':merge('))) return
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. We should detect this in matchVariant as well.
  2. Should the object check happen recursively or no? I don't remember what v3 did there

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Ah yep forgot about matchVariant.
  2. Hmm yeah probably you're right.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thecrypticace The matchVariant(…) implementation is a bit annoying since we have to call the matcher function to sample the output. I tried throwing the variant out later but once we register it with the design system, the peer-* and group-* compounding doesn't work anymore.

The only other idea I have is to check for wether the variant starts with peer- or group-. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[V4] :merge selector broken

3 participants