-
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
using the wrong renderer's act() should warn #15756
using the wrong renderer's act() should warn #15756
Conversation
…dates like it says. it uses a real object as the sigil (instead of just a boolean). specifically, it uses a renderer's flushPassiveEffects as the sigil. We also run tests for this separate from our main suite (which doesn't allow loading multiple renderers in a suite), but makes sure to run this in CI as well.
ReactDOM: size: 0.0%, gzip: 0.0% Details of bundled changes.Comparing: 401065f...c0dc398 react-dom
react-art
react-native-renderer
react-test-renderer
react-reconciler
Generated by 🚫 dangerJS |
updated the PR to use an explicit export (from |
if (__DEV__) { | ||
if ( | ||
ReactCurrentActingRendererSigil.current !== null && | ||
// use the function flushPassiveEffects directly as the sigil |
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
// so this comparison is expected here | ||
ReactCurrentActingRendererSigil.current !== ReactActingRendererSigil | ||
) { | ||
// it looks like we're using the wrong matching act(), so log a warning |
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 comment kinda repeats the warning?
"It looks like you're using the wrong act() around your test interactions.\n" + | ||
'Be sure to use the matching version of act() corresponding to your renderer:\n\n' + | ||
'// for react-dom:\n' + | ||
"import {act} from 'react-test-utils';\n" + |
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's no such package either 🤦♂️
via #15319
(redid #15399, removed the changes that didn't even belong in it.)
So tl;dr this PR -
This solves 2 specific problems -
(Please see #15399 for the long spiel on the mechanics for this.)