-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
Don't warn about unmounted updates if pending passive unmount #18096
Don't warn about unmounted updates if pending passive unmount #18096
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
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.
stop using 'assign' for reviews you dork 🤪
return; | ||
} | ||
} | ||
|
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.
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.
Huh. Yeah for me me too.
Details of bundled changes.Comparing: 65bbda7...fbd5194 react-dom
react-art
Size changes (stable) |
Details of bundled changes.Comparing: 65bbda7...fbd5194 react-dom
react-art
Size changes (experimental) |
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.
Sorry. Rejecting until I get a chance to review :D
Some version of this is good though
) { | ||
// If there are pending passive effects unmounts for this Fiber, | ||
// we can assume that they would have prevented this update. | ||
if (pendingPassiveHookEffectsUnmount.includes(fiber)) { |
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.
Nit: includes
is a new-ish API, so use indexof
or something instead so this doesn't break in older browsers.
}); | ||
}); | ||
|
||
it('still warns about state updates for unmounted components with no pending passive unmounts', () => { |
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.
Can you add a test for when there's a pending unmount on a different component?
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.
Sure!
I'm personally OK with merging this but I do think we should continue to think about the other types of side effects that might occur in an unmount function but aren't a state update |
This change is narrowly scoped to only suppress warnings for things that happen between a committed unmount and flushing of passive effects. It won't block any warnings for anything else- including a |
I recently landed a change to the timing of passive effect cleanup functions during unmount (see facebook#17925). This change defers flushing of passive effects for unmounted components until later (whenever we next flush pending passive effects). Since this change increases the likelihood of a (not actionable) state update warning for unmounted components, I've suppressed that warning for Fibers that have scheduled passive effect unmounts pending.
f4be010
to
fbd5194
Compare
I recently landed a change to the timing of passive effect cleanup functions during unmount (see #17925). This change defers flushing of passive effects for unmounted components until later (whenever we next flush pending passive effects).
Since this change increases the likelihood of a (not actionable) state update warning for unmounted components, I've suppressed that warning for Fibers that have scheduled passive effect unmounts pending.