-
Notifications
You must be signed in to change notification settings - Fork 50k
Fix: Stylesheet in error UI suspends indefinitely #27265
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1687,6 +1687,16 @@ export function shouldRemainOnPreviousScreen(): boolean { | |
| // takes into account both the priority of render and also whether showing a | ||
| // fallback would produce a desirable user experience. | ||
|
|
||
| const handler = getSuspenseHandler(); | ||
| if (handler === null) { | ||
| // There's no Suspense boundary that can provide a fallback. We have no | ||
| // choice but to remain on the previous screen. | ||
| // NOTE: We do this even for sync updates, for lack of any better option. In | ||
| // the future, we may change how we handle this, like by putting the whole | ||
| // root into a "detached" mode. | ||
| return true; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the actual fix. It used to return |
||
| } | ||
|
|
||
| // TODO: Once `use` has fully replaced the `throw promise` pattern, we should | ||
| // be able to remove the equivalent check in finishConcurrentRender, and rely | ||
| // just on this one. | ||
|
|
@@ -1705,29 +1715,22 @@ export function shouldRemainOnPreviousScreen(): boolean { | |
| } | ||
| } | ||
|
|
||
| const handler = getSuspenseHandler(); | ||
| if (handler === null) { | ||
| // TODO: We should support suspending in the case where there's no | ||
| // parent Suspense boundary, even outside a transition. Somehow. Otherwise, | ||
| // an uncached promise can fall into an infinite loop. | ||
| } else { | ||
| if ( | ||
| includesOnlyRetries(workInProgressRootRenderLanes) || | ||
| // In this context, an OffscreenLane counts as a Retry | ||
| // TODO: It's become increasingly clear that Retries and Offscreen are | ||
| // deeply connected. They probably can be unified further. | ||
| includesSomeLane(workInProgressRootRenderLanes, OffscreenLane) | ||
| ) { | ||
| // During a retry, we can suspend rendering if the nearest Suspense boundary | ||
| // is the boundary of the "shell", because we're guaranteed not to block | ||
| // any new content from appearing. | ||
| // | ||
| // The reason we must check if this is a retry is because it guarantees | ||
| // that suspending the work loop won't block an actual update, because | ||
| // retries don't "update" anything; they fill in fallbacks that were left | ||
| // behind by a previous transition. | ||
| return handler === getShellBoundary(); | ||
| } | ||
| if ( | ||
| includesOnlyRetries(workInProgressRootRenderLanes) || | ||
| // In this context, an OffscreenLane counts as a Retry | ||
| // TODO: It's become increasingly clear that Retries and Offscreen are | ||
| // deeply connected. They probably can be unified further. | ||
| includesSomeLane(workInProgressRootRenderLanes, OffscreenLane) | ||
| ) { | ||
| // During a retry, we can suspend rendering if the nearest Suspense boundary | ||
| // is the boundary of the "shell", because we're guaranteed not to block | ||
| // any new content from appearing. | ||
| // | ||
| // The reason we must check if this is a retry is because it guarantees | ||
| // that suspending the work loop won't block an actual update, because | ||
| // retries don't "update" anything; they fill in fallbacks that were left | ||
| // behind by a previous transition. | ||
| return handler === getShellBoundary(); | ||
| } | ||
|
|
||
| // For all other Lanes besides Transitions and Retries, we should not wait | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this into the branches above to avoid attaching a redundant listener to the "noop" thenable. That way we can treat any listener that does get attached as a mistake and warn in dev.