Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(system-rsc): defaultVariants null case in extendVariants #3503

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sharp-bobcats-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/system-rsc": patch
---

handled defaultVariants null case in extendVariants (#3502)
19 changes: 11 additions & 8 deletions packages/core/system-rsc/src/extend-variants.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,17 @@ function getClassNamesWithProps({
const customTv = tv(
{
variants,
// Do not apply default variants when the props variant is different
defaultVariants: Object.keys(defaultVariants)
.filter((k) => !keys.includes(k))
.reduce((o, k) => {
o[k] = defaultVariants[k];

return o;
}, []),
defaultVariants:
defaultVariants && typeof defaultVariants === "object"
? // Do not apply default variants when the props variant is different
Object.keys(defaultVariants)
.filter((k) => !keys.includes(k))
.reduce((o, k) => {
o[k] = defaultVariants[k];

return o;
}, [])
: defaultVariants,
compoundVariants,
...(hasSlots && {slots}),
},
Expand Down