You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What you were expecting:
Optimistically return to index page, show error notification 'not found' once server responds with 404
What happened instead:
Optimistically returns to index page with 'undo' option as expected. But once server responds with 404, I get unhandled rejection.
Other information:
If I use undoable: false on my Edit component, the index view is not optimistically rendered and react admin correctly handles the HttpError with a 'not found' notification.
I'm using fetchUtils.fetchJson and returning a promise from update method on dataProvider. Per docs, I'm under the impression that react admin should handle http errors, and the fact that it does when undoable: false is evidence that I have it set up correctly.
Is the unhandled rejection that I'm seeing with the optimistic rendering the expected behavior for react admin?
Environment
React-admin version: 3.11.0
React version: 17.0.1
Browser: chrome (latest)
The text was updated successfully, but these errors were encountered:
The test case is simply that using the out-of-the-box edit action (with undoable: true) will throw an uncaught http error after it optimistically redirects back to list view when server responds to the put/patch with an error. I can do a sandbox at some point.
Right, it can be triggered in the simple example sandbox by editing a post, setting 'f00bar' as the title, saving, and waiting until the notification disappears.
It was introduced in #4291, where I used the same code for optimistic and non-optimistic calls. If it make sense to re-throw the error in non-optimistic mode (so that the dataProvider promise rejects), it doesn't make sense in optimistic mode, as the dataProvider promise already resolved. So the error musn't be rethrown in optimistic mode.
What you were expecting:
Optimistically return to index page, show error notification 'not found' once server responds with 404
What happened instead:
Optimistically returns to index page with 'undo' option as expected. But once server responds with 404, I get unhandled rejection.
Other information:
If I use
undoable: false
on my Edit component, the index view is not optimistically rendered and react admin correctly handles the HttpError with a 'not found' notification.I'm using
fetchUtils.fetchJson
and returning a promise fromupdate
method on dataProvider. Per docs, I'm under the impression that react admin should handle http errors, and the fact that it does whenundoable: false
is evidence that I have it set up correctly.Is the unhandled rejection that I'm seeing with the optimistic rendering the expected behavior for react admin?
Environment
The text was updated successfully, but these errors were encountered: