Bug: Unhandled promise rejection. Deferred response and redirects #12569
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added a failing test for remix-run/remix#10313
Bug Description
Remix server will crash due to an unhandled promise rejection if a loader returns a rejected promise and another part of the application has already issued a redirect response.
Test description
Fictional application that will list users of different organisations. The route
/organizations/meta/users
defined aswill display the organisation name in the parent
routes/organizations.tsx
and then show a list of users in an outlet fromroutes/organization-users.tsx
.If the user promise fails then this error is handled by the
Await
component and an error message is shown. This can be shown by visiting this organisation/organizations/justpark/users
The error will occur when visiting an organisation where the parent issues a redirect response. Visiting this page
/organizations/facebook/users
will successfully issue a redirect to themeta
organisation, but then the server will crash due to the rejected promise from the users loader.