ReferenceArrayField is not passing data to child DataGrid or EditableDataGrid
See original GitHub issueWhat you were expecting: To have data fetched from ReferenceArrayField passed to the child EditableDataGrid
I am trying to display a datagrid of media of a product from a list of media ids. Using ReferenceArrayField component, the getMany() function of the media data provider is called. The fetching is working fine.
What happened instead: The data fetched is not passed by the ReferenceArrayField component to its child EditableDataGrid. I really don’t get what is happening here, might be a bug.
Steps to reproduce:
The resource mediaResource
is created, the ids mediasIds
are passed to the ReferenceArrayField
, the data is fetched. All the fetching works perfectly fine, but the ReferenceArrayField
is not passing the fetched data to its child.
The component:
function MediasList(): JSX.Element {
return (
<ReferenceArrayField fullWidth label="Médias" reference="mediaResource" source="mediasIds">
<EditableDatagrid
undoable
createForm={<MediasForm children={undefined} />}
editForm={<MediasForm children={undefined} />}
rowClick="edit"
hasCreate
>
<UrlField source="finalUrl" label="Miniature" target="_blank" />
<TextField source="id" />
</EditableDatagrid>
</ReferenceArrayField>
);
}
The edit page where the component is implemented:
<Edit {...props}>
<SimpleForm>
// Some irrelevant code here
<MediasList />
</SimpleForm>
</Edit>
Related code: The ReferenceArrayField doc: https://marmelab.com/react-admin/ReferenceArrayField.html
The EditableDataGrid doc: https://marmelab.com/ra-enterprise/modules/ra-editable-datagrid
Environment
React-admin version: 3.19.7 React version: 17.0.2 React Admin EditableDataGrid version: 2.2.0 Browser: Chrome
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
@WiXSL Actually the error is occuring even with DataGrid which is an open source component.
Customer has confirmed the problem has been figured out. (internal tracker issues 563 and 565) Closing issue.