react-admin
react-admin copied to clipboard
ShowButton in ArrayField points to wrong route
What you were expecting:
ShowButton can be used in different scenarios when using references in Datagrid.
What happened instead:
ShowButton's route is incorrect when used in specific scenario described below.
Related code:
Showing list of images inside places reference and wanted to add ShowButton to link to images reference.
<ArrayField source="images" >
<Datagrid>
<TextField label="ID" source="id" />
...
<ShowButton basePath="images" />
</Datagrid>
</ArrayField>
This produces original reference show route with id if used without basePath (/places/<IMAGE_ID>/show) and append basePath and id to original reference path otherwise (/places/<PLACE_ID>/images/<IMAGE_ID>/show).
tried also (with or without basePath):
<ArrayField source="images" >
<Datagrid>
<TextField label="ID" source="id" />
...
<ReferenceField source="id" reference="media">
<ShowButton />
</ReferenceField>
<ShowButton basePath="images" />
</Datagrid>
</ArrayField>
This produces original reference show route with id (/places/<IMAGE_ID>/show) no matter basePath.
Environment
- React-admin version: 2.0.0-RC4
- React version: 16.3.2