Skip to content

Commit a9aa724

Browse files
committed
[bug fix] revert values in ReactFiberFlags to keep consistency for devtools (#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`
1 parent a591e1c commit a9aa724

30 files changed

+1572
-1516
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
645ae2686b157c9f80193e1ada75b7e00ef49acf
1+
d69b2cf8208848b0f71b5214ddff55a1ff437cc8
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
645ae2686b157c9f80193e1ada75b7e00ef49acf
1+
d69b2cf8208848b0f71b5214ddff55a1ff437cc8

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

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

3232
// ATTENTION
3333
// When adding new symbols to this file,

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

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

3232
// ATTENTION
3333
// When adding new symbols to this file,

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,4 +643,4 @@ exports.useSyncExternalStore = function(
643643
);
644644
};
645645
exports.useTransition = useTransition;
646-
exports.version = "18.3.0-www-classic-645ae2686-20221206";
646+
exports.version = "18.3.0-www-classic-d69b2cf82-20221206";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,4 +635,4 @@ exports.useSyncExternalStore = function(
635635
);
636636
};
637637
exports.useTransition = useTransition;
638-
exports.version = "18.3.0-www-modern-645ae2686-20221206";
638+
exports.version = "18.3.0-www-modern-d69b2cf82-20221206";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ exports.useSyncExternalStore = function(
654654
);
655655
};
656656
exports.useTransition = useTransition;
657-
exports.version = "18.3.0-www-classic-645ae2686-20221206";
657+
exports.version = "18.3.0-www-classic-d69b2cf82-20221206";
658658

659659
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
660660
if (

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ exports.useSyncExternalStore = function(
646646
);
647647
};
648648
exports.useTransition = useTransition;
649-
exports.version = "18.3.0-www-modern-645ae2686-20221206";
649+
exports.version = "18.3.0-www-modern-d69b2cf82-20221206";
650650

651651
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
652652
if (

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
6969
return self;
7070
}
7171

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

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;
@@ -517,41 +517,47 @@ var Placement =
517517
2;
518518
var DidCapture =
519519
/* */
520-
64;
520+
128;
521521
var Hydrating =
522522
/* */
523-
2048; // You can change the rest (and add more).
523+
4096; // You can change the rest (and add more).
524524

525525
var Update =
526526
/* */
527527
4;
528+
/* Skipped value: 0b000000000000000000000001000; */
529+
528530
var ChildDeletion =
529531
/* */
530-
8;
532+
16;
531533
var ContentReset =
532534
/* */
533-
16;
535+
32;
534536
var Callback =
535537
/* */
536-
32;
538+
64;
539+
/* Used by DidCapture: 0b000000000000000000010000000; */
540+
537541
var ForceClientRender =
538542
/* */
539-
128;
543+
256;
540544
var Ref =
541545
/* */
542-
256;
546+
512;
543547
var Snapshot =
544548
/* */
545-
512;
549+
1024;
546550
var Passive =
547551
/* */
548-
1024;
552+
2048;
553+
/* Used by Hydrating: 0b000000000000001000000000000; */
554+
549555
var Visibility =
550556
/* */
551-
4096;
557+
8192;
552558
var StoreConsistency =
553559
/* */
554-
8192;
560+
16384;
555561
var LifecycleEffectMask =
556562
Passive | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit)
557563

@@ -561,46 +567,46 @@ var HostEffectMask =
561567

562568
var Incomplete =
563569
/* */
564-
16384;
570+
32768;
565571
var ShouldCapture =
566572
/* */
567-
32768;
573+
65536;
568574
var ForceUpdateForLegacySuspense =
569575
/* */
570-
65536;
576+
131072;
571577
var DidPropagateContext =
572578
/* */
573-
131072;
579+
262144;
574580
var NeedsPropagation =
575581
/* */
576-
262144;
582+
524288;
577583
var Forked =
578584
/* */
579-
524288; // Static tags describe aspects of a fiber that are not specific to a render,
585+
1048576; // Static tags describe aspects of a fiber that are not specific to a render,
580586
// e.g. a fiber uses a passive effect (even if there are no updates on this particular render).
581587
// This enables us to defer more work in the unmount case,
582588
// since we can defer traversing the tree during layout to look for Passive effects,
583589
// and instead rely on the static flag as a signal that there may be cleanup work.
584590

