mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.47k stars 32.16k forks source link

Encountered two children with the same key #43795

Open Nefcanto opened 1 week ago

Nefcanto commented 1 week ago

Steps to reproduce

Create an MUI app and use autocomplete. You should see:

Warning: Encountered two children with the same key, ``. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
ul
withEmotionCache2/<@https://client.menutime.local/node_modules/.vite/deps/chunk-EAUZXVZV.js?v=783f97bd:692:45
div
withEmotionCache2/<@https://client.menutime.local/node_modules/.vite/deps/chunk-EAUZXVZV.js?v=783f97bd:692:45
Paper2@https://client.menutime.local/node_modules/.vite/deps/chunk-SNTBBM6X.js?v=783f97bd:101:32
withEmotionCache2/<@https://client.menutime.local/node_modules/.vite/deps/chunk-EAUZXVZV.js?v=783f97bd:692:45
div
PopperTooltip2@https://client.menutime.local/node_modules/.vite/deps/chunk-7LK47B33.js?v=783f97bd:1572:7
Portal2@https://client.menutime.local/node_modules/.vite/deps/chunk-NGWQQGGN.js?v=783f97bd:38:7
Popper2@https://client.menutime.local/node_modules/.vite/deps/chunk-7LK47B33.js?v=783f97bd:1689:7
withEmotionCache2/<@https://client.menutime.local/node_modules/.vite/deps/chunk-EAUZXVZV.js?v=783f97bd:692:45
Popper4@https://client.menutime.local/node_modules/.vite/deps/chunk-7LK47B33.js?v=783f97bd:1874:17
withEmotionCache2/<@https://client.menutime.local/node_modules/.vite/deps/chunk-EAUZXVZV.js?v=783f97bd:692:45
Autocomplete2@https://client.menutime.local/node_modules/.vite/deps/@mui_material_Autocomplete.js?v=d4467d5a:1549:32
div
withEmotionCache2/<@https://client.menutime.local/node_modules/.vite/deps/chunk-EAUZXVZV.js?v=783f97bd:692:45
FormControl2@https://client.menutime.local/node_modules/.vite/deps/chunk-IWZZKCP6.js?v=783f97bd:114:32

Current behavior

No response

Expected behavior

No response

Context

No response

Your environment

No response

Search keywords: same key

AsimSafarli commented 1 week ago

<Autocomplete options={data} getOptionLabel={(item) => item.title} renderInput={(params) => <TextField {...params} label="Choose an option" />} key={(item) => item.id} {'mock data use uuid '} />