After upgrading to the latest version of tailwind-variants, we noticed a small UI regression where a component which specified only a false variant was continually using that, despite true being specifically passed in.
It looks like this occurs because of the logic to always fall back to the false variant if the initial value isn't found:
This PR addresses that by changing where the fallback happens. I've also added a couple of tests which cover the case that currently fails.
It's an odd case so hopefully this won't be impacting many other users! In our case, we actually realised that this API choice wasn't ideal and ended up implementing an alternative workaround. Still, the behaviour was very confusing to us for a moment and the fix seems quite simple, so decided to create a PR with the change.
Additional context
What is the purpose of this pull request?
[x] Bug fix
[ ] New Feature
[ ] Documentation update
[ ] Other
Before submitting the PR, please make sure you do the following
Description
After upgrading to the latest version of
tailwind-variants
, we noticed a small UI regression where a component which specified only afalse
variant was continually using that, despitetrue
being specifically passed in.It looks like this occurs because of the logic to always fall back to the
false
variant if the initial value isn't found:https://github.com/nextui-org/tailwind-variants/blob/a26d801f13f97af726a0c206ae413cd5543ea7ff/src/index.js#L220
This PR addresses that by changing where the fallback happens. I've also added a couple of tests which cover the case that currently fails.
It's an odd case so hopefully this won't be impacting many other users! In our case, we actually realised that this API choice wasn't ideal and ended up implementing an alternative workaround. Still, the behaviour was very confusing to us for a moment and the fix seems quite simple, so decided to create a PR with the change.
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).