onSuccess
function does not work properly on react-admin
,
my code:
const onSuccess = () => {
redirect('list', props.basePath);
};
<Edit
onFailure={onFailure}
onSuccess={onSuccess}
title="Ediar Usuário"
{...props}
>
<SimpleForm
variant="standard"
toolbar={<CustomToolbar />}
>
</Edit>
On the first time, it works perfectly but at second time, nothing happens.
Do not even trigger the save event
I don't know if this is applicable to your use case but setting undoable
to false on Edit
component works
I am suffering from the same problem.
Jasper Bernales's tip was effective.
I've changed my code from :
<Edit
onSuccess={onSuccess}
{...props}
>
to :
<Edit
onSuccess={onSuccess}
undoable={false}
{...props}
>
then ...it works!
It seems like a problem caused by forcing "useRedirect" or "useRefresh" to interfere with the delay scheduled by "undoable".The document seems to need an update to this part. just check this out from React-Admin Docs.:
You can disable this behavior by setting undoable={false}. With that setting, clicking on the Delete button displays a confirmation dialog. Both the Save and the Delete actions become blocking and delay the refresh of the screen until the data provider responds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With