Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui][docs] Fix React 18.3 key spread warnings in Autocomplete demos #42854

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading