Skip to content

Commit 72e3e57

Browse files
committed
Use the disableLegacyMode where ever we check the ConcurrentMode mode (#28657)
Saves some bytes and ensures that we're actually disabling it. Turns out this flag wasn't disabling React Native/Fabric, React Noop and React ART legacy modes so those are updated too. Should be rebased on #28681. DiffTrain build for [5de8703](5de8703)
1 parent 8d925e2 commit 72e3e57

19 files changed

+274
-150
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5998a775194f491afa5d3badd9afe9ceaf12845e
1+
5de8703646cdd3838cb1686f761b10c0692743aa

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

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (__DEV__) {
2424
) {
2525
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2626
}
27-
var ReactVersion = "19.0.0-www-classic-c27d3e58";
27+
var ReactVersion = "19.0.0-www-classic-279ec326";
2828

2929
// ATTENTION
3030
// When adding new symbols to this file,
@@ -404,6 +404,7 @@ if (__DEV__) {
404404
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
405405
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp;
406406
// On WWW, false is used for a new modern build.
407+
var disableLegacyMode = false;
407408

408409
/*
409410
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
@@ -3281,7 +3282,10 @@ if (__DEV__) {
32813282
// triggered during an async event, because this is how the legacy
32823283
// implementation of `act` behaved.
32833284

3284-
ReactCurrentActQueue.isBatchingLegacy = true;
3285+
{
3286+
ReactCurrentActQueue.isBatchingLegacy = true;
3287+
}
3288+
32853289
var result; // This tracks whether the `act` call is awaited. In certain cases, not
32863290
// awaiting it is a mistake, so we will detect that and warn.
32873291

@@ -3291,10 +3295,14 @@ if (__DEV__) {
32913295
// Reset this to `false` right before entering the React work loop. The
32923296
// only place we ever read this fields is just below, right after running
32933297
// the callback. So we don't need to reset after the callback runs.
3294-
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
3298+
if (!disableLegacyMode) {
3299+
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
3300+
}
3301+
32953302
result = callback();
3296-
var didScheduleLegacyUpdate =
3297-
ReactCurrentActQueue.didScheduleLegacyUpdate; // Replicate behavior of original `act` implementation in legacy mode,
3303+
var didScheduleLegacyUpdate = !disableLegacyMode
3304+
? ReactCurrentActQueue.didScheduleLegacyUpdate
3305+
: false; // Replicate behavior of original `act` implementation in legacy mode,
32983306
// which flushed updates immediately after the scope function exits, even
32993307
// if it's an async function.
33003308

@@ -3305,7 +3313,9 @@ if (__DEV__) {
33053313
// that's how it worked before version 18. Yes, it's confusing! We should
33063314
// delete legacy mode!!
33073315

3308-
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
3316+
if (!disableLegacyMode) {
3317+
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
3318+
}
33093319
} catch (error) {
33103320
// `isBatchingLegacy` gets reset using the regular stack, not the async
33113321
// one used to track `act` scopes. Why, you may be wondering? Because
@@ -3315,7 +3325,10 @@ if (__DEV__) {
33153325
}
33163326

33173327
if (ReactCurrentActQueue.thrownErrors.length > 0) {
3318-
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
3328+
{
3329+
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
3330+
}
3331+
33193332
popActScope(prevActQueue, prevActScopeDepth);
33203333
var thrownError = aggregateErrors(ReactCurrentActQueue.thrownErrors);
33213334
ReactCurrentActQueue.thrownErrors.length = 0;

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

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (__DEV__) {
2424
) {
2525
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2626
}
27-
var ReactVersion = "19.0.0-www-modern-5ccfe516";
27+
var ReactVersion = "19.0.0-www-modern-e4b79a21";
2828

2929
// ATTENTION
3030
// When adding new symbols to this file,
@@ -404,6 +404,7 @@ if (__DEV__) {
404404
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
405405
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp;
406406
// On WWW, true is used for a new modern build.
407+
var disableLegacyMode = false;
407408

408409
/*
409410
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
@@ -3281,7 +3282,10 @@ if (__DEV__) {
32813282
// triggered during an async event, because this is how the legacy
32823283
// implementation of `act` behaved.
32833284

3284-
ReactCurrentActQueue.isBatchingLegacy = true;
3285+
{
3286+
ReactCurrentActQueue.isBatchingLegacy = true;
3287+
}
3288+
32853289
var result; // This tracks whether the `act` call is awaited. In certain cases, not
32863290
// awaiting it is a mistake, so we will detect that and warn.
32873291

@@ -3291,10 +3295,14 @@ if (__DEV__) {
32913295
// Reset this to `false` right before entering the React work loop. The
32923296
// only place we ever read this fields is just below, right after running
32933297
// the callback. So we don't need to reset after the callback runs.
3294-
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
3298+
if (!disableLegacyMode) {
3299+
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
3300+
}
3301+
32953302
result = callback();
3296-
var didScheduleLegacyUpdate =
3297-
ReactCurrentActQueue.didScheduleLegacyUpdate; // Replicate behavior of original `act` implementation in legacy mode,
3303+
var didScheduleLegacyUpdate = !disableLegacyMode
3304+
? ReactCurrentActQueue.didScheduleLegacyUpdate
3305+
: false; // Replicate behavior of original `act` implementation in legacy mode,
32983306
// which flushed updates immediately after the scope function exits, even
32993307
// if it's an async function.
33003308

@@ -3305,7 +3313,9 @@ if (__DEV__) {
33053313
// that's how it worked before version 18. Yes, it's confusing! We should
33063314
// delete legacy mode!!
33073315

3308-
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
3316+
if (!disableLegacyMode) {
3317+
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
3318+
}
33093319
} catch (error) {
33103320
// `isBatchingLegacy` gets reset using the regular stack, not the async
33113321
// one used to track `act` scopes. Why, you may be wondering? Because
@@ -3315,7 +3325,10 @@ if (__DEV__) {
33153325
}
33163326

33173327
if (ReactCurrentActQueue.thrownErrors.length > 0) {
3318-
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
3328+
{
3329+
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
3330+
}
3331+
33193332
popActScope(prevActQueue, prevActScopeDepth);
33203333
var thrownError = aggregateErrors(ReactCurrentActQueue.thrownErrors);
33213334
ReactCurrentActQueue.thrownErrors.length = 0;

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

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (__DEV__) {
6666
return self;
6767
}
6868

69-
var ReactVersion = "19.0.0-www-classic-1a37f8de";
69+
var ReactVersion = "19.0.0-www-classic-e7863b04";
7070

7171
var LegacyRoot = 0;
7272
var ConcurrentRoot = 1;
@@ -195,6 +195,7 @@ if (__DEV__) {
195195
var enableAsyncActions = true;
196196

197197
var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
198+
var disableLegacyMode = false;
198199

199200
var FunctionComponent = 0;
200201
var ClassComponent = 1;
@@ -490,11 +491,15 @@ if (__DEV__) {
490491

491492
case TracingMarkerComponent:
492493
return "TracingMarker";
493-
// The display name for this tags come from the user-provided type:
494+
// The display name for these tags come from the user-provided type:
495+
496+
case IncompleteClassComponent:
497+
case IncompleteFunctionComponent:
498+
499+
// Fallthrough
494500

495501
case ClassComponent:
496502
case FunctionComponent:
497-
case IncompleteClassComponent:
498503
case MemoComponent:
499504
case SimpleMemoComponent:
500505
if (typeof type === "function") {
@@ -4749,7 +4754,9 @@ if (__DEV__) {
47494754
function flushSyncWorkOnLegacyRootsOnly() {
47504755
// This is allowed to be called synchronously, but the caller should check
47514756
// the execution context first.
4752-
flushSyncWorkAcrossRoots_impl(true);
4757+
{
4758+
flushSyncWorkAcrossRoots_impl(true);
4759+
}
47534760
}
47544761

47554762
function flushSyncWorkAcrossRoots_impl(onlyLegacy) {
@@ -20490,10 +20497,11 @@ if (__DEV__) {
2049020497
var newProps = workInProgress.pendingProps; // Note: This intentionally doesn't check if we're hydrating because comparing
2049120498

2049220499
switch (workInProgress.tag) {
20500+
case IncompleteFunctionComponent:
20501+
2049320502
case LazyComponent:
2049420503
case SimpleMemoComponent:
2049520504
case FunctionComponent:
20496-
case IncompleteFunctionComponent:
2049720505
case ForwardRef:
2049820506
case Fragment:
2049920507
case Mode:
@@ -20849,8 +20857,8 @@ if (__DEV__) {
2084920857
return null;
2085020858

2085120859
case IncompleteClassComponent: {
20852-
// Same as class component case. I put it down here so that the tags are
2085320860
// sequential to ensure this switch is compiled to a jump table.
20861+
2085420862
var _Component = workInProgress.type;
2085520863

2085620864
if (isContextProvider(_Component)) {
@@ -26221,6 +26229,7 @@ if (__DEV__) {
2622126229
if (
2622226230
lane === SyncLane &&
2622326231
executionContext === NoContext &&
26232+
!disableLegacyMode &&
2622426233
(fiber.mode & ConcurrentMode) === NoMode
2622526234
) {
2622626235
if (ReactCurrentActQueue.isBatchingLegacy);
@@ -26789,6 +26798,7 @@ if (__DEV__) {
2678926798
// next event, not at the end of the previous one.
2679026799
if (
2679126800
rootWithPendingPassiveEffects !== null &&
26801+
!disableLegacyMode &&
2679226802
rootWithPendingPassiveEffects.tag === LegacyRoot &&
2679326803
(executionContext & (RenderContext | CommitContext)) === NoContext
2679426804
) {
@@ -30427,14 +30437,16 @@ if (__DEV__) {
3042730437
}
3042830438

3042930439
{
30430-
switch (tag) {
30431-
case ConcurrentRoot:
30432-
this._debugRootType = hydrate ? "hydrateRoot()" : "createRoot()";
30433-
break;
30440+
{
30441+
switch (tag) {
30442+
case ConcurrentRoot:
30443+
this._debugRootType = hydrate ? "hydrateRoot()" : "createRoot()";
30444+
break;
3043430445

30435-
case LegacyRoot:
30436-
this._debugRootType = hydrate ? "hydrate()" : "render()";
30437-
break;
30446+
case LegacyRoot:
30447+
this._debugRootType = hydrate ? "hydrate()" : "render()";
30448+
break;
30449+
}
3043830450
}
3043930451
}
3044030452
}

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

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (__DEV__) {
6666
return self;
6767
}
6868

69-
var ReactVersion = "19.0.0-www-modern-d5826a7d";
69+
var ReactVersion = "19.0.0-www-modern-f0fe1a8a";
7070

7171
var LegacyRoot = 0;
7272
var ConcurrentRoot = 1;
@@ -195,6 +195,7 @@ if (__DEV__) {
195195
var enableAsyncActions = true;
196196

197197
var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
198+
var disableLegacyMode = false;
198199

199200
var FunctionComponent = 0;
200201
var ClassComponent = 1;
@@ -490,11 +491,15 @@ if (__DEV__) {
490491

491492
case TracingMarkerComponent:
492493
return "TracingMarker";
493-
// The display name for this tags come from the user-provided type:
494+
// The display name for these tags come from the user-provided type:
495+
496+
case IncompleteClassComponent:
497+
case IncompleteFunctionComponent:
498+
499+
// Fallthrough
494500

495501
case ClassComponent:
496502
case FunctionComponent:
497-
case IncompleteClassComponent:
498503
case MemoComponent:
499504
case SimpleMemoComponent:
500505
if (typeof type === "function") {
@@ -4514,7 +4519,9 @@ if (__DEV__) {
45144519
function flushSyncWorkOnLegacyRootsOnly() {
45154520
// This is allowed to be called synchronously, but the caller should check
45164521
// the execution context first.
4517-
flushSyncWorkAcrossRoots_impl(true);
4522+
{
4523+
flushSyncWorkAcrossRoots_impl(true);
4524+
}
45184525
}
45194526

45204527
function flushSyncWorkAcrossRoots_impl(onlyLegacy) {
@@ -20185,10 +20192,11 @@ if (__DEV__) {
2018520192
var newProps = workInProgress.pendingProps; // Note: This intentionally doesn't check if we're hydrating because comparing
2018620193

2018720194
switch (workInProgress.tag) {
20195+
case IncompleteFunctionComponent:
20196+
2018820197
case LazyComponent:
2018920198
case SimpleMemoComponent:
2019020199
case FunctionComponent:
20191-
case IncompleteFunctionComponent:
2019220200
case ForwardRef:
2019320201
case Fragment:
2019420202
case Mode:
@@ -25887,6 +25895,7 @@ if (__DEV__) {
2588725895
if (
2588825896
lane === SyncLane &&
2588925897
executionContext === NoContext &&
25898+
!disableLegacyMode &&
2589025899
(fiber.mode & ConcurrentMode) === NoMode
2589125900
) {
2589225901
if (ReactCurrentActQueue.isBatchingLegacy);
@@ -26455,6 +26464,7 @@ if (__DEV__) {
2645526464
// next event, not at the end of the previous one.
2645626465
if (
2645726466
rootWithPendingPassiveEffects !== null &&
26467+
!disableLegacyMode &&
2645826468
rootWithPendingPassiveEffects.tag === LegacyRoot &&
2645926469
(executionContext & (RenderContext | CommitContext)) === NoContext
2646026470
) {
@@ -30084,14 +30094,16 @@ if (__DEV__) {
3008430094
}
3008530095

3008630096
{
30087-
switch (tag) {
30088-
case ConcurrentRoot:
30089-
this._debugRootType = hydrate ? "hydrateRoot()" : "createRoot()";
30090-
break;
30097+
{
30098+
switch (tag) {
30099+
case ConcurrentRoot:
30100+
this._debugRootType = hydrate ? "hydrateRoot()" : "createRoot()";
30101+
break;
3009130102

30092-
case LegacyRoot:
30093-
this._debugRootType = hydrate ? "hydrate()" : "render()";
30094-
break;
30103+
case LegacyRoot:
30104+
this._debugRootType = hydrate ? "hydrate()" : "render()";
30105+
break;
30106+
}
3009530107
}
3009630108
}
3009730109
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,10 @@ function getComponentNameFromFiber(fiber) {
223223
return "SuspenseList";
224224
case 25:
225225
return "TracingMarker";
226+
case 17:
227+
case 28:
226228
case 1:
227229
case 0:
228-
case 17:
229230
case 14:
230231
case 15:
231232
if ("function" === typeof type)
@@ -6537,10 +6538,10 @@ function bubbleProperties(completedWork) {
65376538
function completeWork(current, workInProgress, renderLanes) {
65386539
var newProps = workInProgress.pendingProps;
65396540
switch (workInProgress.tag) {
6541+
case 28:
65406542
case 16:
65416543
case 15:
65426544
case 0:
6543-
case 28:
65446545
case 11:
65456546
case 7:
65466547
case 8:
@@ -10649,7 +10650,7 @@ var slice = Array.prototype.slice,
1064910650
return null;
1065010651
},
1065110652
bundleType: 0,
10652-
version: "19.0.0-www-classic-da81c41b",
10653+
version: "19.0.0-www-classic-d150a248",
1065310654
rendererPackageName: "react-art"
1065410655
};
1065510656
var internals$jscomp$inline_1308 = {
@@ -10680,7 +10681,7 @@ var internals$jscomp$inline_1308 = {
1068010681
scheduleRoot: null,
1068110682
setRefreshHandler: null,
1068210683
getCurrentFiber: null,
10683-
reconcilerVersion: "19.0.0-www-classic-da81c41b"
10684+
reconcilerVersion: "19.0.0-www-classic-d150a248"
1068410685
};
1068510686
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1068610687
var hook$jscomp$inline_1309 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

0 commit comments

Comments
 (0)