-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Error on update/patch call crashes the UI #4276
Comments
Your dataProvider should not throw an error, but return a failed promise. I realize the documentation is misleading on this point, so I'm marking this as a documentation issue. |
Thank you. |
The behavior in case the dataProvider throws isn't specified. It's supposed to return a Promise. |
I understand that the dataProvider should return a rejected promise on errors instead of throwing, but I think what @salauddinn is seeing here is a possible bug. Please have a look at the following example: https://codesandbox.io/s/nifty-brahmagupta-963kt I believe create and update behave differently here because the update, in our case, is executing the @fzaninotto you'll be able to understand the code better, but it seems like something is expecting this line to throw a string not an object. If you change that line from |
Indeed, I'll take a look. Thanks for the sandbox! |
I can't reproduce the error with the update on master. Perhaps it's already been fixed since 3.0? |
The error that appears on CodeSandbox is actually an artifact of CodeSandbox. It's because useDataProvider returns a rejected Promise when the dataProvider fails. It doesn't happen outside of CodeSandbox, in development as in production. I consider that #4291 fixes this issue, so I'm closing it. Thanks for the report! |
What you were expecting:
Expecting Not to crash the ui when dataProvider update throws error.
What happened instead:
When error dataProvider update throws error ui is crashing. where in the case of create it was handled.
Steps to reproduce:
Uncaught Conflict
.where as create works fine on error thrown
Related code:
https://codesandbox.io/s/pedantic-stonebraker-4twty
Environment
`Conflict
The text was updated successfully, but these errors were encountered: