Skip to content

Commit

Permalink
Do not spread key prop
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongarciah committed Jun 18, 2024
1 parent aceac7d commit 3a6ae48
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/mui-joy/src/Autocomplete/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,14 @@ const Autocomplete = React.forwardRef(function Autocomplete(
},
});

const defaultRenderOption = (optionProps: any, option: unknown) => (
<SlotOption {...optionProps}>{getOptionLabel(option)}</SlotOption>
);
const defaultRenderOption = (optionProps: any, option: unknown) => {
const { key, ...rest } = optionProps;
return (
<SlotOption key={key} {...rest}>
{getOptionLabel(option)}
</SlotOption>
);
};

const renderOption = renderOptionProp || defaultRenderOption;

Expand Down

0 comments on commit 3a6ae48

Please sign in to comment.