Skip to content
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

Merged

update the sigil only in __DEV__

  • Loading branch information...
threepointone committed May 29, 2019
commit 6d6419443e9a91e385437c183a659b17633bba0c
@@ -85,16 +85,19 @@ let actingUpdatesScopeDepth = 0;

function act(callback: () => Thenable) {
let previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
let previousActingUpdatesSigil = ReactActingRendererSigil.current;
let previousActingUpdatesSigil;
actingUpdatesScopeDepth++;
// we use the function flushPassiveEffects directly as the sigil,
// since it's unique to a renderer
ReactActingRendererSigil.current = flushPassiveEffects;
if (__DEV__) {
previousActingUpdatesSigil = ReactActingRendererSigil.current;
ReactActingRendererSigil.current = flushPassiveEffects;
This conversation was marked as resolved by threepointone

This comment has been minimized.

Copy link
@acdlite

acdlite May 29, 2019

Member

Could you use a separate export instead? I find this unnecessarily confusing for no benefit, given that it's dev-only.

}

function onDone() {
actingUpdatesScopeDepth--;
ReactActingRendererSigil.current = previousActingUpdatesSigil;
if (__DEV__) {
ReactActingRendererSigil.current = previousActingUpdatesSigil;
if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
// if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned
warningWithoutStack(
@@ -698,16 +698,19 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {

function act(callback: () => Thenable) {
let previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
let previousActingUpdatesSigil = ReactActingRendererSigil.current;
let previousActingUpdatesSigil;
actingUpdatesScopeDepth++;
// we use the function flushPassiveEffects directly as the sigil,
// since it's unique to a renderer
ReactActingRendererSigil.current = flushPassiveEffects;
if (__DEV__) {
previousActingUpdatesSigil = ReactActingRendererSigil.current;
ReactActingRendererSigil.current = flushPassiveEffects;
}

function onDone() {
actingUpdatesScopeDepth--;
ReactActingRendererSigil.current = previousActingUpdatesSigil;
if (__DEV__) {
ReactActingRendererSigil.current = previousActingUpdatesSigil;
if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
// if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned
warningWithoutStack(
@@ -66,16 +66,19 @@ let actingUpdatesScopeDepth = 0;

function act(callback: () => Thenable) {
let previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
let previousActingUpdatesSigil = ReactActingRendererSigil.current;
let previousActingUpdatesSigil;
actingUpdatesScopeDepth++;
// we use the function flushPassiveEffects directly as the sigil,
// since it's unique to a renderer
ReactActingRendererSigil.current = flushPassiveEffects;
if (__DEV__) {
previousActingUpdatesSigil = ReactActingRendererSigil.current;
ReactActingRendererSigil.current = flushPassiveEffects;
}

function onDone() {
actingUpdatesScopeDepth--;
ReactActingRendererSigil.current = previousActingUpdatesSigil;
if (__DEV__) {
ReactActingRendererSigil.current = previousActingUpdatesSigil;
if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
// if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned
warningWithoutStack(
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.