Skip to content

Commit

Permalink
[bug fix] revert values in ReactFiberFlags to keep consistency for de…
Browse files Browse the repository at this point in the history
…vtools (#25832)

## Summary

We see recent bug reports like #25755 and #25769 for devtools. Whenever
a component uses hook `useEffect`, it triggers an error.
This was introduced in #25663 when we try to keep the `ReactFiberFlags`
numbers consistent with reconciler, in order to fix an issue with server
components.
However, the values of `ReactFiberFlags` in reconciler were actually
changed a while ago in
b4204ed
We made this mistake because, although it's not mentioned in the
comment, `DidCapture` and `Hydrating` are actually used by DevTools

This caused
- the latest (not stable) react version is broken on devtools before
4.27.0 (but only in uncommon cases such server components)
- all earlier react versions are broken on latest devtools (4.27.0)

To keep most versions work, we need to revert the commit that changed
the `ReactFiberFlags` values

## How did you test this change?

1. add a `useEffect` in a component in the TodoList of the shell,
trigger the error in devtools
2. after change, the error is gone

DiffTrain build for `d69b2cf8208848b0f71b5214ddff55a1ff437cc8`
  • Loading branch information
mondaychen committed Dec 6, 2022
1 parent a591e1c commit a9aa724
Show file tree
Hide file tree
Showing 30 changed files with 1,572 additions and 1,516 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
645ae2686b157c9f80193e1ada75b7e00ef49acf
d69b2cf8208848b0f71b5214ddff55a1ff437cc8
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
645ae2686b157c9f80193e1ada75b7e00ef49acf
d69b2cf8208848b0f71b5214ddff55a1ff437cc8
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-classic-645ae2686-20221206";
var ReactVersion = "18.3.0-www-classic-d69b2cf82-20221206";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-modern-645ae2686-20221206";
var ReactVersion = "18.3.0-www-modern-d69b2cf82-20221206";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,4 +643,4 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-classic-645ae2686-20221206";
exports.version = "18.3.0-www-classic-d69b2cf82-20221206";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,4 +635,4 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-modern-645ae2686-20221206";
exports.version = "18.3.0-www-modern-d69b2cf82-20221206";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-classic-645ae2686-20221206";
exports.version = "18.3.0-www-classic-d69b2cf82-20221206";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-modern-645ae2686-20221206";
exports.version = "18.3.0-www-modern-d69b2cf82-20221206";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
54 changes: 30 additions & 24 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-classic-645ae2686-20221206";
var ReactVersion = "18.3.0-www-classic-d69b2cf82-20221206";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -517,41 +517,47 @@ var Placement =
2;
var DidCapture =
/* */
64;
128;
var Hydrating =
/* */
2048; // You can change the rest (and add more).
4096; // You can change the rest (and add more).

var Update =
/* */
4;
/* Skipped value: 0b000000000000000000000001000; */

var ChildDeletion =
/* */
8;
16;
var ContentReset =
/* */
16;
32;
var Callback =
/* */
32;
64;
/* Used by DidCapture: 0b000000000000000000010000000; */

var ForceClientRender =
/* */
128;
256;
var Ref =
/* */
256;
512;
var Snapshot =
/* */
512;
1024;
var Passive =
/* */
1024;
2048;
/* Used by Hydrating: 0b000000000000001000000000000; */

var Visibility =
/* */
4096;
8192;
var StoreConsistency =
/* */
8192;
16384;
var LifecycleEffectMask =
Passive | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit)

Expand All @@ -561,46 +567,46 @@ var HostEffectMask =

var Incomplete =
/* */
16384;
32768;
var ShouldCapture =
/* */
32768;
65536;
var ForceUpdateForLegacySuspense =
/* */
65536;
131072;
var DidPropagateContext =
/* */
131072;
262144;
var NeedsPropagation =
/* */
262144;
524288;
var Forked =
/* */
524288; // Static tags describe aspects of a fiber that are not specific to a render,
1048576; // Static tags describe aspects of a fiber that are not specific to a render,
// e.g. a fiber uses a passive effect (even if there are no updates on this particular render).
// This enables us to defer more work in the unmount case,
// since we can defer traversing the tree during layout to look for Passive effects,
// and instead rely on the static flag as a signal that there may be cleanup work.

