Skip to content

Commit

Permalink
fix(dropdown): unnecessary ref in dropdown (#4278)
Browse files Browse the repository at this point in the history
  • Loading branch information
wingkwong authored Dec 8, 2024
1 parent b16291b commit 26b33a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-pugs-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/dropdown": patch
---

fix unnecessary ref in dropdown (#4245)
12 changes: 3 additions & 9 deletions packages/components/dropdown/src/use-dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,12 @@ export function useDropdown(props: UseDropdownProps): UseDropdownReturn {
};
};

const getMenuTriggerProps: PropGetter = (
originalProps = {},
_ref: Ref<any> | 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 = <T extends object>(
Expand Down Expand Up @@ -225,5 +219,5 @@ export type UseDropdownReturn = {
disableAnimation: boolean;
getPopoverProps: PropGetter;
getMenuProps: <T extends object>(props?: Partial<MenuProps<T>>, ref?: Ref<any>) => MenuProps;
getMenuTriggerProps: (props?: any, ref?: Ref<any>) => any;
getMenuTriggerProps: (props?: any) => any;
};

0 comments on commit 26b33a5

Please sign in to comment.