Skip to content

Commit 42dceaf

Browse files
rickhanloniifacebook-github-bot
authored andcommitted
React Native sync for revisions f7cdc89...bd7f4a0
Summary: This sync includes the following changes: - **[bd7f4a013](facebook/react@bd7f4a013 )**: Fix sloppy factoring in `performSyncWorkOnRoot` ([#21246](facebook/react#21246)) //<Andrew Clark>// - **[78120032d](facebook/react@78120032d )**: Remove `flushDiscreteUpdates` from end of event ([#21223](facebook/react#21223)) //<Andrew Clark>// - **[a3a7adb83](facebook/react@a3a7adb83 )**: Turn off enableSyncDefaultUpdates in test renderer ([#21319](facebook/react#21319)) //<Ricky>// - **[cdb6b4c55](facebook/react@cdb6b4c55 )**: Only hide outermost host nodes when Offscreen is hidden ([#21250](facebook/react#21250)) //<Brian Vaughn>// - **[b9c6a2b30](facebook/react@b9c6a2b30 )**: Remove LayoutStatic check from commit phase ([#21249](facebook/react#21249)) //<Brian Vaughn>// - **[af1a4cbf7](facebook/react@af1a4cbf7 )**: Revert expiration for retry lanes ([#21300](facebook/react#21300)) //<Andrew Clark>// - **[cc4b431da](facebook/react@cc4b431da )**: Mark boundary as client rendered even if aborting fallback ([#21294](facebook/react#21294)) //<Sebastian Markbåge>// Changelog: [General][Changed] - React Native sync for revisions f7cdc89...bd7f4a0 jest_e2e[run_all_tests] Reviewed By: JoshuaGross Differential Revision: D27909257 fbshipit-source-id: 36ec4cf1de9df109f1fe1542031df10a693baae0
1 parent 06f52f7 commit 42dceaf

File tree

7 files changed

+409
-332
lines changed

7 files changed

+409
-332
lines changed

Libraries/Renderer/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f7cdc893618e9701a8e3403b2b63bfc8233c6771
1+
bd7f4a013be3ef272a01874532bee71ad861e617

Libraries/Renderer/implementations/ReactFabric-dev.fb.js

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<8e2b098b8adc0535d0c66734daceb246>>
10+
* @generated SignedSource<<2ebb47c89a60a8b3e667fdf7431261b6>>
1111
*/
1212

1313
'use strict';
@@ -3711,7 +3711,6 @@ function batchedUpdates(fn, bookkeeping) {
37113711
function setBatchingImplementation(
37123712
_batchedUpdatesImpl,
37133713
_discreteUpdatesImpl,
3714-
_flushDiscreteUpdatesImpl,
37153714
_batchedEventUpdatesImpl
37163715
) {
37173716
batchedUpdatesImpl = _batchedUpdatesImpl;
@@ -4361,12 +4360,19 @@ function computeExpirationTime(lane, currentTime) {
43614360
case TransitionLane14:
43624361
case TransitionLane15:
43634362
case TransitionLane16:
4363+
return currentTime + 5000;
4364+
43644365
case RetryLane1:
43654366
case RetryLane2:
43664367
case RetryLane3:
43674368
case RetryLane4:
43684369
case RetryLane5:
4369-
return currentTime + 5000;
4370+
// TODO: Retries should be allowed to expire if they are CPU bound for
4371+
// too long, but when I made this change it caused a spike in browser
4372+
// crashes. There must be some other underlying bug; not super urgent but
4373+
// ideally should figure out why and fix it. Unfortunately we don't have
4374+
// a repro for the crashes, only detected via production metrics.
4375+
return NoTimestamp;
43704376

43714377
case SelectiveHydrationLane:
43724378
case IdleHydrationLane:
@@ -4573,11 +4579,6 @@ function markRootExpired(root, expiredLanes) {
45734579
root.entangledLanes |= SyncLane;
45744580
root.pendingLanes |= SyncLane;
45754581
}
4576-
function areLanesExpired(root, lanes) {
4577-
var SyncLaneIndex = 0;
4578-
var entanglements = root.entanglements;
4579-
return (entanglements[SyncLaneIndex] & lanes) !== NoLanes;
4580-
}
45814582
function markRootMutableRead(root, updateLane) {
45824583
root.mutableReadLanes |= updateLane & root.pendingLanes;
45834584
}
@@ -18620,10 +18621,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
1862018621
// all pending updates are included. If it still fails after the second
1862118622
// attempt, we'll give up and commit the resulting tree.
1862218623

18623-
lanes = getLanesToRetrySynchronouslyOnError(root);
18624+
var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root);
1862418625

18625-
if (lanes !== NoLanes) {
18626-
exitStatus = renderRootSync(root, lanes);
18626+
if (errorRetryLanes !== NoLanes) {
18627+
lanes = errorRetryLanes;
18628+
exitStatus = renderRootSync(root, errorRetryLanes);
1862718629
}
1862818630
}
1862918631

@@ -18788,22 +18790,25 @@ function performSyncWorkOnRoot(root) {
1878818790
}
1878918791

1879018792
flushPassiveEffects();
18791-
var lanes;
18792-
var exitStatus;
18793+
var lanes = getNextLanes(root, NoLanes);
1879318794

18794-
if (
18795-
root === workInProgressRoot &&
18796-
areLanesExpired(root, workInProgressRootRenderLanes)
18797-
) {
18798-
// There's a partial tree, and at least one of its lanes has expired. Finish
18799-
// rendering it before rendering the rest of the expired work.
18800-
lanes = workInProgressRootRenderLanes;
18801-
exitStatus = renderRootSync(root, lanes);
18795+
if (includesSomeLane(lanes, SyncLane)) {
18796+
if (
18797+
root === workInProgressRoot &&
18798+
includesSomeLane(lanes, workInProgressRootRenderLanes)
18799+
) {
18800+
// There's a partial tree, and at least one of its lanes has expired. Finish
18801+
// rendering it before rendering the rest of the expired work.
18802+
lanes = workInProgressRootRenderLanes;
18803+
}
1880218804
} else {
18803-
lanes = getNextLanes(root, NoLanes);
18804-
exitStatus = renderRootSync(root, lanes);
18805+
// There's no remaining sync work left.
18806+
ensureRootIsScheduled(root, now());
18807+
return null;
1880518808
}
1880618809

18810+
var exitStatus = renderRootSync(root, lanes);
18811+
1880718812
if (root.tag !== LegacyRoot && exitStatus === RootErrored) {
1880818813
executionContext |= RetryAfterError; // If an error occurred during hydration,
1880918814
// discard server response and fall back to client side render.
@@ -18821,9 +18826,10 @@ function performSyncWorkOnRoot(root) {
1882118826
// all pending updates are included. If it still fails after the second
1882218827
// attempt, we'll give up and commit the resulting tree.
1882318828

18824-
lanes = getLanesToRetrySynchronouslyOnError(root);
18829+
var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root);
1882518830

18826-
if (lanes !== NoLanes) {
18831+
if (errorRetryLanes !== NoLanes) {
18832+
lanes = errorRetryLanes;
1882718833
exitStatus = renderRootSync(root, lanes);
1882818834
}
1882918835
}
@@ -19364,6 +19370,15 @@ function commitRootImpl(root, renderPriorityLevel) {
1936419370

1936519371
if (finishedWork === null) {
1936619372
return null;
19373+
} else {
19374+
{
19375+
if (lanes === NoLanes) {
19376+
error(
19377+
"root.finishedLanes should not be empty during a commit. This is a " +
19378+
"bug in React."
19379+
);
19380+
}
19381+
}
1936719382
}
1936819383

1936919384
root.finishedWork = null;
@@ -19545,9 +19560,9 @@ function commitRootImpl(root, renderPriorityLevel) {
1954519560

1954619561
if (hasUncaughtError) {
1954719562
hasUncaughtError = false;
19548-
var error = firstUncaughtError;
19563+
var error$1 = firstUncaughtError;
1954919564
firstUncaughtError = null;
19550-
throw error;
19565+
throw error$1;
1955119566
}
1955219567

1955319568
if ((executionContext & LegacyUnbatchedContext) !== NoContext) {

Libraries/Renderer/implementations/ReactFabric-prod.fb.js

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<90d01c86a28a69abef2fe93114ca8dd8>>
10+
* @generated SignedSource<<f41656c617fa40163bc178f355249017>>
1111
*/
1212

1313
"use strict";
@@ -930,7 +930,7 @@ eventPluginOrder = Array.prototype.slice.call([
930930
"ReactNativeBridgeEventPlugin"
931931
]);
932932
recomputePluginOrdering();
933-
var injectedNamesToPlugins$jscomp$inline_215 = {
933+
var injectedNamesToPlugins$jscomp$inline_214 = {
934934
ResponderEventPlugin: ResponderEventPlugin,
935935
ReactNativeBridgeEventPlugin: {
936936
eventTypes: {},
@@ -965,34 +965,34 @@ var injectedNamesToPlugins$jscomp$inline_215 = {
965965
}
966966
}
967967
},
968-
isOrderingDirty$jscomp$inline_216 = !1,
969-
pluginName$jscomp$inline_217;
970-
for (pluginName$jscomp$inline_217 in injectedNamesToPlugins$jscomp$inline_215)
968+
isOrderingDirty$jscomp$inline_215 = !1,
969+
pluginName$jscomp$inline_216;
970+
for (pluginName$jscomp$inline_216 in injectedNamesToPlugins$jscomp$inline_214)
971971
if (
972-
injectedNamesToPlugins$jscomp$inline_215.hasOwnProperty(
973-
pluginName$jscomp$inline_217
972+
injectedNamesToPlugins$jscomp$inline_214.hasOwnProperty(
973+
pluginName$jscomp$inline_216
974974
)
975975
) {
976-
var pluginModule$jscomp$inline_218 =
977-
injectedNamesToPlugins$jscomp$inline_215[pluginName$jscomp$inline_217];
976+
var pluginModule$jscomp$inline_217 =
977+
injectedNamesToPlugins$jscomp$inline_214[pluginName$jscomp$inline_216];
978978
if (
979-
!namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_217) ||
980-
namesToPlugins[pluginName$jscomp$inline_217] !==
981-
pluginModule$jscomp$inline_218
979+
!namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_216) ||
980+
namesToPlugins[pluginName$jscomp$inline_216] !==
981+
pluginModule$jscomp$inline_217
982982
) {
983-
if (namesToPlugins[pluginName$jscomp$inline_217])
983+
if (namesToPlugins[pluginName$jscomp$inline_216])
984984
throw Error(
985985
"EventPluginRegistry: Cannot inject two different event plugins using the same name, `" +
986-
pluginName$jscomp$inline_217 +
986+
pluginName$jscomp$inline_216 +
987987
"`."
988988
);
989989
namesToPlugins[
990-
pluginName$jscomp$inline_217
991-
] = pluginModule$jscomp$inline_218;
992-
isOrderingDirty$jscomp$inline_216 = !0;
990+
pluginName$jscomp$inline_216
991+
] = pluginModule$jscomp$inline_217;
992+
isOrderingDirty$jscomp$inline_215 = !0;
993993
}
994994
}
995-
isOrderingDirty$jscomp$inline_216 && recomputePluginOrdering();
995+
isOrderingDirty$jscomp$inline_215 && recomputePluginOrdering();
996996
function getInstanceFromInstance(instanceHandle) {
997997
return instanceHandle;
998998
}
@@ -1730,12 +1730,13 @@ function computeExpirationTime(lane, currentTime) {
17301730
case 524288:
17311731
case 1048576:
17321732
case 2097152:
1733+
return currentTime + 5e3;
17331734
case 4194304:
17341735
case 8388608:
17351736
case 16777216:
17361737
case 33554432:
17371738
case 67108864:
1738-
return currentTime + 5e3;
1739+
return -1;
17391740
case 134217728:
17401741
case 268435456:
17411742
case 536870912:
@@ -6138,8 +6139,10 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
61386139
2 === didTimeout &&
61396140
((executionContext |= 32),
61406141
root.hydrate && ((root.hydrate = !1), shim(root.containerInfo)),
6141-
(lanes = getLanesToRetrySynchronouslyOnError(root)),
6142-
0 !== lanes && (didTimeout = renderRootSync(root, lanes)));
6142+
(prevExecutionContext = getLanesToRetrySynchronouslyOnError(root)),
6143+
0 !== prevExecutionContext &&
6144+
((lanes = prevExecutionContext),
6145+
(didTimeout = renderRootSync(root, prevExecutionContext))));
61436146
if (1 === didTimeout)
61446147
throw ((originalCallbackNode = workInProgressRootFatalError),
61456148
prepareFreshStack(root, 0),
@@ -6241,17 +6244,20 @@ function performSyncWorkOnRoot(root) {
62416244
if (0 !== (executionContext & 24))
62426245
throw Error("Should not already be working.");
62436246
flushPassiveEffects();
6244-
var lanes;
6245-
if ((lanes = root === workInProgressRoot))
6246-
lanes = 0 !== (root.entanglements[0] & workInProgressRootRenderLanes);
6247-
lanes = lanes ? workInProgressRootRenderLanes : getNextLanes(root, 0);
6247+
var lanes = getNextLanes(root, 0);
6248+
if (0 !== (lanes & 1))
6249+
root === workInProgressRoot &&
6250+
0 !== (lanes & workInProgressRootRenderLanes) &&
6251+
(lanes = workInProgressRootRenderLanes);
6252+
else return ensureRootIsScheduled(root, now()), null;
62486253
var exitStatus = renderRootSync(root, lanes);
6249-
0 !== root.tag &&
6250-
2 === exitStatus &&
6251-
((executionContext |= 32),
6252-
root.hydrate && ((root.hydrate = !1), shim(root.containerInfo)),
6253-
(lanes = getLanesToRetrySynchronouslyOnError(root)),
6254-
0 !== lanes && (exitStatus = renderRootSync(root, lanes)));
6254+
if (0 !== root.tag && 2 === exitStatus) {
6255+
executionContext |= 32;
6256+
root.hydrate && ((root.hydrate = !1), shim(root.containerInfo));
6257+
var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root);
6258+
0 !== errorRetryLanes &&
6259+
((lanes = errorRetryLanes), (exitStatus = renderRootSync(root, lanes)));
6260+
}
62556261
if (1 === exitStatus)
62566262
throw ((exitStatus = workInProgressRootFatalError),
62576263
prepareFreshStack(root, 0),
@@ -7738,7 +7744,7 @@ batchedUpdatesImpl = function(fn, a) {
77387744
}
77397745
};
77407746
var roots = new Map(),
7741-
devToolsConfig$jscomp$inline_941 = {
7747+
devToolsConfig$jscomp$inline_934 = {
77427748
findFiberByHostInstance: getInstanceFromInstance,
77437749
bundleType: 0,
77447750
version: "17.0.3",
@@ -7756,11 +7762,11 @@ var roots = new Map(),
77567762
}.bind(null, findNodeHandle)
77577763
}
77587764
};
7759-
var internals$jscomp$inline_1175 = {
7760-
bundleType: devToolsConfig$jscomp$inline_941.bundleType,
7761-
version: devToolsConfig$jscomp$inline_941.version,
7762-
rendererPackageName: devToolsConfig$jscomp$inline_941.rendererPackageName,
7763-
rendererConfig: devToolsConfig$jscomp$inline_941.rendererConfig,
7765+
var internals$jscomp$inline_1168 = {
7766+
bundleType: devToolsConfig$jscomp$inline_934.bundleType,
7767+
version: devToolsConfig$jscomp$inline_934.version,
7768+
rendererPackageName: devToolsConfig$jscomp$inline_934.rendererPackageName,
7769+
rendererConfig: devToolsConfig$jscomp$inline_934.rendererConfig,
77647770
overrideHookState: null,
77657771
overrideHookStateDeletePath: null,
77667772
overrideHookStateRenamePath: null,
@@ -7775,7 +7781,7 @@ var internals$jscomp$inline_1175 = {
77757781
return null === fiber ? null : fiber.stateNode;
77767782
},
77777783
findFiberByHostInstance:
7778-
devToolsConfig$jscomp$inline_941.findFiberByHostInstance ||
7784+
devToolsConfig$jscomp$inline_934.findFiberByHostInstance ||
77797785
emptyFindFiberByHostInstance,
77807786
findHostInstancesForRefresh: null,
77817787
scheduleRefresh: null,
@@ -7785,16 +7791,16 @@ var internals$jscomp$inline_1175 = {
77857791
reconcilerVersion: "17.0.3"
77867792
};
77877793
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
7788-
var hook$jscomp$inline_1176 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
7794+
var hook$jscomp$inline_1169 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
77897795
if (
7790-
!hook$jscomp$inline_1176.isDisabled &&
7791-
hook$jscomp$inline_1176.supportsFiber
7796+
!hook$jscomp$inline_1169.isDisabled &&
7797+
hook$jscomp$inline_1169.supportsFiber
77927798
)
77937799
try {
7794-
(rendererID = hook$jscomp$inline_1176.inject(
7795-
internals$jscomp$inline_1175
7800+
(rendererID = hook$jscomp$inline_1169.inject(
7801+
internals$jscomp$inline_1168
77967802
)),
7797-
(injectedHook = hook$jscomp$inline_1176);
7803+
(injectedHook = hook$jscomp$inline_1169);
77987804
} catch (err) {}
77997805
}
78007806
exports.createPortal = function(children, containerTag) {

0 commit comments

Comments
 (0)