-
Notifications
You must be signed in to change notification settings - Fork 47k
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
A few Suspense related refactors #25556
Merged
Merged
Conversation
This file contains 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
facebook-github-bot
added
CLA Signed
React Core Team
Opened by a member of the React Core Team
labels
Oct 24, 2022
Comparing: 5450dd4...d3705ee Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show |
acdlite
changed the title
In work loop, add enum of reasons for suspending
A few Suspense related refactors
Oct 24, 2022
acdlite
force-pushed
the
suspense-reason-enum
branch
2 times, most recently
from
October 24, 2022 19:18
9e4b112
to
1a70d38
Compare
sebmarkbage
reviewed
Oct 24, 2022
acdlite
force-pushed
the
suspense-reason-enum
branch
from
October 24, 2022 20:24
1a70d38
to
3d20fb6
Compare
sebmarkbage
approved these changes
Oct 24, 2022
acdlite
force-pushed
the
suspense-reason-enum
branch
2 times, most recently
from
October 25, 2022 15:09
b54bb03
to
c11c136
Compare
This is a pure refactor, no change to behavior. When a component throws, the work loop can handle that in one of several ways — unwind immediately, wait for microtasks, and so on. I'm about to add another one, too. So I've changed the variable that tracks whether the work loop is suspended from a boolean (workInProgressIsSuspended) to an enum (workInProgressSuspendedReason).
Refactors the logic for handling when the work loop is suspended into separate functions for replaying versus unwinding. This allows us to hoist certain checks into the caller. For example, when rendering due to flushSync, we will always unwind the stack without yielding the microtasks. No intentional behavior change in this commit.
Pure refactor, no change in behavior. Extracts the logic for detecting whether a suspended component will result in a "bad" Suspense fallback into a helper function. An example of a bad Suspense fallback is one that causes already-visible content to disappear. I want to reuse this same logic in the work loop, too.
acdlite
force-pushed
the
suspense-reason-enum
branch
from
October 29, 2022 00:02
c11c136
to
d3705ee
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Some Suspense-related refactors to prepare for a feature I'm working on. There are no behavioral changes. (Except for the first commit that adds a warning, which I opened as a separate PR: #25543. I can split the warning out if we're not sure we want to enable it yet.)
You can review each one commit-by-commit.