585591
var RefStatic =
586592
/* */
587-
1048576;
593+
2097152;
588594
var LayoutStatic =
589595
/* */
590-
2097152;
596+
4194304;
591597
var PassiveStatic =
592598
/* */
593-
4194304; // Flag used to identify newly inserted fibers. It isn't reset after commit unlike `Placement`.
599+
8388608; // Flag used to identify newly inserted fibers. It isn't reset after commit unlike `Placement`.
594600

595601
var PlacementDEV =
596602
/* */
597-
8388608;
603+
16777216;
598604
var MountLayoutDev =
599605
/* */
600-
16777216;
606+
33554432;
601607
var MountPassiveDev =
602608
/* */
603-
33554432; // Groups of flags that are used in the commit phase to skip over trees that
609+
67108864; // Groups of flags that are used in the commit phase to skip over trees that
604610
// don't contain effects, by checking subtreeFlags.
605611

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

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
6969
return self;
7070
}
7171

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

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;
@@ -517,41 +517,47 @@ var Placement =
517517
2;
518518
var DidCapture =
519519
/* */
520-
64;
520+
128;
521521
var Hydrating =
522522
/* */
523-
2048; // You can change the rest (and add more).
523+
4096; // You can change the rest (and add more).
524524

525525
var Update =
526526
/* */
527527
4;
528+
/* Skipped value: 0b000000000000000000000001000; */
529+
528530
var ChildDeletion =
529531
/* */
530-
8;
532+
16;
531533
var ContentReset =
532534
/* */
533-
16;
535+
32;
534536
var Callback =
535537
/* */
536-
32;
538+
64;
539+
/* Used by DidCapture: 0b000000000000000000010000000; */
540+
537541
var ForceClientRender =
538542
/* */
539-
128;
543+
256;
540544
var Ref =
541545
/* */
542-
256;
546+
512;
543547
var Snapshot =
544548
/* */
545-
512;
549+
1024;
546550
var Passive =
547551
/* */
548-
1024;
552+
2048;
553+
/* Used by Hydrating: 0b000000000000001000000000000; */
554+
549555
var Visibility =
550556
/* */
551-
4096;
557+
8192;
552558
var StoreConsistency =
553559
/* */
554-
8192;
560+
16384;
555561
var LifecycleEffectMask =
556562
Passive | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit)
557563

@@ -561,46 +567,46 @@ var HostEffectMask =
561567

562568
var Incomplete =
563569
/* */
564-
16384;
570+
32768;
565571
var ShouldCapture =
566572
/* */
567-
32768;
573+
65536;
568574
var ForceUpdateForLegacySuspense =
569575
/* */
570-
65536;
576+
131072;
571577
var DidPropagateContext =
572578
/* */
573-
131072;
579+
262144;
574580
var NeedsPropagation =
575581
/* */
576-
262144;
582+
524288;
577583
var Forked =
578584
/* */
579-
524288; // Static tags describe aspects of a fiber that are not specific to a render,
585+
1048576; // Static tags describe aspects of a fiber that are not specific to a render,
580586
// e.g. a fiber uses a passive effect (even if there are no updates on this particular render).
581587
// This enables us to defer more work in the unmount case,
582588
// since we can defer traversing the tree during layout to look for Passive effects,
583589
// and instead rely on the static flag as a signal that there may be cleanup work.
584590

585591
var RefStatic =
586592
/* */
587-
1048576;
593+
2097152;
588594
var LayoutStatic =
589595
/* */
590-
2097152;
596+
4194304;
591597
var PassiveStatic =
592598
/* */
593-
4194304; // Flag used to identify newly inserted fibers. It isn't reset after commit unlike `Placement`.
599+
8388608; // Flag used to identify newly inserted fibers. It isn't reset after commit unlike `Placement`.
594600

595601
var PlacementDEV =
596602
/* */
597-
8388608;
603+
16777216;
598604
var MountLayoutDev =
599605
/* */
600-
16777216;
606+
33554432;
601607
var MountPassiveDev =
602608
/* */
603-
33554432; // Groups of flags that are used in the commit phase to skip over trees that
609+
67108864; // Groups of flags that are used in the commit phase to skip over trees that
604610
// don't contain effects, by checking subtreeFlags.
605611

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

0 commit comments

Comments
 (0)