-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
[Fiber] Schedule passive effects using the regular ensureRootIsScheduled flow #31785
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -595,7 +597,7 @@ describe('useSubscription', () => { | |||
React.startTransition(() => { | |||
mutate('C'); | |||
}); | |||
await waitFor(['render:first:C', 'render:second:C']); |
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'm not sure about the intended semantics of waitFor
but I'm confused it doesn't wait just as long or longer than waitForPaint
.
@@ -755,10 +755,16 @@ describe('ReactExpiration', () => { | |||
|
|||
// The update finishes without yielding. But it does not flush the effect. | |||
await waitFor(['B1'], { | |||
additionalLogsAfterAttemptingToYield: ['C1'], | |||
additionalLogsAfterAttemptingToYield: gate( |
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'm not sure what the expected semantics of this helper is and whether this change is expected.
@@ -911,9 +911,7 @@ describe('ReactDOMSelect', () => { | |||
const container = document.createElement('div'); | |||
const root = ReactDOMClient.createRoot(container); | |||
async function changeView() { | |||
await act(() => { |
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 triggers the interleave act warning but that should've already happened before since the dispatch is wrapped by act. So this is fixing something but not sure why this wasn't already erroring before.
Comparing: f5077bc...63391b6 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
|
3dee103
to
49e51b2
Compare
This treats workInProgressRoot work and rootWithPendingPassiveEffects the same way. Basically as long as there's some work on the root, yield the current task. Including passive effects.
The ReactDOMSelect has an overlapping act error but I don't know why that wasn't erroring before. I also don't get why waitFor isn't enough for useSubscription. Nor why ReactExpiration changes. What does the additionalLogsAfterAttemptingToYield helper do?
49e51b2
to
9b7be25
Compare
…led flow (#31785) This treats workInProgressRoot work and rootWithPendingPassiveEffects the same way. Basically as long as there's some work on the root, yield the current task. Including passive effects. This means that passive effects are now a continuation instead of a separate callback. This can mean they're earlier or later than before. Later for Idle in case there's other non-React work. Earlier for same Default if there's other Default priority work. This makes sense since increasing priority of the passive effects beyond Idle doesn't really make sense for an Idle render. However, for any given render at same priority it's more important to complete this work than start something new. Since we special case continuations to always yield to the browser, this has the same effect as #31784 without implementing `requestPaint`. At least assuming nothing else calls `requestPaint`. <img width="587" alt="Screenshot 2024-12-14 at 5 37 37 PM" src="https://github.com/user-attachments/assets/8641b172-8842-4191-8bf0-50cbe263a30c" /> DiffTrain build for [facec3e](facec3e)
…led flow (#31785) This treats workInProgressRoot work and rootWithPendingPassiveEffects the same way. Basically as long as there's some work on the root, yield the current task. Including passive effects. This means that passive effects are now a continuation instead of a separate callback. This can mean they're earlier or later than before. Later for Idle in case there's other non-React work. Earlier for same Default if there's other Default priority work. This makes sense since increasing priority of the passive effects beyond Idle doesn't really make sense for an Idle render. However, for any given render at same priority it's more important to complete this work than start something new. Since we special case continuations to always yield to the browser, this has the same effect as #31784 without implementing `requestPaint`. At least assuming nothing else calls `requestPaint`. <img width="587" alt="Screenshot 2024-12-14 at 5 37 37 PM" src="https://github.com/user-attachments/assets/8641b172-8842-4191-8bf0-50cbe263a30c" /> DiffTrain build for [facec3e](facec3e)
…led flow (facebook#31785) This treats workInProgressRoot work and rootWithPendingPassiveEffects the same way. Basically as long as there's some work on the root, yield the current task. Including passive effects. This means that passive effects are now a continuation instead of a separate callback. This can mean they're earlier or later than before. Later for Idle in case there's other non-React work. Earlier for same Default if there's other Default priority work. This makes sense since increasing priority of the passive effects beyond Idle doesn't really make sense for an Idle render. However, for any given render at same priority it's more important to complete this work than start something new. Since we special case continuations to always yield to the browser, this has the same effect as facebook#31784 without implementing `requestPaint`. At least assuming nothing else calls `requestPaint`. <img width="587" alt="Screenshot 2024-12-14 at 5 37 37 PM" src="https://github.com/user-attachments/assets/8641b172-8842-4191-8bf0-50cbe263a30c" /> DiffTrain build for [facec3e](facebook@facec3e)
…led flow (facebook#31785) This treats workInProgressRoot work and rootWithPendingPassiveEffects the same way. Basically as long as there's some work on the root, yield the current task. Including passive effects. This means that passive effects are now a continuation instead of a separate callback. This can mean they're earlier or later than before. Later for Idle in case there's other non-React work. Earlier for same Default if there's other Default priority work. This makes sense since increasing priority of the passive effects beyond Idle doesn't really make sense for an Idle render. However, for any given render at same priority it's more important to complete this work than start something new. Since we special case continuations to always yield to the browser, this has the same effect as facebook#31784 without implementing `requestPaint`. At least assuming nothing else calls `requestPaint`. <img width="587" alt="Screenshot 2024-12-14 at 5 37 37 PM" src="https://github.com/user-attachments/assets/8641b172-8842-4191-8bf0-50cbe263a30c" /> DiffTrain build for [facec3e](facebook@facec3e)
#31785 turned on `enableYieldingBeforePassive` for the internal test renderer builds. We have some failing tests on the RN side blocking the sync so lets turn these off for now.
This treats workInProgressRoot work and rootWithPendingPassiveEffects the same way. Basically as long as there's some work on the root, yield the current task. Including passive effects. This means that passive effects are now a continuation instead of a separate callback. This can mean they're earlier or later than before. Later for Idle in case there's other non-React work. Earlier for same Default if there's other Default priority work.
This makes sense since increasing priority of the passive effects beyond Idle doesn't really make sense for an Idle render.
However, for any given render at same priority it's more important to complete this work than start something new.
Since we special case continuations to always yield to the browser, this has the same effect as #31784 without implementing
requestPaint
. At least assuming nothing else callsrequestPaint
.