From 26b33a51f0ae9d0bb1146277a8b61b839aa52393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D5=A1=D3=84=D5=A1?= Date: Sun, 8 Dec 2024 19:53:08 +0800 Subject: [PATCH] fix(dropdown): unnecessary ref in dropdown (#4278) --- .changeset/soft-pugs-travel.md | 5 +++++ packages/components/dropdown/src/use-dropdown.ts | 12 +++--------- 2 files changed, 8 insertions(+), 9 deletions(-) create mode 100644 .changeset/soft-pugs-travel.md diff --git a/.changeset/soft-pugs-travel.md b/.changeset/soft-pugs-travel.md new file mode 100644 index 0000000000..82edda38d4 --- /dev/null +++ b/.changeset/soft-pugs-travel.md @@ -0,0 +1,5 @@ +--- +"@nextui-org/dropdown": patch +--- + +fix unnecessary ref in dropdown (#4245) diff --git a/packages/components/dropdown/src/use-dropdown.ts b/packages/components/dropdown/src/use-dropdown.ts index fa78241ab3..9980c1a4e3 100644 --- a/packages/components/dropdown/src/use-dropdown.ts +++ b/packages/components/dropdown/src/use-dropdown.ts @@ -164,18 +164,12 @@ export function useDropdown(props: UseDropdownProps): UseDropdownReturn { }; }; - const getMenuTriggerProps: PropGetter = ( - originalProps = {}, - _ref: Ref | null | undefined = null, - ) => { + const getMenuTriggerProps: PropGetter = (originalProps = {}) => { // These props are not needed for the menu trigger since it is handled by the popover trigger. // eslint-disable-next-line @typescript-eslint/no-unused-vars const {onPress, onPressStart, ...otherMenuTriggerProps} = menuTriggerProps; - return { - ...mergeProps(otherMenuTriggerProps, {isDisabled}, originalProps), - ref: mergeRefs(_ref, triggerRef), - }; + return mergeProps(otherMenuTriggerProps, {isDisabled}, originalProps); }; const getMenuProps = ( @@ -225,5 +219,5 @@ export type UseDropdownReturn = { disableAnimation: boolean; getPopoverProps: PropGetter; getMenuProps: (props?: Partial>, ref?: Ref) => MenuProps; - getMenuTriggerProps: (props?: any, ref?: Ref) => any; + getMenuTriggerProps: (props?: any) => any; };