Skip to content

Commit

Permalink
[material-ui][Autocomplete] Fix React 18.3 key spread warnings in Aut…
Browse files Browse the repository at this point in the history
…ocomplete demos (#42691)
  • Loading branch information
aarongarciah committed Jul 5, 2024
1 parent e5e9b9d commit 7cf0b55
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 46 deletions.
18 changes: 11 additions & 7 deletions docs/data/material/components/autocomplete/FixedTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ export default function FixedTags() {
options={top100Films}
getOptionLabel={(option) => option.title}
renderTags={(tagValue, getTagProps) =>
tagValue.map((option, index) => (
<Chip
label={option.title}
{...getTagProps({ index })}
disabled={fixedOptions.indexOf(option) !== -1}
/>
))
tagValue.map((option, index) => {
const { key, ...tagProps } = getTagProps({ index });
return (
<Chip
key={key}
label={option.title}
{...tagProps}
disabled={fixedOptions.indexOf(option) !== -1}
/>
);
})
}
style={{ width: 500 }}
renderInput={(params) => (
Expand Down
18 changes: 11 additions & 7 deletions docs/data/material/components/autocomplete/FixedTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ export default function FixedTags() {
options={top100Films}
getOptionLabel={(option) => option.title}
renderTags={(tagValue, getTagProps) =>
tagValue.map((option, index) => (
<Chip
label={option.title}
{...getTagProps({ index })}
disabled={fixedOptions.indexOf(option) !== -1}
/>
))
tagValue.map((option, index) => {
const { key, ...tagProps } = getTagProps({ index });
return (
<Chip
key={key}
label={option.title}
{...tagProps}
disabled={fixedOptions.indexOf(option) !== -1}
/>
);
})
}
style={{ width: 500 }}
renderInput={(params) => (
Expand Down
40 changes: 24 additions & 16 deletions docs/data/material/components/autocomplete/Sizes.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,18 @@ export default function Sizes() {
getOptionLabel={(option) => option.title}
defaultValue={top100Films[13]}
renderTags={(value, getTagProps) =>
value.map((option, index) => (
<Chip
variant="outlined"
label={option.title}
size="small"
{...getTagProps({ index })}
/>
))
value.map((option, index) => {
const { key, ...tagProps } = getTagProps({ index });
return (
<Chip
key={key}
variant="outlined"
label={option.title}
size="small"
{...tagProps}
/>
);
})
}
renderInput={(params) => (
<TextField
Expand All @@ -92,14 +96,18 @@ export default function Sizes() {
getOptionLabel={(option) => option.title}
defaultValue={[top100Films[13]]}
renderTags={(value, getTagProps) =>
value.map((option, index) => (
<Chip
variant="outlined"
label={option.title}
size="small"
{...getTagProps({ index })}
/>
))
value.map((option, index) => {
const { key, ...tagProps } = getTagProps({ index });
return (
<Chip
key={key}
variant="outlined"
label={option.title}
size="small"
{...tagProps}
/>
);
})
}
renderInput={(params) => (
<TextField
Expand Down
40 changes: 24 additions & 16 deletions docs/data/material/components/autocomplete/Sizes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,18 @@ export default function Sizes() {
getOptionLabel={(option) => option.title}
defaultValue={top100Films[13]}
renderTags={(value, getTagProps) =>
value.map((option, index) => (
<Chip
variant="outlined"
label={option.title}
size="small"
{...getTagProps({ index })}
/>
))
value.map((option, index) => {
const { key, ...tagProps } = getTagProps({ index });
return (
<Chip
key={key}
variant="outlined"
label={option.title}
size="small"
{...tagProps}
/>
);
})
}
renderInput={(params) => (
<TextField
Expand All @@ -92,14 +96,18 @@ export default function Sizes() {
getOptionLabel={(option) => option.title}
defaultValue={[top100Films[13]]}
renderTags={(value, getTagProps) =>
value.map((option, index) => (
<Chip
variant="outlined"
label={option.title}
size="small"
{...getTagProps({ index })}
/>
))
value.map((option, index) => {
const { key, ...tagProps } = getTagProps({ index });
return (
<Chip
key={key}
variant="outlined"
label={option.title}
size="small"
{...tagProps}
/>
);
})
}
renderInput={(params) => (
<TextField
Expand Down

0 comments on commit 7cf0b55

Please sign in to comment.