Skip to content

Commit 54201b8

Browse files
committed
Fix suspense replaying forward refs (#26535)
Continuation of #26420 Fixes #26385 and #26419 --------- Co-authored-by: eps1lon <silbermann.sebastian@gmail.com> Co-authored-by: Andrew Clark <git@andrewclark.io> DiffTrain build for [7329ea8](7329ea8)
1 parent e1d88e6 commit 54201b8

18 files changed

+967
-791
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0ae348018d5b3a3f1ccdd92de85d9cc581b2b98d
1+
7329ea81c154d40800e30104be40f050e8c2af3e

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-01f5e12b";
30+
var ReactVersion = "18.3.0-www-modern-be9a0998";
3131

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

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

Lines changed: 28 additions & 15 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-69b188ab";
72+
var ReactVersion = "18.3.0-www-classic-ec4b0889";
7373

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;
@@ -13731,18 +13731,12 @@ function replayFunctionComponent(
1373113731
workInProgress,
1373213732
nextProps,
1373313733
Component,
13734+
secondArg,
1373413735
renderLanes
1373513736
) {
1373613737
// This function is used to replay a component that previously suspended,
1373713738
// after its data resolves. It's a simplified version of
1373813739
// updateFunctionComponent that reuses the hooks from the previous attempt.
13739-
var context;
13740-
13741-
{
13742-
var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
13743-
context = getMaskedContext(workInProgress, unmaskedContext);
13744-
}
13745-
1374613740
prepareToReadContext(workInProgress, renderLanes);
1374713741

1374813742
if (enableSchedulingProfiler) {
@@ -13754,7 +13748,7 @@ function replayFunctionComponent(
1375413748
workInProgress,
1375513749
Component,
1375613750
nextProps,
13757-
context
13751+
secondArg
1375813752
);
1375913753

1376013754
if (enableSchedulingProfiler) {
@@ -25396,8 +25390,8 @@ function replaySuspendedUnitOfWork(unitOfWork) {
2539625390
}
2539725391
// eslint-disable-next-line no-fallthrough
2539825392

25399-
case FunctionComponent:
25400-
case ForwardRef: {
25393+
case SimpleMemoComponent:
25394+
case FunctionComponent: {
2540125395
// Resolve `defaultProps`. This logic is copied from `beginWork`.
2540225396
// TODO: Consider moving this switch statement into that module. Also,
2540325397
// could maybe use this as an opportunity to say `use` doesn't work with
@@ -25408,24 +25402,43 @@ function replaySuspendedUnitOfWork(unitOfWork) {
2540825402
unitOfWork.elementType === Component
2540925403
? unresolvedProps
2541025404
: resolveDefaultProps(Component, unresolvedProps);
25405+
var context;
25406+
25407+
{
25408+
var unmaskedContext = getUnmaskedContext(unitOfWork, Component, true);
25409+
context = getMaskedContext(unitOfWork, unmaskedContext);
25410+
}
25411+
2541125412
next = replayFunctionComponent(
2541225413
current,
2541325414
unitOfWork,
2541425415
resolvedProps,
2541525416
Component,
25417+
context,
2541625418
workInProgressRootRenderLanes
2541725419
);
2541825420
break;
2541925421
}
2542025422

25421-
case SimpleMemoComponent: {
25422-
var _Component = unitOfWork.type;
25423-
var nextProps = unitOfWork.pendingProps;
25423+
case ForwardRef: {
25424+
// Resolve `defaultProps`. This logic is copied from `beginWork`.
25425+
// TODO: Consider moving this switch statement into that module. Also,
25426+
// could maybe use this as an opportunity to say `use` doesn't work with
25427+
// `defaultProps` :)
25428+
var _Component = unitOfWork.type.render;
25429+
var _unresolvedProps = unitOfWork.pendingProps;
25430+
25431+
var _resolvedProps =
25432+
unitOfWork.elementType === _Component
25433+
? _unresolvedProps
25434+
: resolveDefaultProps(_Component, _unresolvedProps);
25435+
2542425436
next = replayFunctionComponent(
2542525437
current,
2542625438
unitOfWork,
25427-
nextProps,
25439+
_resolvedProps,
2542825440
_Component,
25441+
unitOfWork.ref,
2542925442
workInProgressRootRenderLanes
2543025443
);
2543125444
break;

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

Lines changed: 23 additions & 10 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-e02e9428";
72+
var ReactVersion = "18.3.0-www-modern-ae3f1831";
7373

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;
@@ -13448,13 +13448,12 @@ function replayFunctionComponent(
1344813448
workInProgress,
1344913449
nextProps,
1345013450
Component,
13451+
secondArg,
1345113452
renderLanes
1345213453
) {
1345313454
// This function is used to replay a component that previously suspended,
1345413455
// after its data resolves. It's a simplified version of
1345513456
// updateFunctionComponent that reuses the hooks from the previous attempt.
13456-
var context;
13457-
1345813457
prepareToReadContext(workInProgress, renderLanes);
1345913458

1346013459
if (enableSchedulingProfiler) {
@@ -13466,7 +13465,7 @@ function replayFunctionComponent(
1346613465
workInProgress,
1346713466
Component,
1346813467
nextProps,
13469-
context
13468+
secondArg
1347013469
);
1347113470

1347213471
if (enableSchedulingProfiler) {
@@ -25056,8 +25055,8 @@ function replaySuspendedUnitOfWork(unitOfWork) {
2505625055
}
2505725056
// eslint-disable-next-line no-fallthrough
2505825057

25059-
case FunctionComponent:
25060-
case ForwardRef: {
25058+
case SimpleMemoComponent:
25059+
case FunctionComponent: {
2506125060
// Resolve `defaultProps`. This logic is copied from `beginWork`.
2506225061
// TODO: Consider moving this switch statement into that module. Also,
2506325062
// could maybe use this as an opportunity to say `use` doesn't work with
@@ -25068,24 +25067,38 @@ function replaySuspendedUnitOfWork(unitOfWork) {
2506825067
unitOfWork.elementType === Component
2506925068
? unresolvedProps
2507025069
: resolveDefaultProps(Component, unresolvedProps);
25070+
var context;
25071+
2507125072
next = replayFunctionComponent(
2507225073
current,
2507325074
unitOfWork,
2507425075
resolvedProps,
2507525076
Component,
25077+
context,
2507625078
workInProgressRootRenderLanes
2507725079
);
2507825080
break;
2507925081
}
2508025082

25081-
case SimpleMemoComponent: {
25082-
var _Component = unitOfWork.type;
25083-
var nextProps = unitOfWork.pendingProps;
25083+
case ForwardRef: {
25084+
// Resolve `defaultProps`. This logic is copied from `beginWork`.
25085+
// TODO: Consider moving this switch statement into that module. Also,
25086+
// could maybe use this as an opportunity to say `use` doesn't work with
25087+
// `defaultProps` :)
25088+
var _Component = unitOfWork.type.render;
25089+
var _unresolvedProps = unitOfWork.pendingProps;
25090+
25091+
var _resolvedProps =
25092+
unitOfWork.elementType === _Component
25093+
? _unresolvedProps
25094+
: resolveDefaultProps(_Component, _unresolvedProps);
25095+
2508425096
next = replayFunctionComponent(
2508525097
current,
2508625098
unitOfWork,
25087-
nextProps,
25099+
_resolvedProps,
2508825100
_Component,
25101+
unitOfWork.ref,
2508925102
workInProgressRootRenderLanes
2509025103
);
2509125104
break;

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

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3887,18 +3887,15 @@ function replayFunctionComponent(
38873887
workInProgress,
38883888
nextProps,
38893889
Component,
3890+
secondArg,
38903891
renderLanes
38913892
) {
3892-
var context = isContextProvider(Component)
3893-
? previousContext
3894-
: contextStackCursor$1.current;
3895-
context = getMaskedContext(workInProgress, context);
38963893
prepareToReadContext(workInProgress, renderLanes);
38973894
nextProps = renderWithHooksAgain(
38983895
workInProgress,
38993896
Component,
39003897
nextProps,
3901-
context
3898+
secondArg
39023899
);
39033900
finishRenderingHooks(current);
39043901
if (null !== current && !didReceiveUpdate)
@@ -8549,28 +8546,40 @@ function replaySuspendedUnitOfWork(unitOfWork) {
85498546
switch (unitOfWork.tag) {
85508547
case 2:
85518548
unitOfWork.tag = 0;
8549+
case 15:
85528550
case 0:
8553-
case 11:
85548551
var Component = unitOfWork.type,
85558552
unresolvedProps = unitOfWork.pendingProps;
85568553
unresolvedProps =
85578554
unitOfWork.elementType === Component
85588555
? unresolvedProps
85598556
: resolveDefaultProps(Component, unresolvedProps);
8557+
var context = isContextProvider(Component)
8558+
? previousContext
8559+
: contextStackCursor$1.current;
8560+
context = getMaskedContext(unitOfWork, context);
85608561
current = replayFunctionComponent(
85618562
current,
85628563
unitOfWork,
85638564
unresolvedProps,
85648565
Component,
8566+
context,
85658567
workInProgressRootRenderLanes
85668568
);
85678569
break;
8568-
case 15:
8570+
case 11:
8571+
Component = unitOfWork.type.render;
8572+
unresolvedProps = unitOfWork.pendingProps;
8573+
unresolvedProps =
8574+
unitOfWork.elementType === Component
8575+
? unresolvedProps
8576+
: resolveDefaultProps(Component, unresolvedProps);
85698577
current = replayFunctionComponent(
85708578
current,
85718579
unitOfWork,
8572-
unitOfWork.pendingProps,
8573-
unitOfWork.type,
8580+
unresolvedProps,
8581+
Component,
8582+
unitOfWork.ref,
85748583
workInProgressRootRenderLanes
85758584
);
85768585
break;
@@ -10053,19 +10062,19 @@ var slice = Array.prototype.slice,
1005310062
};
1005410063
return Text;
1005510064
})(React.Component),
10056-
devToolsConfig$jscomp$inline_1168 = {
10065+
devToolsConfig$jscomp$inline_1170 = {
1005710066
findFiberByHostInstance: function () {
1005810067
return null;
1005910068
},
1006010069
bundleType: 0,
10061-
version: "18.3.0-www-classic-d70758c5",
10070+
version: "18.3.0-www-classic-3b2e6228",
1006210071
rendererPackageName: "react-art"
1006310072
};
10064-
var internals$jscomp$inline_1342 = {
10065-
bundleType: devToolsConfig$jscomp$inline_1168.bundleType,
10066-
version: devToolsConfig$jscomp$inline_1168.version,
10067-
rendererPackageName: devToolsConfig$jscomp$inline_1168.rendererPackageName,
10068-
rendererConfig: devToolsConfig$jscomp$inline_1168.rendererConfig,
10073+
var internals$jscomp$inline_1344 = {
10074+
bundleType: devToolsConfig$jscomp$inline_1170.bundleType,
10075+
version: devToolsConfig$jscomp$inline_1170.version,
10076+
rendererPackageName: devToolsConfig$jscomp$inline_1170.rendererPackageName,
10077+
rendererConfig: devToolsConfig$jscomp$inline_1170.rendererConfig,
1006910078
overrideHookState: null,
1007010079
overrideHookStateDeletePath: null,
1007110080
overrideHookStateRenamePath: null,
@@ -10082,26 +10091,26 @@ var internals$jscomp$inline_1342 = {
1008210091
return null === fiber ? null : fiber.stateNode;
1008310092
},
1008410093
findFiberByHostInstance:
10085-
devToolsConfig$jscomp$inline_1168.findFiberByHostInstance ||
10094+
devToolsConfig$jscomp$inline_1170.findFiberByHostInstance ||
1008610095
emptyFindFiberByHostInstance,
1008710096
findHostInstancesForRefresh: null,
1008810097
scheduleRefresh: null,
1008910098
scheduleRoot: null,
1009010099
setRefreshHandler: null,
1009110100
getCurrentFiber: null,
10092-
reconcilerVersion: "18.3.0-www-classic-d70758c5"
10101+
reconcilerVersion: "18.3.0-www-classic-3b2e6228"
1009310102
};
1009410103
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
10095-
var hook$jscomp$inline_1343 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
10104+
var hook$jscomp$inline_1345 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
1009610105
if (
10097-
!hook$jscomp$inline_1343.isDisabled &&
10098-
hook$jscomp$inline_1343.supportsFiber
10106+
!hook$jscomp$inline_1345.isDisabled &&
10107+
hook$jscomp$inline_1345.supportsFiber
1009910108
)
1010010109
try {
10101-
(rendererID = hook$jscomp$inline_1343.inject(
10102-
internals$jscomp$inline_1342
10110+
(rendererID = hook$jscomp$inline_1345.inject(
10111+
internals$jscomp$inline_1344
1010310112
)),
10104-
(injectedHook = hook$jscomp$inline_1343);
10113+
(injectedHook = hook$jscomp$inline_1345);
1010510114
} catch (err) {}
1010610115
}
1010710116
var Path = Mode$1.Path;

0 commit comments

Comments
 (0)