react-test-renderer 18.2.0 → 18.3.0-next-56389e81f-20220619
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3570,7 +3570,13 @@ function enqueueConcurrentRenderForLane(fiber, lane) {
|
|
|
3570
3570
|
var unsafe_markUpdateLaneFromFiberToRoot = markUpdateLaneFromFiberToRoot;
|
|
3571
3571
|
|
|
3572
3572
|
function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
|
3573
|
-
//
|
|
3573
|
+
// TODO: We will detect and infinite update loop and throw even if this fiber
|
|
3574
|
+
// has already unmounted. This isn't really necessary but it happens to be the
|
|
3575
|
+
// current behavior we've used for several release cycles. Consider not
|
|
3576
|
+
// performing this check if the updated fiber already unmounted, since it's
|
|
3577
|
+
// not possible for that to cause an infinite update loop.
|
|
3578
|
+
throwIfInfiniteUpdateLoopDetected(); // Update the source fiber's lanes
|
|
3579
|
+
|
|
3574
3580
|
sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane);
|
|
3575
3581
|
var alternate = sourceFiber.alternate;
|
|
3576
3582
|
|
|
@@ -4627,7 +4633,7 @@ function mountClassInstance(workInProgress, ctor, newProps, renderLanes) {
|
|
|
4627
4633
|
}
|
|
4628
4634
|
|
|
4629
4635
|
if (typeof instance.componentDidMount === 'function') {
|
|
4630
|
-
var fiberFlags = Update;
|
|
4636
|
+
var fiberFlags = Update | LayoutStatic;
|
|
4631
4637
|
|
|
4632
4638
|
workInProgress.flags |= fiberFlags;
|
|
4633
4639
|
}
|
|
@@ -4671,7 +4677,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) {
|
|
|
4671
4677
|
// If an update was already in progress, we should schedule an Update
|
|
4672
4678
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
4673
4679
|
if (typeof instance.componentDidMount === 'function') {
|
|
4674
|
-
var fiberFlags = Update;
|
|
4680
|
+
var fiberFlags = Update | LayoutStatic;
|
|
4675
4681
|
|
|
4676
4682
|
workInProgress.flags |= fiberFlags;
|
|
4677
4683
|
}
|
|
@@ -4700,7 +4706,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) {
|
|
|
4700
4706
|
}
|
|
4701
4707
|
|
|
4702
4708
|
if (typeof instance.componentDidMount === 'function') {
|
|
4703
|
-
var _fiberFlags = Update;
|
|
4709
|
+
var _fiberFlags = Update | LayoutStatic;
|
|
4704
4710
|
|
|
4705
4711
|
workInProgress.flags |= _fiberFlags;
|
|
4706
4712
|
}
|
|
@@ -4708,7 +4714,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) {
|
|
|
4708
4714
|
// If an update was already in progress, we should schedule an Update
|
|
4709
4715
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
4710
4716
|
if (typeof instance.componentDidMount === 'function') {
|
|
4711
|
-
var _fiberFlags2 = Update;
|
|
4717
|
+
var _fiberFlags2 = Update | LayoutStatic;
|
|
4712
4718
|
|
|
4713
4719
|
workInProgress.flags |= _fiberFlags2;
|
|
4714
4720
|
} // If shouldComponentUpdate returned false, we should still update the
|
|
@@ -7122,7 +7128,7 @@ function updateInsertionEffect(create, deps) {
|
|
|
7122
7128
|
}
|
|
7123
7129
|
|
|
7124
7130
|
function mountLayoutEffect(create, deps) {
|
|
7125
|
-
var fiberFlags = Update;
|
|
7131
|
+
var fiberFlags = Update | LayoutStatic;
|
|
7126
7132
|
|
|
7127
7133
|
return mountEffectImpl(fiberFlags, Layout, create, deps);
|
|
7128
7134
|
}
|
|
@@ -7168,7 +7174,7 @@ function mountImperativeHandle(ref, create, deps) {
|
|
|
7168
7174
|
|
|
7169
7175
|
|
|
7170
7176
|
var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
|
7171
|
-
var fiberFlags = Update;
|
|
7177
|
+
var fiberFlags = Update | LayoutStatic;
|
|
7172
7178
|
|
|
7173
7179
|
return mountEffectImpl(fiberFlags, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
|
7174
7180
|
}
|
|
@@ -9341,8 +9347,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) {
|
|
|
9341
9347
|
// TODO: Consider how Offscreen should work with transitions in the future
|
|
9342
9348
|
var nextState = {
|
|
9343
9349
|
baseLanes: NoLanes,
|
|
9344
|
-
cachePool: null
|
|
9345
|
-
transitions: null
|
|
9350
|
+
cachePool: null
|
|
9346
9351
|
};
|
|
9347
9352
|
workInProgress.memoizedState = nextState;
|
|
9348
9353
|
|
|
@@ -9364,8 +9369,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) {
|
|
|
9364
9369
|
workInProgress.lanes = workInProgress.childLanes = laneToLanes(OffscreenLane);
|
|
9365
9370
|
var _nextState = {
|
|
9366
9371
|
baseLanes: nextBaseLanes,
|
|
9367
|
-
cachePool: spawnedCachePool
|
|
9368
|
-
transitions: null
|
|
9372
|
+
cachePool: spawnedCachePool
|
|
9369
9373
|
};
|
|
9370
9374
|
workInProgress.memoizedState = _nextState;
|
|
9371
9375
|
workInProgress.updateQueue = null;
|
|
@@ -9381,8 +9385,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) {
|
|
|
9381
9385
|
// Rendering at offscreen, so we can clear the base lanes.
|
|
9382
9386
|
var _nextState2 = {
|
|
9383
9387
|
baseLanes: NoLanes,
|
|
9384
|
-
cachePool: null
|
|
9385
|
-
transitions: null
|
|
9388
|
+
cachePool: null
|
|
9386
9389
|
};
|
|
9387
9390
|
workInProgress.memoizedState = _nextState2; // Push the lanes that were skipped when we bailed out.
|
|
9388
9391
|
|
|
@@ -9450,6 +9453,7 @@ function markRef(current, workInProgress) {
|
|
|
9450
9453
|
if (current === null && ref !== null || current !== null && current.ref !== ref) {
|
|
9451
9454
|
// Schedule a Ref effect
|
|
9452
9455
|
workInProgress.flags |= Ref;
|
|
9456
|
+
workInProgress.flags |= RefStatic;
|
|
9453
9457
|
}
|
|
9454
9458
|
}
|
|
9455
9459
|
|
|
@@ -9983,8 +9987,7 @@ var SUSPENDED_MARKER = {
|
|
|
9983
9987
|
function mountSuspenseOffscreenState(renderLanes) {
|
|
9984
9988
|
return {
|
|
9985
9989
|
baseLanes: renderLanes,
|
|
9986
|
-
cachePool: getSuspendedCache()
|
|
9987
|
-
transitions: null
|
|
9990
|
+
cachePool: getSuspendedCache()
|
|
9988
9991
|
};
|
|
9989
9992
|
}
|
|
9990
9993
|
|
|
@@ -9993,8 +9996,7 @@ function updateSuspenseOffscreenState(prevOffscreenState, renderLanes) {
|
|
|
9993
9996
|
|
|
9994
9997
|
return {
|
|
9995
9998
|
baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes),
|
|
9996
|
-
cachePool: cachePool
|
|
9997
|
-
transitions: prevOffscreenState.transitions
|
|
9999
|
+
cachePool: cachePool
|
|
9998
10000
|
};
|
|
9999
10001
|
} // TODO: Probably should inline this back
|
|
10000
10002
|
|
|
@@ -11440,7 +11442,7 @@ function markUpdate(workInProgress) {
|
|
|
11440
11442
|
}
|
|
11441
11443
|
|
|
11442
11444
|
function markRef$1(workInProgress) {
|
|
11443
|
-
workInProgress.flags |= Ref;
|
|
11445
|
+
workInProgress.flags |= Ref | RefStatic;
|
|
11444
11446
|
}
|
|
11445
11447
|
|
|
11446
11448
|
var appendAllChildren;
|
|
@@ -12448,6 +12450,10 @@ function unwindWork(current, workInProgress, renderLanes) {
|
|
|
12448
12450
|
|
|
12449
12451
|
return null;
|
|
12450
12452
|
|
|
12453
|
+
case TracingMarkerComponent:
|
|
12454
|
+
|
|
12455
|
+
return null;
|
|
12456
|
+
|
|
12451
12457
|
default:
|
|
12452
12458
|
return null;
|
|
12453
12459
|
}
|
|
@@ -12724,6 +12730,11 @@ var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
|
12724
12730
|
{
|
|
12725
12731
|
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
|
12726
12732
|
} // Used during the commit phase to track the state of the Offscreen component stack.
|
|
12733
|
+
// Allows us to avoid traversing the return path to find the nearest Offscreen ancestor.
|
|
12734
|
+
|
|
12735
|
+
|
|
12736
|
+
var offscreenSubtreeIsHidden = false;
|
|
12737
|
+
var offscreenSubtreeWasHidden = false;
|
|
12727
12738
|
var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
12728
12739
|
var nextEffect = null; // Used for Profiling builds to track updaters.
|
|
12729
12740
|
function reportUncaughtErrorInDEV(error) {
|
|
@@ -12757,6 +12768,15 @@ var callComponentWillUnmountWithTimer = function (current, instance) {
|
|
|
12757
12768
|
}; // Capture errors so they don't interrupt mounting.
|
|
12758
12769
|
|
|
12759
12770
|
|
|
12771
|
+
function safelyCallCommitHookLayoutEffectListMount(current, nearestMountedAncestor) {
|
|
12772
|
+
try {
|
|
12773
|
+
commitHookEffectListMount(Layout, current);
|
|
12774
|
+
} catch (error) {
|
|
12775
|
+
captureCommitPhaseError(current, nearestMountedAncestor, error);
|
|
12776
|
+
}
|
|
12777
|
+
} // Capture errors so they don't interrupt unmounting.
|
|
12778
|
+
|
|
12779
|
+
|
|
12760
12780
|
function safelyCallComponentWillUnmount(current, nearestMountedAncestor, instance) {
|
|
12761
12781
|
try {
|
|
12762
12782
|
callComponentWillUnmountWithTimer(current, instance);
|
|
@@ -12765,6 +12785,24 @@ function safelyCallComponentWillUnmount(current, nearestMountedAncestor, instanc
|
|
|
12765
12785
|
}
|
|
12766
12786
|
} // Capture errors so they don't interrupt mounting.
|
|
12767
12787
|
|
|
12788
|
+
|
|
12789
|
+
function safelyCallComponentDidMount(current, nearestMountedAncestor, instance) {
|
|
12790
|
+
try {
|
|
12791
|
+
instance.componentDidMount();
|
|
12792
|
+
} catch (error) {
|
|
12793
|
+
captureCommitPhaseError(current, nearestMountedAncestor, error);
|
|
12794
|
+
}
|
|
12795
|
+
} // Capture errors so they don't interrupt mounting.
|
|
12796
|
+
|
|
12797
|
+
|
|
12798
|
+
function safelyAttachRef(current, nearestMountedAncestor) {
|
|
12799
|
+
try {
|
|
12800
|
+
commitAttachRef(current);
|
|
12801
|
+
} catch (error) {
|
|
12802
|
+
captureCommitPhaseError(current, nearestMountedAncestor, error);
|
|
12803
|
+
}
|
|
12804
|
+
}
|
|
12805
|
+
|
|
12768
12806
|
function safelyDetachRef(current, nearestMountedAncestor) {
|
|
12769
12807
|
var ref = current.ref;
|
|
12770
12808
|
|
|
@@ -13098,7 +13136,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe
|
|
|
13098
13136
|
case ForwardRef:
|
|
13099
13137
|
case SimpleMemoComponent:
|
|
13100
13138
|
{
|
|
13101
|
-
{
|
|
13139
|
+
if (!offscreenSubtreeWasHidden) {
|
|
13102
13140
|
// At this point layout effects have already been destroyed (during mutation phase).
|
|
13103
13141
|
// This is done to prevent sibling component effects from interfering with each other,
|
|
13104
13142
|
// e.g. a destroy function in one component should never override a ref set
|
|
@@ -13123,7 +13161,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe
|
|
|
13123
13161
|
var instance = finishedWork.stateNode;
|
|
13124
13162
|
|
|
13125
13163
|
if (finishedWork.flags & Update) {
|
|
13126
|
-
{
|
|
13164
|
+
if (!offscreenSubtreeWasHidden) {
|
|
13127
13165
|
if (current === null) {
|
|
13128
13166
|
// We could update instance props and state here,
|
|
13129
13167
|
// but instead we rely on them being set during last render.
|
|
@@ -13336,7 +13374,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe
|
|
|
13336
13374
|
}
|
|
13337
13375
|
}
|
|
13338
13376
|
|
|
13339
|
-
{
|
|
13377
|
+
if (!offscreenSubtreeWasHidden) {
|
|
13340
13378
|
{
|
|
13341
13379
|
if (finishedWork.flags & Ref) {
|
|
13342
13380
|
commitAttachRef(finishedWork);
|
|
@@ -13345,6 +13383,48 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe
|
|
|
13345
13383
|
}
|
|
13346
13384
|
}
|
|
13347
13385
|
|
|
13386
|
+
function reappearLayoutEffectsOnFiber(node) {
|
|
13387
|
+
// Turn on layout effects in a tree that previously disappeared.
|
|
13388
|
+
// TODO (Offscreen) Check: flags & LayoutStatic
|
|
13389
|
+
switch (node.tag) {
|
|
13390
|
+
case FunctionComponent:
|
|
13391
|
+
case ForwardRef:
|
|
13392
|
+
case SimpleMemoComponent:
|
|
13393
|
+
{
|
|
13394
|
+
if ( node.mode & ProfileMode) {
|
|
13395
|
+
try {
|
|
13396
|
+
startLayoutEffectTimer();
|
|
13397
|
+
safelyCallCommitHookLayoutEffectListMount(node, node.return);
|
|
13398
|
+
} finally {
|
|
13399
|
+
recordLayoutEffectDuration(node);
|
|
13400
|
+
}
|
|
13401
|
+
} else {
|
|
13402
|
+
safelyCallCommitHookLayoutEffectListMount(node, node.return);
|
|
13403
|
+
}
|
|
13404
|
+
|
|
13405
|
+
break;
|
|
13406
|
+
}
|
|
13407
|
+
|
|
13408
|
+
case ClassComponent:
|
|
13409
|
+
{
|
|
13410
|
+
var instance = node.stateNode;
|
|
13411
|
+
|
|
13412
|
+
if (typeof instance.componentDidMount === 'function') {
|
|
13413
|
+
safelyCallComponentDidMount(node, node.return, instance);
|
|
13414
|
+
}
|
|
13415
|
+
|
|
13416
|
+
safelyAttachRef(node, node.return);
|
|
13417
|
+
break;
|
|
13418
|
+
}
|
|
13419
|
+
|
|
13420
|
+
case HostComponent:
|
|
13421
|
+
{
|
|
13422
|
+
safelyAttachRef(node, node.return);
|
|
13423
|
+
break;
|
|
13424
|
+
}
|
|
13425
|
+
}
|
|
13426
|
+
}
|
|
13427
|
+
|
|
13348
13428
|
function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
|
13349
13429
|
// Only hide or unhide the top-most host nodes.
|
|
13350
13430
|
var hostSubtreeRoot = null;
|
|
@@ -13790,7 +13870,7 @@ function commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, dele
|
|
|
13790
13870
|
switch (deletedFiber.tag) {
|
|
13791
13871
|
case HostComponent:
|
|
13792
13872
|
{
|
|
13793
|
-
{
|
|
13873
|
+
if (!offscreenSubtreeWasHidden) {
|
|
13794
13874
|
safelyDetachRef(deletedFiber, nearestMountedAncestor);
|
|
13795
13875
|
} // Intentional fallthrough to next branch
|
|
13796
13876
|
|
|
@@ -13863,7 +13943,7 @@ function commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, dele
|
|
|
13863
13943
|
case MemoComponent:
|
|
13864
13944
|
case SimpleMemoComponent:
|
|
13865
13945
|
{
|
|
13866
|
-
{
|
|
13946
|
+
if (!offscreenSubtreeWasHidden) {
|
|
13867
13947
|
var updateQueue = deletedFiber.updateQueue;
|
|
13868
13948
|
|
|
13869
13949
|
if (updateQueue !== null) {
|
|
@@ -13905,7 +13985,7 @@ function commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, dele
|
|
|
13905
13985
|
|
|
13906
13986
|
case ClassComponent:
|
|
13907
13987
|
{
|
|
13908
|
-
{
|
|
13988
|
+
if (!offscreenSubtreeWasHidden) {
|
|
13909
13989
|
safelyDetachRef(deletedFiber, nearestMountedAncestor);
|
|
13910
13990
|
var instance = deletedFiber.stateNode;
|
|
13911
13991
|
|
|
@@ -13927,7 +14007,21 @@ function commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, dele
|
|
|
13927
14007
|
|
|
13928
14008
|
case OffscreenComponent:
|
|
13929
14009
|
{
|
|
13930
|
-
{
|
|
14010
|
+
if (deletedFiber.mode & ConcurrentMode) {
|
|
14011
|
+
// If this offscreen component is hidden, we already unmounted it. Before
|
|
14012
|
+
// deleting the children, track that it's already unmounted so that we
|
|
14013
|
+
// don't attempt to unmount the effects again.
|
|
14014
|
+
// TODO: If the tree is hidden, in most cases we should be able to skip
|
|
14015
|
+
// over the nested children entirely. An exception is we haven't yet found
|
|
14016
|
+
// the topmost host node to delete, which we already track on the stack.
|
|
14017
|
+
// But the other case is portals, which need to be detached no matter how
|
|
14018
|
+
// deeply they are nested. We should use a subtree flag to track whether a
|
|
14019
|
+
// subtree includes a nested portal.
|
|
14020
|
+
var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
|
|
14021
|
+
offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || deletedFiber.memoizedState !== null;
|
|
14022
|
+
recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
|
|
14023
|
+
offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
|
|
14024
|
+
} else {
|
|
13931
14025
|
recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
|
|
13932
14026
|
}
|
|
13933
14027
|
|
|
@@ -14217,7 +14311,15 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) {
|
|
|
14217
14311
|
{
|
|
14218
14312
|
var _wasHidden = current !== null && current.memoizedState !== null;
|
|
14219
14313
|
|
|
14220
|
-
{
|
|
14314
|
+
if (finishedWork.mode & ConcurrentMode) {
|
|
14315
|
+
// Before committing the children, track on the stack whether this
|
|
14316
|
+
// offscreen subtree was already hidden, so that we don't unmount the
|
|
14317
|
+
// effects again.
|
|
14318
|
+
var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
|
|
14319
|
+
offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || _wasHidden;
|
|
14320
|
+
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
14321
|
+
offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
|
|
14322
|
+
} else {
|
|
14221
14323
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
14222
14324
|
}
|
|
14223
14325
|
|
|
@@ -14234,6 +14336,21 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) {
|
|
|
14234
14336
|
|
|
14235
14337
|
_offscreenInstance.isHidden = _isHidden;
|
|
14236
14338
|
|
|
14339
|
+
if (_isHidden) {
|
|
14340
|
+
if (!_wasHidden) {
|
|
14341
|
+
if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
|
|
14342
|
+
nextEffect = offscreenBoundary;
|
|
14343
|
+
var offscreenChild = offscreenBoundary.child;
|
|
14344
|
+
|
|
14345
|
+
while (offscreenChild !== null) {
|
|
14346
|
+
nextEffect = offscreenChild;
|
|
14347
|
+
disappearLayoutEffects_begin(offscreenChild);
|
|
14348
|
+
offscreenChild = offscreenChild.sibling;
|
|
14349
|
+
}
|
|
14350
|
+
}
|
|
14351
|
+
}
|
|
14352
|
+
}
|
|
14353
|
+
|
|
14237
14354
|
{
|
|
14238
14355
|
// TODO: This needs to run whenever there's an insertion or update
|
|
14239
14356
|
// inside a hidden Offscreen tree.
|
|
@@ -14309,6 +14426,51 @@ function commitLayoutEffects_begin(subtreeRoot, root, committedLanes) {
|
|
|
14309
14426
|
var fiber = nextEffect;
|
|
14310
14427
|
var firstChild = fiber.child;
|
|
14311
14428
|
|
|
14429
|
+
if (fiber.tag === OffscreenComponent && isModernRoot) {
|
|
14430
|
+
// Keep track of the current Offscreen stack's state.
|
|
14431
|
+
var isHidden = fiber.memoizedState !== null;
|
|
14432
|
+
var newOffscreenSubtreeIsHidden = isHidden || offscreenSubtreeIsHidden;
|
|
14433
|
+
|
|
14434
|
+
if (newOffscreenSubtreeIsHidden) {
|
|
14435
|
+
// The Offscreen tree is hidden. Skip over its layout effects.
|
|
14436
|
+
commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes);
|
|
14437
|
+
continue;
|
|
14438
|
+
} else {
|
|
14439
|
+
// TODO (Offscreen) Also check: subtreeFlags & LayoutMask
|
|
14440
|
+
var current = fiber.alternate;
|
|
14441
|
+
var wasHidden = current !== null && current.memoizedState !== null;
|
|
14442
|
+
var newOffscreenSubtreeWasHidden = wasHidden || offscreenSubtreeWasHidden;
|
|
14443
|
+
var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden;
|
|
14444
|
+
var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; // Traverse the Offscreen subtree with the current Offscreen as the root.
|
|
14445
|
+
|
|
14446
|
+
offscreenSubtreeIsHidden = newOffscreenSubtreeIsHidden;
|
|
14447
|
+
offscreenSubtreeWasHidden = newOffscreenSubtreeWasHidden;
|
|
14448
|
+
|
|
14449
|
+
if (offscreenSubtreeWasHidden && !prevOffscreenSubtreeWasHidden) {
|
|
14450
|
+
// This is the root of a reappearing boundary. Turn its layout effects
|
|
14451
|
+
// back on.
|
|
14452
|
+
nextEffect = fiber;
|
|
14453
|
+
reappearLayoutEffects_begin(fiber);
|
|
14454
|
+
}
|
|
14455
|
+
|
|
14456
|
+
var child = firstChild;
|
|
14457
|
+
|
|
14458
|
+
while (child !== null) {
|
|
14459
|
+
nextEffect = child;
|
|
14460
|
+
commitLayoutEffects_begin(child, // New root; bubble back up to here and stop.
|
|
14461
|
+
root, committedLanes);
|
|
14462
|
+
child = child.sibling;
|
|
14463
|
+
} // Restore Offscreen state and resume in our-progress traversal.
|
|
14464
|
+
|
|
14465
|
+
|
|
14466
|
+
nextEffect = fiber;
|
|
14467
|
+
offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden;
|
|
14468
|
+
offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
|
|
14469
|
+
commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes);
|
|
14470
|
+
continue;
|
|
14471
|
+
}
|
|
14472
|
+
}
|
|
14473
|
+
|
|
14312
14474
|
if ((fiber.subtreeFlags & LayoutMask) !== NoFlags && firstChild !== null) {
|
|
14313
14475
|
firstChild.return = fiber;
|
|
14314
14476
|
nextEffect = firstChild;
|
|
@@ -14352,6 +14514,157 @@ function commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes) {
|
|
|
14352
14514
|
}
|
|
14353
14515
|
}
|
|
14354
14516
|
|
|
14517
|
+
function disappearLayoutEffects_begin(subtreeRoot) {
|
|
14518
|
+
while (nextEffect !== null) {
|
|
14519
|
+
var fiber = nextEffect;
|
|
14520
|
+
var firstChild = fiber.child; // TODO (Offscreen) Check: flags & (RefStatic | LayoutStatic)
|
|
14521
|
+
|
|
14522
|
+
switch (fiber.tag) {
|
|
14523
|
+
case FunctionComponent:
|
|
14524
|
+
case ForwardRef:
|
|
14525
|
+
case MemoComponent:
|
|
14526
|
+
case SimpleMemoComponent:
|
|
14527
|
+
{
|
|
14528
|
+
if ( fiber.mode & ProfileMode) {
|
|
14529
|
+
try {
|
|
14530
|
+
startLayoutEffectTimer();
|
|
14531
|
+
commitHookEffectListUnmount(Layout, fiber, fiber.return);
|
|
14532
|
+
} finally {
|
|
14533
|
+
recordLayoutEffectDuration(fiber);
|
|
14534
|
+
}
|
|
14535
|
+
} else {
|
|
14536
|
+
commitHookEffectListUnmount(Layout, fiber, fiber.return);
|
|
14537
|
+
}
|
|
14538
|
+
|
|
14539
|
+
break;
|
|
14540
|
+
}
|
|
14541
|
+
|
|
14542
|
+
case ClassComponent:
|
|
14543
|
+
{
|
|
14544
|
+
// TODO (Offscreen) Check: flags & RefStatic
|
|
14545
|
+
safelyDetachRef(fiber, fiber.return);
|
|
14546
|
+
var instance = fiber.stateNode;
|
|
14547
|
+
|
|
14548
|
+
if (typeof instance.componentWillUnmount === 'function') {
|
|
14549
|
+
safelyCallComponentWillUnmount(fiber, fiber.return, instance);
|
|
14550
|
+
}
|
|
14551
|
+
|
|
14552
|
+
break;
|
|
14553
|
+
}
|
|
14554
|
+
|
|
14555
|
+
case HostComponent:
|
|
14556
|
+
{
|
|
14557
|
+
safelyDetachRef(fiber, fiber.return);
|
|
14558
|
+
break;
|
|
14559
|
+
}
|
|
14560
|
+
|
|
14561
|
+
case OffscreenComponent:
|
|
14562
|
+
{
|
|
14563
|
+
// Check if this is a
|
|
14564
|
+
var isHidden = fiber.memoizedState !== null;
|
|
14565
|
+
|
|
14566
|
+
if (isHidden) {
|
|
14567
|
+
// Nested Offscreen tree is already hidden. Don't disappear
|
|
14568
|
+
// its effects.
|
|
14569
|
+
disappearLayoutEffects_complete(subtreeRoot);
|
|
14570
|
+
continue;
|
|
14571
|
+
}
|
|
14572
|
+
|
|
14573
|
+
break;
|
|
14574
|
+
}
|
|
14575
|
+
} // TODO (Offscreen) Check: subtreeFlags & LayoutStatic
|
|
14576
|
+
|
|
14577
|
+
|
|
14578
|
+
if (firstChild !== null) {
|
|
14579
|
+
firstChild.return = fiber;
|
|
14580
|
+
nextEffect = firstChild;
|
|
14581
|
+
} else {
|
|
14582
|
+
disappearLayoutEffects_complete(subtreeRoot);
|
|
14583
|
+
}
|
|
14584
|
+
}
|
|
14585
|
+
}
|
|
14586
|
+
|
|
14587
|
+
function disappearLayoutEffects_complete(subtreeRoot) {
|
|
14588
|
+
while (nextEffect !== null) {
|
|
14589
|
+
var fiber = nextEffect;
|
|
14590
|
+
|
|
14591
|
+
if (fiber === subtreeRoot) {
|
|
14592
|
+
nextEffect = null;
|
|
14593
|
+
return;
|
|
14594
|
+
}
|
|
14595
|
+
|
|
14596
|
+
var sibling = fiber.sibling;
|
|
14597
|
+
|
|
14598
|
+
if (sibling !== null) {
|
|
14599
|
+
sibling.return = fiber.return;
|
|
14600
|
+
nextEffect = sibling;
|
|
14601
|
+
return;
|
|
14602
|
+
}
|
|
14603
|
+
|
|
14604
|
+
nextEffect = fiber.return;
|
|
14605
|
+
}
|
|
14606
|
+
}
|
|
14607
|
+
|
|
14608
|
+
function reappearLayoutEffects_begin(subtreeRoot) {
|
|
14609
|
+
while (nextEffect !== null) {
|
|
14610
|
+
var fiber = nextEffect;
|
|
14611
|
+
var firstChild = fiber.child;
|
|
14612
|
+
|
|
14613
|
+
if (fiber.tag === OffscreenComponent) {
|
|
14614
|
+
var isHidden = fiber.memoizedState !== null;
|
|
14615
|
+
|
|
14616
|
+
if (isHidden) {
|
|
14617
|
+
// Nested Offscreen tree is still hidden. Don't re-appear its effects.
|
|
14618
|
+
reappearLayoutEffects_complete(subtreeRoot);
|
|
14619
|
+
continue;
|
|
14620
|
+
}
|
|
14621
|
+
} // TODO (Offscreen) Check: subtreeFlags & LayoutStatic
|
|
14622
|
+
|
|
14623
|
+
|
|
14624
|
+
if (firstChild !== null) {
|
|
14625
|
+
// This node may have been reused from a previous render, so we can't
|
|
14626
|
+
// assume its return pointer is correct.
|
|
14627
|
+
firstChild.return = fiber;
|
|
14628
|
+
nextEffect = firstChild;
|
|
14629
|
+
} else {
|
|
14630
|
+
reappearLayoutEffects_complete(subtreeRoot);
|
|
14631
|
+
}
|
|
14632
|
+
}
|
|
14633
|
+
}
|
|
14634
|
+
|
|
14635
|
+
function reappearLayoutEffects_complete(subtreeRoot) {
|
|
14636
|
+
while (nextEffect !== null) {
|
|
14637
|
+
var fiber = nextEffect; // TODO (Offscreen) Check: flags & LayoutStatic
|
|
14638
|
+
|
|
14639
|
+
setCurrentFiber(fiber);
|
|
14640
|
+
|
|
14641
|
+
try {
|
|
14642
|
+
reappearLayoutEffectsOnFiber(fiber);
|
|
14643
|
+
} catch (error) {
|
|
14644
|
+
captureCommitPhaseError(fiber, fiber.return, error);
|
|
14645
|
+
}
|
|
14646
|
+
|
|
14647
|
+
resetCurrentFiber();
|
|
14648
|
+
|
|
14649
|
+
if (fiber === subtreeRoot) {
|
|
14650
|
+
nextEffect = null;
|
|
14651
|
+
return;
|
|
14652
|
+
}
|
|
14653
|
+
|
|
14654
|
+
var sibling = fiber.sibling;
|
|
14655
|
+
|
|
14656
|
+
if (sibling !== null) {
|
|
14657
|
+
// This node may have been reused from a previous render, so we can't
|
|
14658
|
+
// assume its return pointer is correct.
|
|
14659
|
+
sibling.return = fiber.return;
|
|
14660
|
+
nextEffect = sibling;
|
|
14661
|
+
return;
|
|
14662
|
+
}
|
|
14663
|
+
|
|
14664
|
+
nextEffect = fiber.return;
|
|
14665
|
+
}
|
|
14666
|
+
}
|
|
14667
|
+
|
|
14355
14668
|
function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) {
|
|
14356
14669
|
nextEffect = finishedWork;
|
|
14357
14670
|
commitPassiveMountEffects_begin(finishedWork, root, committedLanes, committedTransitions);
|
|
@@ -14848,8 +15161,6 @@ function requestRetryLane(fiber) {
|
|
|
14848
15161
|
}
|
|
14849
15162
|
|
|
14850
15163
|
function scheduleUpdateOnFiber(root, fiber, lane, eventTime) {
|
|
14851
|
-
checkForNestedUpdates();
|
|
14852
|
-
|
|
14853
15164
|
{
|
|
14854
15165
|
if (isRunningInsertionEffect) {
|
|
14855
15166
|
error('useInsertionEffect must not schedule updates.');
|
|
@@ -16486,7 +16797,7 @@ function jnd(timeElapsed) {
|
|
|
16486
16797
|
return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960;
|
|
16487
16798
|
}
|
|
16488
16799
|
|
|
16489
|
-
function
|
|
16800
|
+
function throwIfInfiniteUpdateLoopDetected() {
|
|
16490
16801
|
if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
|
|
16491
16802
|
nestedUpdateCount = 0;
|
|
16492
16803
|
rootWithNestedUpdates = null;
|
|
@@ -17594,7 +17905,9 @@ function createFiberFromOffscreen(pendingProps, mode, lanes, key) {
|
|
|
17594
17905
|
fiber.elementType = REACT_OFFSCREEN_TYPE;
|
|
17595
17906
|
fiber.lanes = lanes;
|
|
17596
17907
|
var primaryChildInstance = {
|
|
17597
|
-
isHidden: false
|
|
17908
|
+
isHidden: false,
|
|
17909
|
+
pendingMarkers: null,
|
|
17910
|
+
transitions: null
|
|
17598
17911
|
};
|
|
17599
17912
|
fiber.stateNode = primaryChildInstance;
|
|
17600
17913
|
return fiber;
|
|
@@ -17679,8 +17992,7 @@ identifierPrefix, onRecoverableError, transitionCallbacks) {
|
|
|
17679
17992
|
isDehydrated: hydrate,
|
|
17680
17993
|
cache: null,
|
|
17681
17994
|
// not enabled yet
|
|
17682
|
-
|
|
17683
|
-
pendingSuspenseBoundaries: null
|
|
17995
|
+
incompleteTransitions: null
|
|
17684
17996
|
};
|
|
17685
17997
|
uninitializedFiber.memoizedState = _initialState;
|
|
17686
17998
|
}
|
|
@@ -17689,7 +18001,7 @@ identifierPrefix, onRecoverableError, transitionCallbacks) {
|
|
|
17689
18001
|
return root;
|
|
17690
18002
|
}
|
|
17691
18003
|
|
|
17692
|
-
var ReactVersion = '18.
|
|
18004
|
+
var ReactVersion = '18.3.0-next-56389e81f-20220619';
|
|
17693
18005
|
|
|
17694
18006
|
var didWarnAboutNestedUpdates;
|
|
17695
18007
|
|