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 17, 2024
1 parent 5fdc832 commit ac2582a
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 ac2582a

Please sign in to comment.