-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
allow nested act()
s from different renderers
#15816
Conversation
No significant bundle size changes to report. Generated by 🚫 dangerJS |
[outdated] |
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 really like this solution, but rather than bikeshedding it, I would prefer if we first land a PR that forces Suspense fallbacks to commit at the end of act
, because that will likely involve architectural changes that affect how we implement this PR.
*/ | ||
|
||
const ReactCurrentActingRendererSigil = { | ||
current: (null: null | (() => boolean)), | ||
current: ([]: Array<{}>), |
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 is conceptually a Set, not an Array, so (assuming this is the approach we go with) let's make it an Set.
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 started this with a Set, until I realized it's not one. It's a stack. Consider when leaving an act() scope, if it was a Set, how could I know if the sigil has to be removed from the set?
976e5b3
to
3274578
Compare
act()
s from different renderersact()
s from different renderers
Open question - At what point should flushPassiveEffects be called? On exiting the last act of any type? Or for a given type? |
3274578
to
ee3d60e
Compare
sometimes apps can be made wtih multiple renderers. a specific usecase is react-art embedded inside react-dom. in these cases, we want to be able to wrap an update with acts corrsponding to both the renderers. In this PR, we change ReactCurrentActingRendererSigil to hold a stack of sigils (instead of just the current active one), pushing and popping onto it as required. This commit also fixes the dom fixtures tests, which were broken? ugh.
ee3d60e
to
d17c220
Compare
abandoning this for #16039 |
Sometimes apps can be tested with multiple renderers at once. Examples -
This PR is for the other 2 usecases. It replaces the sigil reference with a stack that holds all sigils as act scopes open/close, and compares against the stack for when to show the missing act() warning.
Open question - At what point should flushPassiveEffects be called? On exiting the last act of any type? Or for a given type?