-
-
Notifications
You must be signed in to change notification settings - Fork 10.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
Add unstable_flushSync option #11005
Conversation
🦋 Changeset detectedLatest commit: 3ed602e The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
} | ||
|
||
// flushSync + startViewTransition | ||
if (flushSync) { |
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 don't know if I could combine these two flows or not code-wise but for the first pass I just kept startViewTransition
/flushSync
entirely separate from startViewTransition
/startTransition
. They use the same local states, but the series of sequential effects are solely for startTransition
, while flushSync
does it all here - bang bang bang
// Interrupting an in-progress transition, cancel and let everything flush | ||
// out, and then kick off a new transition from the interruption state | ||
renderDfd.resolve(); | ||
renderDfd && renderDfd.resolve(); |
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.
This needs to be conditional since if we're interrupting a flushSync
view transition, we won't have a renderDfd
@@ -514,10 +576,10 @@ export function RouterProvider({ | |||
// When we start a view transition, create a Deferred we can use for the | |||
// eventual "completed" render | |||
React.useEffect(() => { | |||
if (vtContext.isTransitioning) { | |||
if (vtContext.isTransitioning && !vtContext.flushSync) { |
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.
This prevents us from ever kicking off the effect chain for flushSync
view transitions. No renderDfd
means the rest of the effects will no-op
@@ -916,7 +982,6 @@ export interface NavLinkProps | |||
style?: | |||
| React.CSSProperties | |||
| ((props: NavLinkRenderProps) => React.CSSProperties | undefined); | |||
unstable_viewTransition?: boolean; |
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.
This was a dup - already inherited from LinkProps
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
Closes #11003
Todo: