From f6531c5f603d7f6308a597962ec6fab62c92fa93 Mon Sep 17 00:00:00 2001 From: Junior Garcia Date: Sat, 16 Sep 2023 18:06:16 -0300 Subject: [PATCH] fix(core): extend variants function, destructuring order changed (#1642) * fix(core): extend variants function, destructuring order changed * chore(core): changeset added --- .changeset/moody-fans-stare.md | 5 +++++ packages/core/system-rsc/src/extend-variants.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/moody-fans-stare.md diff --git a/.changeset/moody-fans-stare.md b/.changeset/moody-fans-stare.md new file mode 100644 index 0000000000..b3e62f9aa0 --- /dev/null +++ b/.changeset/moody-fans-stare.md @@ -0,0 +1,5 @@ +--- +"@nextui-org/system-rsc": patch +--- + +Fix #1541 `extendVariants`function gives more priority to final component props over the `extendVariants` props diff --git a/packages/core/system-rsc/src/extend-variants.js b/packages/core/system-rsc/src/extend-variants.js index f14d6959b9..a25578f212 100644 --- a/packages/core/system-rsc/src/extend-variants.js +++ b/packages/core/system-rsc/src/extend-variants.js @@ -43,7 +43,7 @@ export function extendVariants(BaseComponent, styles = {}, opts = {}) { const ForwardedComponent = React.forwardRef((originalProps, ref) => { const [baseProps, variantProps] = mapPropsVariants(originalProps, customTv.variantKeys, false); - const newProps = {...baseProps, ...defaultVariants, ref}; + const newProps = {...defaultVariants, ...baseProps, ref}; let classNames = {};