Skip to content

Commit 3484cc2

Browse files
committed
Move Mutation/Persistence fork inline into the functions (#26206)
We should never use any logic beyond declarations in the module scope, including conditions, because in a cycle that can lead to problems. More importantly, the compiler can't safely reorder statements between these points which limits the optimizations we can do. DiffTrain build for commit 62e6c46.
1 parent ac6f055 commit 3484cc2

34 files changed

+31308
-829
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
80cf4a099e99bbd4ed13e02d30136f669f2868b9
1+
62e6c4612ec704cf07c99b318bc8f26d3ec3f588
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
80cf4a099e99bbd4ed13e02d30136f669f2868b9
1+
62e6c4612ec704cf07c99b318bc8f26d3ec3f588

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-80cf4a099-20230220";
30+
var ReactVersion = "18.3.0-www-classic-62e6c4612-20230220";
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-80cf4a099-20230220";
30+
var ReactVersion = "18.3.0-www-modern-62e6c4612-20230220";
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
@@ -646,4 +646,4 @@ exports.useSyncExternalStore = function (
646646
);
647647
};
648648
exports.useTransition = useTransition;
649-
exports.version = "18.3.0-www-classic-80cf4a099-20230220";
649+
exports.version = "18.3.0-www-classic-62e6c4612-20230220";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,4 +638,4 @@ exports.useSyncExternalStore = function (
638638
);
639639
};
640640
exports.useTransition = useTransition;
641-
exports.version = "18.3.0-www-modern-80cf4a099-20230220";
641+
exports.version = "18.3.0-www-modern-62e6c4612-20230220";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ exports.useSyncExternalStore = function (
657657
);
658658
};
659659
exports.useTransition = useTransition;
660-
exports.version = "18.3.0-www-classic-80cf4a099-20230220";
660+
exports.version = "18.3.0-www-classic-62e6c4612-20230220";
661661

662662
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
663663
if (

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ exports.useSyncExternalStore = function (
649649
);
650650
};
651651
exports.useTransition = useTransition;
652-
exports.version = "18.3.0-www-modern-80cf4a099-20230220";
652+
exports.version = "18.3.0-www-modern-62e6c4612-20230220";
653653

654654
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
655655
if (

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

Lines changed: 18 additions & 27 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-80cf4a099-20230220";
72+
var ReactVersion = "18.3.0-www-classic-62e6c4612-20230220";
7373

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;
@@ -17350,19 +17350,13 @@ function markRef(workInProgress) {
1735017350
workInProgress.flags |= Ref | RefStatic;
1735117351
}
1735217352

17353-
var appendAllChildren;
17354-
var updateHostContainer;
17355-
var updateHostComponent;
17356-
var updateHostText;
17357-
17358-
{
17359-
// Mutation mode
17360-
appendAllChildren = function (
17361-
parent,
17362-
workInProgress,
17363-
needsVisibilityToggle,
17364-
isHidden
17365-
) {
17353+
function appendAllChildren(
17354+
parent,
17355+
workInProgress,
17356+
needsVisibilityToggle,
17357+
isHidden
17358+
) {
17359+
{
1736617360
// We only have the top Fiber that was created but we need recurse down its
1736717361
// children to find all the terminal nodes.
1736817362
var node = workInProgress.child;
@@ -17393,13 +17387,11 @@ var updateHostText;
1739317387
node.sibling.return = node.return;
1739417388
node = node.sibling;
1739517389
}
17396-
};
17397-
17398-
updateHostContainer = function (current, workInProgress) {
17399-
// Noop
17400-
};
17390+
}
17391+
} // An unfortunate fork of appendAllChildren because we have two different parent types.
1740117392

17402-
updateHostComponent = function (current, workInProgress, type, newProps) {
17393+
function updateHostComponent(current, workInProgress, type, newProps) {
17394+
{
1740317395
// If we have an alternate, that means this is an update and we need to
1740417396
// schedule a side-effect to do the updates.
1740517397
var oldProps = current.memoizedProps;
@@ -17421,14 +17413,16 @@ var updateHostText;
1742117413
if (updatePayload) {
1742217414
markUpdate(workInProgress);
1742317415
}
17424-
};
17416+
}
17417+
}
1742517418

17426-
updateHostText = function (current, workInProgress, oldText, newText) {
17419+
function updateHostText(current, workInProgress, oldText, newText) {
17420+
{
1742717421
// If the text differs, mark it as an update. All the work in done in commitWork.
1742817422
if (oldText !== newText) {
1742917423
markUpdate(workInProgress);
1743017424
}
17431-
};
17425+
}
1743217426
}
1743317427

1743417428
function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
@@ -17800,8 +17794,6 @@ function completeWork(current, workInProgress, renderLanes) {
1780017794
}
1780117795
}
1780217796
}
17803-
17804-
updateHostContainer(current, workInProgress);
1780517797
bubbleProperties(workInProgress);
1780617798

