Skip to content

Commit

Permalink
[material-ui][docs] Fix React 18.3 key spread warnings in Autocomplet…
Browse files Browse the repository at this point in the history
…e demos (#42854)
  • Loading branch information
aarongarciah authored Jul 5, 2024
1 parent 3f8e3b4 commit 03dffde
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 03dffde

Please sign in to comment.