Used AutocompleteInput components give an error if the same name in "choice" object
See original GitHub issuePlayback steps:
{/* ... */}
<AutocompleteInput
label="Business"
source="businessId"
choices={[
{
id: "0",
name: "sameName",
},
{
id: "1",
name: "sameName",
},
{
id: "2",
name: "otherName",
},
]}
{/* ... */}
Expected result: The key of the component is the identifier or any specified field in “choice” object.
The actual result: In console give ad error:
Warning: Encountered two children with the same key, `sameName`.
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.
at ul
at div
at Paper
at div
at PopperTooltip
at Portal
at PopperUnstyled
at Popper
at Autocomplete
at AutocompleteInput
at DropdownCt
at div
at Box
at div
at Stack
at div
at CardContent
at DefaultComponent
at form
at FormGroupsProvider
at FormProvider
at LabelPrefixContextProvider
at OptionalRecordContextProvider
at Form
at SimpleForm
at div
at Box
at div
at Paper
at Card
at div
at div
at CreateView
at RecordContextProvider
at SaveContextProvider
at CreateContextProvider
at CreateBase
at Create
at RatesCreateCt
at Routes
at ResourceContextProvider
at Resource
at Routes
at ErrorBoundary
at div
at main
at div
at div
at Layout
at Layout
at div
at Routes
at CoreAdminRoutes
at Routes
at CoreAdminUI
at AdminUI
at InnerThemeProvider
at ThemeProvider
at ThemeProvider
at ThemeProvider
at ResourceDefinitionContextProvider
at NotificationContextProvider
at I18nContextProvider
at Router
at HistoryRouter
at InternalRouter
at BasenameContextProvider
at AdminRouter
at QueryClientProvider
at StoreContextProvider
at CoreAdminContext
at AdminContext
at Admin
at App`
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
[Autocomplete] Not working properly with repeated options ...
Used AutocompleteInput components give an error if the same name in "choice" object marmelab/react-admin#7996.
Read more >React admin `AutocompleteArrayInput` shows [object, Object]
But when I do console log the choice prop in option text, the data is existed. The code snippet is : return (...
Read more >Input Components - React-admin - Marmelab
React-admin provides a set of Input components, each one designed for a specific data type. Here is a list of the most common...
Read more >How to Use The Autocomplete Component in Material-UI
There are two versions of the autocomplete that can be used: Combo box — Where the value of the text input must be...
Read more >HTML attribute: autocomplete - MDN Web Docs
It is available on <input> elements that take a text or numeric value ... values if you do need to break the name...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
What you were expecting: The key of the component is the id or any specified field in “choice” object.
What happened instead: In console give ad error:
Steps to reproduce:
Related code:
Example CodeSandbox link
https://codesandbox.io/s/competent-moon-d7hlei
Environment
Please tell me how me can easily solve the problem in React-Admin. Where to look? In what PR?