Skip to content

Commit 76709f8

Browse files
Feature/fix autocomplete props (#136)
Fix key props on MUI autocomplete
1 parent 329741c commit 76709f8

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- wrong spread provided by MUI on `renderHighlightedOptionFunction`
13+
1014
## [3.6.0] - 2025-06-24
1115

1216
### Added

src/lib/helpers/typeahead.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ const groupOptions = (option: TypeaheadOption): string => (typeof option === "st
5151
const isDisabledGroup = (option: TypeaheadOption): boolean => typeof option !== "string" && !!option.group?.disabled;
5252

5353
const renderHighlightedOptionFunction = (
54-
props: React.HTMLAttributes<HTMLLIElement>,
54+
{ key, ...rest }: React.HTMLAttributes<HTMLLIElement> & { key?: unknown }, // same definition as Autocomplete's renderOption
5555
option: TypeaheadOption,
5656
{ inputValue }: AutocompleteRenderOptionState,
5757
): JSX.Element => {
5858
const parts = getAutosuggestHighlightParts(option, inputValue);
5959
return (
60-
<li {...props}>
60+
<li key={key as string} {...rest}>
6161
<div>
6262
{parts.map((part, index) => (
6363
<span key={index} style={{ fontWeight: part.highlight ? 700 : 400 }}>

0 commit comments

Comments
 (0)