var RefStatic =
/* */
1048576;
2097152;
var LayoutStatic =
/* */
2097152;
4194304;
var PassiveStatic =
/* */
4194304; // Flag used to identify newly inserted fibers. It isn't reset after commit unlike `Placement`.
8388608; // Flag used to identify newly inserted fibers. It isn't reset after commit unlike `Placement`.

var PlacementDEV =
/* */
8388608;
16777216;
var MountLayoutDev =
/* */
16777216;
33554432;
var MountPassiveDev =
/* */
33554432; // Groups of flags that are used in the commit phase to skip over trees that
67108864; // Groups of flags that are used in the commit phase to skip over trees that
// don't contain effects, by checking subtreeFlags.

var BeforeMutationMask = // TODO: Remove Update flag from before mutation phase by re-landing Visibility
Expand Down
54 changes: 30 additions & 24 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-modern-645ae2686-20221206";
var ReactVersion = "18.3.0-www-modern-d69b2cf82-20221206";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -517,41 +517,47 @@ var Placement =
2;
var DidCapture =
/* */
64;
128;
var Hydrating =
/* */
2048; // You can change the rest (and add more).
4096; // You can change the rest (and add more).

var Update =
/* */
4;
/* Skipped value: 0b000000000000000000000001000; */

var ChildDeletion =
/* */
8;
16;
var ContentReset =
/* */
16;
32;
var Callback =
/* */
32;
64;
/* Used by DidCapture: 0b000000000000000000010000000; */

var ForceClientRender =
/* */
128;
256;
var Ref =
/* */
256;
512;
var Snapshot =
/* */
512;
1024;
var Passive =
/* */
1024;
2048;
/* Used by Hydrating: 0b000000000000001000000000000; */

var Visibility =
/* */
4096;
8192;
var StoreConsistency =
/* */
8192;
16384;
var LifecycleEffectMask =
Passive | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit)

Expand All @@ -561,46 +567,46 @@ var HostEffectMask =

var Incomplete =
/* */
16384;
32768;
var ShouldCapture =
/* */
32768;
65536;
var ForceUpdateForLegacySuspense =
/* */
65536;
131072;
var DidPropagateContext =
/* */
131072;
262144;
var NeedsPropagation =
/* */
262144;
524288;
var Forked =
/* */
524288; // Static tags describe aspects of a fiber that are not specific to a render,
1048576; // Static tags describe aspects of a fiber that are not specific to a render,
// e.g. a fiber uses a passive effect (even if there are no updates on this particular render).
// This enables us to defer more work in the unmount case,
// since we can defer traversing the tree during layout to look for Passive effects,
// and instead rely on the static flag as a signal that there may be cleanup work.

var RefStatic =
/* */
1048576;
2097152;
var LayoutStatic =
/* */
2097152;
4194304;
var PassiveStatic =
/* */
4194304; // Flag used to identify newly inserted fibers. It isn't reset after commit unlike `Placement`.
8388608; // Flag used to identify newly inserted fibers. It isn't reset after commit unlike `Placement`.

var PlacementDEV =
/* */
8388608;
16777216;
var MountLayoutDev =
/* */
16777216;
33554432;
var MountPassiveDev =
/* */
33554432; // Groups of flags that are used in the commit phase to skip over trees that
67108864; // Groups of flags that are used in the commit phase to skip over trees that
// don't contain effects, by checking subtreeFlags.

var BeforeMutationMask = // TODO: Remove Update flag from before mutation phase by re-landing Visibility
Expand Down
Loading

0 comments on commit a9aa724

Please sign in to comment.