react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

Tiny bug in Advanced Tutorial "Custom Forms and UI for related records" error handling

Open Bossieh opened this issue 4 years ago • 2 comments

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');
                }
            }
        );
    };
    ...

Bossieh avatar May 18 '21 07:05 Bossieh

Thanks for the report

djhi avatar May 18 '21 07:05 djhi

@djhi. This is a bug in a code sandbox related to one of the articles. Could you change it?

WiXSL avatar Mar 24 '22 19:03 WiXSL