Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix BC break v4: useCreate and useUpdate can return a promise #7234

Merged
merged 1 commit into from
Feb 15, 2022

Conversation

alanpoulain
Copy link
Contributor

Related PR: #5778.

To be able to handle correctly submission validation errors, the returned functions from useCreate and useUpdate need to be able to return a promise.
Only then doing like it is described in the documentation would be possible:

react-admin/docs/CreateEdit.md

Lines 1524 to 1531 in efc8969

try {
await create('users', { data: values });
} catch (error) {
if (error.body.errors) {
// The shape of the returned validation errors must match the shape of the form
return error.body.errors;
}
}

@fzaninotto fzaninotto merged commit 545a704 into marmelab:next Feb 15, 2022
@fzaninotto
Copy link
Member

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants