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(dropdown): unnecessary ref in dropdown #4278

Merged
merged 1 commit into from
Dec 8, 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/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;
};
Loading