-
Notifications
You must be signed in to change notification settings - Fork 49.8k
using the wrong renderer's act() should warn #15756
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
Merged
threepointone
merged 6 commits into
facebook:master
from
threepointone:wrong-renderer-act-warning
May 29, 2019
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5b186a6
warn when using the wrong renderer's act around another renderer's up…
threepointone e789900
unneeded (and wrong) comment
threepointone a2dae63
run the dom fixture on CI
threepointone 6d64194
update the sigil only in __DEV__
threepointone 669d92e
remove the obnoxious comment
threepointone c0dc398
use an explicit export for the sigil
threepointone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
use an explicit export for the sigil
- Loading branch information
commit c0dc3989e8c40595610d684636f9b32e1c5d0754
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,7 +173,7 @@ const ceil = Math.ceil; | |
| const { | ||
| ReactCurrentDispatcher, | ||
| ReactCurrentOwner, | ||
| ReactActingRendererSigil, | ||
| ReactCurrentActingRendererSigil, | ||
| } = ReactSharedInternals; | ||
|
|
||
| type WorkPhase = 0 | 1 | 2 | 3 | 4 | 5 | 6; | ||
|
|
@@ -2276,13 +2276,19 @@ function warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber) { | |
| } | ||
| } | ||
|
|
||
| // We export a simple object here to be used by a renderer/test-utils | ||
| // as the value of ReactCurrentActingRendererSigil.current | ||
| // This identity lets us identify (ha!) when the wrong renderer's act() | ||
| // wraps anothers' updates/effects | ||
| export const ReactActingRendererSigil = {}; | ||
|
|
||
| export function warnIfNotScopedWithMatchingAct(fiber: Fiber): void { | ||
| if (__DEV__) { | ||
| if ( | ||
| ReactActingRendererSigil.current !== null && | ||
| ReactCurrentActingRendererSigil.current !== null && | ||
| // use the function flushPassiveEffects directly as the sigil | ||
| // so this comparison is expected here | ||
| ReactActingRendererSigil.current !== flushPassiveEffects | ||
| ReactCurrentActingRendererSigil.current !== ReactActingRendererSigil | ||
| ) { | ||
| // it looks like we're using the wrong matching act(), so log a warning | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment kinda repeats the warning? |
||
| warningWithoutStack( | ||
|
|
@@ -2309,7 +2315,7 @@ function warnIfNotCurrentlyActingUpdatesInDEV(fiber: Fiber): void { | |
| if (__DEV__) { | ||
| if ( | ||
| workPhase === NotWorking && | ||
| ReactActingRendererSigil.current !== flushPassiveEffects | ||
| ReactCurrentActingRendererSigil.current !== ReactActingRendererSigil | ||
| ) { | ||
| warningWithoutStack( | ||
| false, | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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.
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.
Outdated comment