Skip to content

Commit

Permalink
React Native sync for revisions f7cdc89...bd7f4a0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rickhanlonii authored and facebook-github-bot committed Apr 21, 2021
1 parent 06f52f7 commit 42dceaf
Show file tree
Hide file tree
Showing 7 changed files with 409 additions and 332 deletions.
2 changes: 1 addition & 1 deletion Libraries/Renderer/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f7cdc893618e9701a8e3403b2b63bfc8233c6771
bd7f4a013be3ef272a01874532bee71ad861e617
69 changes: 42 additions & 27 deletions Libraries/Renderer/implementations/ReactFabric-dev.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8e2b098b8adc0535d0c66734daceb246>>
* @generated SignedSource<<2ebb47c89a60a8b3e667fdf7431261b6>>
*/

'use strict';
Expand Down Expand Up @@ -3711,7 +3711,6 @@ function batchedUpdates(fn, bookkeeping) {
function setBatchingImplementation(
_batchedUpdatesImpl,
_discreteUpdatesImpl,
_flushDiscreteUpdatesImpl,
_batchedEventUpdatesImpl
) {
batchedUpdatesImpl = _batchedUpdatesImpl;
Expand Down Expand Up @@ -4361,12 +4360,19 @@ function computeExpirationTime(lane, currentTime) {
case TransitionLane14:
case TransitionLane15:
case TransitionLane16:
return currentTime + 5000;

case RetryLane1:
case RetryLane2:
case RetryLane3:
case RetryLane4:
case RetryLane5:
return currentTime + 5000;
// TODO: Retries should be allowed to expire if they are CPU bound for
// too long, but when I made this change it caused a spike in browser
// crashes. There must be some other underlying bug; not super urgent but
// ideally should figure out why and fix it. Unfortunately we don't have
// a repro for the crashes, only detected via production metrics.
return NoTimestamp;

case SelectiveHydrationLane:
case IdleHydrationLane:
Expand Down Expand Up @@ -4573,11 +4579,6 @@ function markRootExpired(root, expiredLanes) {
root.entangledLanes |= SyncLane;
root.pendingLanes |= SyncLane;
}
function areLanesExpired(root, lanes) {
var SyncLaneIndex = 0;
var entanglements = root.entanglements;
return (entanglements[SyncLaneIndex] & lanes) !== NoLanes;
}
function markRootMutableRead(root, updateLane) {
root.mutableReadLanes |= updateLane & root.pendingLanes;
}
Expand Down Expand Up @@ -18620,10 +18621,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
// all pending updates are included. If it still fails after the second
// attempt, we'll give up and commit the resulting tree.

lanes = getLanesToRetrySynchronouslyOnError(root);
var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root);

if (lanes !== NoLanes) {
exitStatus = renderRootSync(root, lanes);
if (errorRetryLanes !== NoLanes) {
lanes = errorRetryLanes;
exitStatus = renderRootSync(root, errorRetryLanes);
}
}

Expand Down Expand Up @@ -18788,22 +18790,25 @@ function performSyncWorkOnRoot(root) {
}

flushPassiveEffects();
var lanes;
var exitStatus;
var lanes = getNextLanes(root, NoLanes);

if (
root === workInProgressRoot &&
areLanesExpired(root, workInProgressRootRenderLanes)
) {
// There's a partial tree, and at least one of its lanes has expired. Finish
// rendering it before rendering the rest of the expired work.
lanes = workInProgressRootRenderLanes;
exitStatus = renderRootSync(root, lanes);
if (includesSomeLane(lanes, SyncLane)) {
if (
root === workInProgressRoot &&
includesSomeLane(lanes, workInProgressRootRenderLanes)
) {
// There's a partial tree, and at least one of its lanes has expired. Finish
// rendering it before rendering the rest of the expired work.
lanes = workInProgressRootRenderLanes;
}
} else {
lanes = getNextLanes(root, NoLanes);
exitStatus = renderRootSync(root, lanes);
// There's no remaining sync work left.
ensureRootIsScheduled(root, now());
return null;
}

var exitStatus = renderRootSync(root, lanes);

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

lanes = getLanesToRetrySynchronouslyOnError(root);
var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root);

if (lanes !== NoLanes) {
if (errorRetryLanes !== NoLanes) {
lanes = errorRetryLanes;
exitStatus = renderRootSync(root, lanes);
}
}
Expand Down Expand Up @@ -19364,6 +19370,15 @@ function commitRootImpl(root, renderPriorityLevel) {

if (finishedWork === null) {
return null;
} else {
{
if (lanes === NoLanes) {
error(
"root.finishedLanes should not be empty during a commit. This is a " +
"bug in React."
);
}
}
}

root.finishedWork = null;
Expand Down Expand Up @@ -19545,9 +19560,9 @@ function commitRootImpl(root, renderPriorityLevel) {

if (hasUncaughtError) {
hasUncaughtError = false;
var error = firstUncaughtError;
var error$1 = firstUncaughtError;
firstUncaughtError = null;
throw error;
throw error$1;
}

if ((executionContext & LegacyUnbatchedContext) !== NoContext) {
Expand Down
94 changes: 50 additions & 44 deletions Libraries/Renderer/implementations/ReactFabric-prod.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<90d01c86a28a69abef2fe93114ca8dd8>>
* @generated SignedSource<<f41656c617fa40163bc178f355249017>>
*/

"use strict";
Expand Down Expand Up @@ -930,7 +930,7 @@ eventPluginOrder = Array.prototype.slice.call([
"ReactNativeBridgeEventPlugin"
]);
recomputePluginOrdering();
var injectedNamesToPlugins$jscomp$inline_215 = {
var injectedNamesToPlugins$jscomp$inline_214 = {
ResponderEventPlugin: ResponderEventPlugin,
ReactNativeBridgeEventPlugin: {
eventTypes: {},
Expand Down Expand Up @@ -965,34 +965,34 @@ var injectedNamesToPlugins$jscomp$inline_215 = {
}
}
},
isOrderingDirty$jscomp$inline_216 = !1,
pluginName$jscomp$inline_217;
for (pluginName$jscomp$inline_217 in injectedNamesToPlugins$jscomp$inline_215)
isOrderingDirty$jscomp$inline_215 = !1,
pluginName$jscomp$inline_216;
for (pluginName$jscomp$inline_216 in injectedNamesToPlugins$jscomp$inline_214)
if (
injectedNamesToPlugins$jscomp$inline_215.hasOwnProperty(
pluginName$jscomp$inline_217
injectedNamesToPlugins$jscomp$inline_214.hasOwnProperty(
pluginName$jscomp$inline_216
)
) {
var pluginModule$jscomp$inline_218 =
injectedNamesToPlugins$jscomp$inline_215[pluginName$jscomp$inline_217];
var pluginModule$jscomp$inline_217 =
injectedNamesToPlugins$jscomp$inline_214[pluginName$jscomp$inline_216];
if (
!namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_217) ||
namesToPlugins[pluginName$jscomp$inline_217] !==
pluginModule$jscomp$inline_218
!namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_216) ||
namesToPlugins[pluginName$jscomp$inline_216] !==
pluginModule$jscomp$inline_217
) {
if (namesToPlugins[pluginName$jscomp$inline_217])
if (namesToPlugins[pluginName$jscomp$inline_216])
throw Error(
"EventPluginRegistry: Cannot inject two different event plugins using the same name, `" +
pluginName$jscomp$inline_217 +
pluginName$jscomp$inline_216 +
"`."
);
namesToPlugins[
pluginName$jscomp$inline_217
] = pluginModule$jscomp$inline_218;
isOrderingDirty$jscomp$inline_216 = !0;
pluginName$jscomp$inline_216
] = pluginModule$jscomp$inline_217;
isOrderingDirty$jscomp$inline_215 = !0;
}
}
isOrderingDirty$jscomp$inline_216 && recomputePluginOrdering();
isOrderingDirty$jscomp$inline_215 && recomputePluginOrdering();
function getInstanceFromInstance(instanceHandle) {
return instanceHandle;
}
Expand Down Expand Up @@ -1730,12 +1730,13 @@ function computeExpirationTime(lane, currentTime) {
case 524288:
case 1048576:
case 2097152:
return currentTime + 5e3;
case 4194304:
case 8388608:
case 16777216:
case 33554432:
case 67108864:
return currentTime + 5e3;
return -1;
case 134217728:
case 268435456:
case 536870912:
Expand Down Expand Up @@ -6138,8 +6139,10 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
2 === didTimeout &&
((executionContext |= 32),
root.hydrate && ((root.hydrate = !1), shim(root.containerInfo)),
(lanes = getLanesToRetrySynchronouslyOnError(root)),
0 !== lanes && (didTimeout = renderRootSync(root, lanes)));
(prevExecutionContext = getLanesToRetrySynchronouslyOnError(root)),
0 !== prevExecutionContext &&
((lanes = prevExecutionContext),
(didTimeout = renderRootSync(root, prevExecutionContext))));
if (1 === didTimeout)
throw ((originalCallbackNode = workInProgressRootFatalError),
prepareFreshStack(root, 0),
Expand Down Expand Up @@ -6241,17 +6244,20 @@ function performSyncWorkOnRoot(root) {
if (0 !== (executionContext & 24))
throw Error("Should not already be working.");
flushPassiveEffects();
var lanes;
if ((lanes = root === workInProgressRoot))
lanes = 0 !== (root.entanglements[0] & workInProgressRootRenderLanes);
lanes = lanes ? workInProgressRootRenderLanes : getNextLanes(root, 0);
var lanes = getNextLanes(root, 0);
if (0 !== (lanes & 1))
root === workInProgressRoot &&
0 !== (lanes & workInProgressRootRenderLanes) &&
(lanes = workInProgressRootRenderLanes);
else return ensureRootIsScheduled(root, now()), null;
var exitStatus = renderRootSync(root, lanes);
0 !== root.tag &&
2 === exitStatus &&
((executionContext |= 32),
root.hydrate && ((root.hydrate = !1), shim(root.containerInfo)),
(lanes = getLanesToRetrySynchronouslyOnError(root)),
0 !== lanes && (exitStatus = renderRootSync(root, lanes)));
if (0 !== root.tag && 2 === exitStatus) {
executionContext |= 32;
root.hydrate && ((root.hydrate = !1), shim(root.containerInfo));
var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root);
0 !== errorRetryLanes &&
((lanes = errorRetryLanes), (exitStatus = renderRootSync(root, lanes)));
}
if (1 === exitStatus)
throw ((exitStatus = workInProgressRootFatalError),
prepareFreshStack(root, 0),
Expand Down Expand Up @@ -7738,7 +7744,7 @@ batchedUpdatesImpl = function(fn, a) {
}
};
var roots = new Map(),
devToolsConfig$jscomp$inline_941 = {
devToolsConfig$jscomp$inline_934 = {
findFiberByHostInstance: getInstanceFromInstance,
bundleType: 0,
version: "17.0.3",
Expand All @@ -7756,11 +7762,11 @@ var roots = new Map(),
}.bind(null, findNodeHandle)
}
};
var internals$jscomp$inline_1175 = {
bundleType: devToolsConfig$jscomp$inline_941.bundleType,
version: devToolsConfig$jscomp$inline_941.version,
rendererPackageName: devToolsConfig$jscomp$inline_941.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_941.rendererConfig,
var internals$jscomp$inline_1168 = {
bundleType: devToolsConfig$jscomp$inline_934.bundleType,
version: devToolsConfig$jscomp$inline_934.version,
rendererPackageName: devToolsConfig$jscomp$inline_934.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_934.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -7775,7 +7781,7 @@ var internals$jscomp$inline_1175 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_941.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_934.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
Expand All @@ -7785,16 +7791,16 @@ var internals$jscomp$inline_1175 = {
reconcilerVersion: "17.0.3"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1176 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1169 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1176.isDisabled &&
hook$jscomp$inline_1176.supportsFiber
!hook$jscomp$inline_1169.isDisabled &&
hook$jscomp$inline_1169.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1176.inject(
internals$jscomp$inline_1175
(rendererID = hook$jscomp$inline_1169.inject(
internals$jscomp$inline_1168
)),
(injectedHook = hook$jscomp$inline_1176);
(injectedHook = hook$jscomp$inline_1169);
} catch (err) {}
}
exports.createPortal = function(children, containerTag) {
Expand Down
Loading

0 comments on commit 42dceaf

Please sign in to comment.