1780717799
if (enableTransitionTracing) {
@@ -17864,7 +17856,7 @@ function completeWork(current, workInProgress, renderLanes) {
1786417856
getRootHostContainer();
1786517857

1786617858
var instance = createInstance(_type, newProps);
17867-
appendAllChildren(instance, workInProgress, false, false);
17859+
appendAllChildren(instance, workInProgress);
1786817860
workInProgress.stateNode = instance; // Certain renderers require commit-time effects for initial mount.
1786917861
}
1787017862

@@ -18052,7 +18044,6 @@ function completeWork(current, workInProgress, renderLanes) {
1805218044

1805318045
case HostPortal:
1805418046
popHostContainer(workInProgress);
18055-
updateHostContainer(current, workInProgress);
1805618047

1805718048
bubbleProperties(workInProgress);
1805818049
return null;

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

Lines changed: 18 additions & 27 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-80cf4a099-20230220";
72+
var ReactVersion = "18.3.0-www-modern-62e6c4612-20230220";
7373

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;
@@ -17039,19 +17039,13 @@ function markRef(workInProgress) {
1703917039
workInProgress.flags |= Ref | RefStatic;
1704017040
}
1704117041

17042-
var appendAllChildren;
17043-
var updateHostContainer;
17044-
var updateHostComponent;
17045-
var updateHostText;
17046-
17047-
{
17048-
// Mutation mode
17049-
appendAllChildren = function (
17050-
parent,
17051-
workInProgress,
17052-
needsVisibilityToggle,
17053-
isHidden
17054-
) {
17042+
function appendAllChildren(
17043+
parent,
17044+
workInProgress,
17045+
needsVisibilityToggle,
17046+
isHidden
17047+
) {
17048+
{
1705517049
// We only have the top Fiber that was created but we need recurse down its
1705617050
// children to find all the terminal nodes.
1705717051
var node = workInProgress.child;
@@ -17082,13 +17076,11 @@ var updateHostText;
1708217076
node.sibling.return = node.return;
1708317077
node = node.sibling;
1708417078
}
17085-
};
17086-
17087-
updateHostContainer = function (current, workInProgress) {
17088-
// Noop
17089-
};
17079+
}
17080+
} // An unfortunate fork of appendAllChildren because we have two different parent types.
1709017081

17091-
updateHostComponent = function (current, workInProgress, type, newProps) {
17082+
function updateHostComponent(current, workInProgress, type, newProps) {
17083+
{
1709217084
// If we have an alternate, that means this is an update and we need to
1709317085
// schedule a side-effect to do the updates.
1709417086
var oldProps = current.memoizedProps;
@@ -17110,14 +17102,16 @@ var updateHostText;
1711017102
if (updatePayload) {
1711117103
markUpdate(workInProgress);
1711217104
}
17113-
};
17105+
}
17106+
}
1711417107

17115-
updateHostText = function (current, workInProgress, oldText, newText) {
17108+
function updateHostText(current, workInProgress, oldText, newText) {
17109+
{
1711617110
// If the text differs, mark it as an update. All the work in done in commitWork.
1711717111
if (oldText !== newText) {
1711817112
markUpdate(workInProgress);
1711917113
}
17120-
};
17114+
}
1712117115
}
1712217116

1712317117
function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
@@ -17482,8 +17476,6 @@ function completeWork(current, workInProgress, renderLanes) {
1748217476
}
1748317477
}
1748417478
}
17485-
17486-
updateHostContainer(current, workInProgress);
1748717479
bubbleProperties(workInProgress);
1748817480

1748917481
if (enableTransitionTracing) {
@@ -17546,7 +17538,7 @@ function completeWork(current, workInProgress, renderLanes) {
1754617538
getRootHostContainer();
1754717539

1754817540
var instance = createInstance(_type, newProps);
17549-
appendAllChildren(instance, workInProgress, false, false);
17541+
appendAllChildren(instance, workInProgress);
1755017542
workInProgress.stateNode = instance; // Certain renderers require commit-time effects for initial mount.
1755117543
}
1755217544

@@ -17734,7 +17726,6 @@ function completeWork(current, workInProgress, renderLanes) {
1773417726

1773517727
case HostPortal:
1773617728
popHostContainer(workInProgress);
17737-
updateHostContainer(current, workInProgress);
1773817729

1773917730
bubbleProperties(workInProgress);
1774017731
return null;

0 commit comments

Comments
 (0)