I have a form for editing an Entity that hasMany
children. Within this form there's a ReferenceManyField
component. This component lists items along with an action button that I have created to let's say “approve” things.
<Edit>
<SimpleForm>
<ReferenceManyField reference="Expenses" target="expenseReportId" label="Expenses">
<Datagrid>
<UnassignButton />
<TextField source="name" />
</Datagrid>
</ReferenceManyField>
</SimpleForm>
</Edit>
UnassignButton performs a regular action:
const action = (id, data, basePath) => ({
type: 'EXPENSE_UNASSIGN',
payload: { id: id, data: { ...data, expenseReportId: null } },
meta: { resource: basePath, fetch: UPDATE, cancelPrevious: false },
})
How can I force the ReferenceManyField or the whole Edit form to be refreshed when this action is performed? What's the best practice for that?
Thanks!