-
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
allow nested act()
s from different renderers
#16039
Merged
threepointone
merged 2 commits into
facebook:master
from
threepointone:nested-acts-take-2
Jul 2, 2019
Merged
allow nested act()
s from different renderers
#16039
threepointone
merged 2 commits into
facebook:master
from
threepointone:nested-acts-take-2
Jul 2, 2019
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
There are usecases where multiple renderers need to oprate inside an act() scope - ReactDOM.render being used inside another component tree. The parent component will be rendered using ReactTestRenderer.create for a snapshot test or something. - a ReactDOM instance interacting with a ReactTestRenderer instance (like for the new devtools) This PR changes the way the acting sigils operate to allow for this. It keeps 2 booleans, one attached to React, one attached to the renderer. act() changes these values, and the workloop reads them to decide what warning to trigger. I also renamed shouldWarnUnactedUpdates to warnsIfNotActing
ReactDOM: size: 0.0%, gzip: -0.0% Details of bundled changes.Comparing: a865e4a...c0ab465 react-dom
react-reconciler
Generated by 🚫 dangerJS |
acdlite
approved these changes
Jul 2, 2019
threepointone
added a commit
to threepointone/react
that referenced
this pull request
Jul 3, 2019
I missed this in facebook#16039. I'd pointed at the wrong previous state, corrupting it in further use. This PR fixes that, and adds a test to make sure it doesn't happen again.
threepointone
added a commit
to threepointone/react
that referenced
this pull request
Jul 3, 2019
I missed this in facebook#16039. I'd pointed at the wrong previous state, corrupting it in further use. This PR fixes that, and adds a test to make sure it doesn't happen again.
threepointone
added a commit
to threepointone/react
that referenced
this pull request
Jul 3, 2019
I missed this in facebook#16039. I'd pointed at the wrong previous state, corrupting it in further use. This PR fixes that, and adds a test to make sure it doesn't happen again.
threepointone
added a commit
that referenced
this pull request
Jul 3, 2019
* [fail] reset IsThisRendererActing correctly I missed this in #16039. I'd pointed at the wrong previous state, corrupting it in further use. This PR fixes that, and adds a test to make sure it doesn't happen again. * warn for unacted effects only in strict mode
trueadm
pushed a commit
to trueadm/react
that referenced
this pull request
Jul 3, 2019
* allow nested `act()`s from different renderers There are usecases where multiple renderers need to oprate inside an act() scope - ReactDOM.render being used inside another component tree. The parent component will be rendered using ReactTestRenderer.create for a snapshot test or something. - a ReactDOM instance interacting with a ReactTestRenderer instance (like for the new devtools) This PR changes the way the acting sigils operate to allow for this. It keeps 2 booleans, one attached to React, one attached to the renderer. act() changes these values, and the workloop reads them to decide what warning to trigger. I also renamed shouldWarnUnactedUpdates to warnsIfNotActing * s/ReactIsActing/IsSomeRendererActing and s/ReactRendererIsActing/IsThisRendererActing
trueadm
pushed a commit
to trueadm/react
that referenced
this pull request
Jul 3, 2019
* [fail] reset IsThisRendererActing correctly I missed this in facebook#16039. I'd pointed at the wrong previous state, corrupting it in further use. This PR fixes that, and adds a test to make sure it doesn't happen again. * warn for unacted effects only in strict mode
gaearon
reviewed
Jul 4, 2019
@@ -823,7 +823,7 @@ const ReactDOM: Object = { | |||
dispatchEvent, | |||
runEventsInBatch, | |||
flushPassiveEffects, | |||
ReactActingRendererSigil, | |||
IsThisRendererActing, |
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.
threepointone
added a commit
to threepointone/react
that referenced
this pull request
Jul 11, 2019
after facebook#16039, act was broken for umd builds. This PR fixes it.
threepointone
added a commit
to threepointone/react
that referenced
this pull request
Jul 11, 2019
after facebook#16039, act was broken for umd builds. This PR fixes it.
threepointone
pushed a commit
that referenced
this pull request
Jul 11, 2019
after #16039, act was broken for umd builds. This PR fixes it.
Merged
This was referenced Aug 17, 2019
This was referenced Mar 10, 2020
This was referenced Mar 18, 2020
renawolford6
added a commit
to renawolford6/react-shallow-renderer
that referenced
this pull request
Nov 10, 2022
* [fail] reset IsThisRendererActing correctly I missed this in facebook/react#16039. I'd pointed at the wrong previous state, corrupting it in further use. This PR fixes that, and adds a test to make sure it doesn't happen again. * warn for unacted effects only in strict mode
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.
(an alternative to #15816)
There are usecases where multiple renderers need to operate inside a single
act()
scope.ReactDOM.render
being used inside another component tree. The parent component will be rendered usingReactTestRenderer.create
for a snapshot test or something.This PR changes the way the acting sigils operate to allow for this. It keeps 2 booleans, one attached to React, one attached to the renderer.
act()
changes these values, and the workloop reads them to decide which warning to trigger.(I also renamed
shouldWarnUnactedUpdates
towarnsIfNotActing
)