react-admin
react-admin copied to clipboard
Tiny bug in Advanced Tutorial "Custom Forms and UI for related records" error handling
Took me a while to figure out, I am using:
- "react": "17.0.2",
- "react-admin": "3.15.0"
https://codesandbox.io/s/react-admin-v3-advanced-recipes-quick-createpreview-voyci?file=/src/comments/PostQuickCreateButton.js
...
const handleSubmit = async values => {
create(
{ payload: { data: values } },
{
onSuccess: ({ data }) => {
setShowDialog(false);
// Update the comment form to target the newly created post
// Updating the ReferenceInput value will force it to reload the available posts
form.change('post_id', data.id);
onChange();
},
onFailure: ({ error }) => { // <----- should be onFailure: (error) => (without the curly braces)
notify(error.message, 'error');
}
}
);
};
...
Thanks for the report
@djhi. This is a bug in a code sandbox related to one of the articles. Could you change it?