ArrayField + Datagrid: if embedded data doesn't have an id
, rows won't have a key
and will cause a React warning
#7541
Labels
id
, rows won't have a key
and will cause a React warning
#7541
What you were expecting:
Using an ArrayField + Datagrid for embedded data that doesn't have an
id
prop should work without console errorsWhat happened instead:
I get this error in the console:
Warning: Each child in a list should have a unique "key" prop.
Steps to reproduce:
Given this Show component for an "album" record:
Where an album has embedded features that look like this (note that
features
don't have anid
prop):Related code:
You can see repro this in the simple example (checked out and run locally; I don't see warnings in codesandbox's console)
Go to a post show page that has backlinks, e.g. http://localhost:8080/#/posts/12/show
Other information:
This is where the key is set based on the id, which doesn't exist in this case:
react-admin/packages/ra-ui-materialui/src/list/datagrid/DatagridBody.tsx
Line 48 in a408de0
Environment
The text was updated successfully, but these errors were encountered: