react-test-renderer 17.0.0-rc.1 → 17.0.1
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React
|
|
1
|
+
/** @license React v17.0.1
|
|
2
2
|
* react-test-renderer.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -12,40 +12,6 @@
|
|
|
12
12
|
(global = global || self, factory(global.ReactTestRenderer = {}, global.React, global.SchedulerMock, global.Scheduler));
|
|
13
13
|
}(this, (function (exports, React, Scheduler, Scheduler$1) { 'use strict';
|
|
14
14
|
|
|
15
|
-
function _defineProperties(target, props) {
|
|
16
|
-
for (var i = 0; i < props.length; i++) {
|
|
17
|
-
var descriptor = props[i];
|
|
18
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
19
|
-
descriptor.configurable = true;
|
|
20
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
21
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
26
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
27
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
28
|
-
return Constructor;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
32
|
-
if (source == null) return {};
|
|
33
|
-
var target = {};
|
|
34
|
-
var sourceKeys = Object.keys(source);
|
|
35
|
-
var key, i;
|
|
36
|
-
|
|
37
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
38
|
-
key = sourceKeys[i];
|
|
39
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
40
|
-
target[key] = source[key];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return target;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
47
|
-
var _assign = ReactInternals.assign;
|
|
48
|
-
|
|
49
15
|
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
50
16
|
|
|
51
17
|
// by calls to these methods by a Babel plugin.
|
|
@@ -96,6 +62,40 @@
|
|
|
96
62
|
}
|
|
97
63
|
}
|
|
98
64
|
|
|
65
|
+
function _defineProperties(target, props) {
|
|
66
|
+
for (var i = 0; i < props.length; i++) {
|
|
67
|
+
var descriptor = props[i];
|
|
68
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
69
|
+
descriptor.configurable = true;
|
|
70
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
71
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
76
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
77
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
78
|
+
return Constructor;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
82
|
+
if (source == null) return {};
|
|
83
|
+
var target = {};
|
|
84
|
+
var sourceKeys = Object.keys(source);
|
|
85
|
+
var key, i;
|
|
86
|
+
|
|
87
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
88
|
+
key = sourceKeys[i];
|
|
89
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
90
|
+
target[key] = source[key];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return target;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
97
|
+
var _assign = ReactInternals.assign;
|
|
98
|
+
|
|
99
99
|
var FunctionComponent = 0;
|
|
100
100
|
var ClassComponent = 1;
|
|
101
101
|
var IndeterminateComponent = 2; // Before we know whether it is function or class
|
|
@@ -244,7 +244,7 @@
|
|
|
244
244
|
return 'Portal';
|
|
245
245
|
|
|
246
246
|
case REACT_PROFILER_TYPE:
|
|
247
|
-
return
|
|
247
|
+
return 'Profiler';
|
|
248
248
|
|
|
249
249
|
case REACT_STRICT_MODE_TYPE:
|
|
250
250
|
return 'StrictMode';
|
|
@@ -294,8 +294,8 @@
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
// Don't change these two values. They're used by React Dev Tools.
|
|
297
|
-
var
|
|
298
|
-
/*
|
|
297
|
+
var NoFlags =
|
|
298
|
+
/* */
|
|
299
299
|
0;
|
|
300
300
|
var PerformedWork =
|
|
301
301
|
/* */
|
|
@@ -378,7 +378,7 @@
|
|
|
378
378
|
do {
|
|
379
379
|
node = nextNode;
|
|
380
380
|
|
|
381
|
-
if ((node.
|
|
381
|
+
if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
382
382
|
// This is an insertion or in-progress hydration. The nearest possible
|
|
383
383
|
// mounted fiber is the parent but we need to continue to figure out
|
|
384
384
|
// if that one is still mounted.
|
|
@@ -1592,7 +1592,7 @@
|
|
|
1592
1592
|
function onCommitRoot(root, priorityLevel) {
|
|
1593
1593
|
if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') {
|
|
1594
1594
|
try {
|
|
1595
|
-
var didError = (root.current.
|
|
1595
|
+
var didError = (root.current.flags & DidCapture) === DidCapture;
|
|
1596
1596
|
|
|
1597
1597
|
if (enableProfilerTimer) {
|
|
1598
1598
|
injectedHook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
|
@@ -2032,7 +2032,21 @@
|
|
|
2032
2032
|
|
|
2033
2033
|
if (priority >= InputContinuousLanePriority) {
|
|
2034
2034
|
// User interactions should expire slightly more quickly.
|
|
2035
|
-
|
|
2035
|
+
//
|
|
2036
|
+
// NOTE: This is set to the corresponding constant as in Scheduler.js. When
|
|
2037
|
+
// we made it larger, a product metric in www regressed, suggesting there's
|
|
2038
|
+
// a user interaction that's being starved by a series of synchronous
|
|
2039
|
+
// updates. If that theory is correct, the proper solution is to fix the
|
|
2040
|
+
// starvation. However, this scenario supports the idea that expiration
|
|
2041
|
+
// times are an important safeguard when starvation does happen.
|
|
2042
|
+
//
|
|
2043
|
+
// Also note that, in the case of user input specifically, this will soon no
|
|
2044
|
+
// longer be an issue because we plan to make user input synchronous by
|
|
2045
|
+
// default (until you enter `startTransition`, of course.)
|
|
2046
|
+
//
|
|
2047
|
+
// If weren't planning to make these updates synchronous soon anyway, I
|
|
2048
|
+
// would probably make this number a configurable parameter.
|
|
2049
|
+
return currentTime + 250;
|
|
2036
2050
|
} else if (priority >= TransitionPriority) {
|
|
2037
2051
|
return currentTime + 5000;
|
|
2038
2052
|
} else {
|
|
@@ -2263,7 +2277,15 @@
|
|
|
2263
2277
|
return lane;
|
|
2264
2278
|
}
|
|
2265
2279
|
function createLaneMap(initial) {
|
|
2266
|
-
|
|
2280
|
+
// Intentionally pushing one by one.
|
|
2281
|
+
// https://v8.dev/blog/elements-kinds#avoid-creating-holes
|
|
2282
|
+
var laneMap = [];
|
|
2283
|
+
|
|
2284
|
+
for (var i = 0; i < TotalLanes; i++) {
|
|
2285
|
+
laneMap.push(initial);
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
return laneMap;
|
|
2267
2289
|
}
|
|
2268
2290
|
function markRootUpdated(root, updateLane, eventTime) {
|
|
2269
2291
|
root.pendingLanes |= updateLane; // TODO: Theoretically, any update to any lane can unblock any other lane. But
|
|
@@ -2542,7 +2564,7 @@
|
|
|
2542
2564
|
}
|
|
2543
2565
|
|
|
2544
2566
|
// TODO: this is special because it gets imported during build.
|
|
2545
|
-
var ReactVersion = '17.0.
|
|
2567
|
+
var ReactVersion = '17.0.1';
|
|
2546
2568
|
|
|
2547
2569
|
var NoMode = 0;
|
|
2548
2570
|
var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root
|
|
@@ -2553,6 +2575,12 @@
|
|
|
2553
2575
|
var ProfileMode = 8;
|
|
2554
2576
|
var DebugTracingMode = 16;
|
|
2555
2577
|
|
|
2578
|
+
var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
2579
|
+
var NoTransition = 0;
|
|
2580
|
+
function requestCurrentTransition() {
|
|
2581
|
+
return ReactCurrentBatchConfig.transition;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2556
2584
|
/**
|
|
2557
2585
|
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
2558
2586
|
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
@@ -3417,7 +3445,7 @@
|
|
|
3417
3445
|
|
|
3418
3446
|
case CaptureUpdate:
|
|
3419
3447
|
{
|
|
3420
|
-
workInProgress.
|
|
3448
|
+
workInProgress.flags = workInProgress.flags & ~ShouldCapture | DidCapture;
|
|
3421
3449
|
}
|
|
3422
3450
|
// Intentional fallthrough
|
|
3423
3451
|
|
|
@@ -3575,7 +3603,7 @@
|
|
|
3575
3603
|
var callback = update.callback;
|
|
3576
3604
|
|
|
3577
3605
|
if (callback !== null) {
|
|
3578
|
-
workInProgress.
|
|
3606
|
+
workInProgress.flags |= Callback;
|
|
3579
3607
|
var effects = queue.effects;
|
|
3580
3608
|
|
|
3581
3609
|
if (effects === null) {
|
|
@@ -3666,11 +3694,6 @@
|
|
|
3666
3694
|
}
|
|
3667
3695
|
}
|
|
3668
3696
|
|
|
3669
|
-
var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
3670
|
-
function requestCurrentSuspenseConfig() {
|
|
3671
|
-
return ReactCurrentBatchConfig.suspense;
|
|
3672
|
-
}
|
|
3673
|
-
|
|
3674
3697
|
var fakeInternalInstance = {};
|
|
3675
3698
|
var isArray = Array.isArray; // React.Component uses a shared frozen object by default.
|
|
3676
3699
|
// We'll use it to determine whether we need to initialize legacy refs.
|
|
@@ -3767,8 +3790,7 @@
|
|
|
3767
3790
|
enqueueSetState: function (inst, payload, callback) {
|
|
3768
3791
|
var fiber = get(inst);
|
|
3769
3792
|
var eventTime = requestEventTime();
|
|
3770
|
-
var
|
|
3771
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
3793
|
+
var lane = requestUpdateLane(fiber);
|
|
3772
3794
|
var update = createUpdate(eventTime, lane);
|
|
3773
3795
|
update.payload = payload;
|
|
3774
3796
|
|
|
@@ -3786,8 +3808,7 @@
|
|
|
3786
3808
|
enqueueReplaceState: function (inst, payload, callback) {
|
|
3787
3809
|
var fiber = get(inst);
|
|
3788
3810
|
var eventTime = requestEventTime();
|
|
3789
|
-
var
|
|
3790
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
3811
|
+
var lane = requestUpdateLane(fiber);
|
|
3791
3812
|
var update = createUpdate(eventTime, lane);
|
|
3792
3813
|
update.tag = ReplaceState;
|
|
3793
3814
|
update.payload = payload;
|
|
@@ -3806,8 +3827,7 @@
|
|
|
3806
3827
|
enqueueForceUpdate: function (inst, callback) {
|
|
3807
3828
|
var fiber = get(inst);
|
|
3808
3829
|
var eventTime = requestEventTime();
|
|
3809
|
-
var
|
|
3810
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
3830
|
+
var lane = requestUpdateLane(fiber);
|
|
3811
3831
|
var update = createUpdate(eventTime, lane);
|
|
3812
3832
|
update.tag = ForceUpdate;
|
|
3813
3833
|
|
|
@@ -4177,7 +4197,7 @@
|
|
|
4177
4197
|
}
|
|
4178
4198
|
|
|
4179
4199
|
if (typeof instance.componentDidMount === 'function') {
|
|
4180
|
-
workInProgress.
|
|
4200
|
+
workInProgress.flags |= Update;
|
|
4181
4201
|
}
|
|
4182
4202
|
}
|
|
4183
4203
|
|
|
@@ -4219,7 +4239,7 @@
|
|
|
4219
4239
|
// If an update was already in progress, we should schedule an Update
|
|
4220
4240
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
4221
4241
|
if (typeof instance.componentDidMount === 'function') {
|
|
4222
|
-
workInProgress.
|
|
4242
|
+
workInProgress.flags |= Update;
|
|
4223
4243
|
}
|
|
4224
4244
|
|
|
4225
4245
|
return false;
|
|
@@ -4246,13 +4266,13 @@
|
|
|
4246
4266
|
}
|
|
4247
4267
|
|
|
4248
4268
|
if (typeof instance.componentDidMount === 'function') {
|
|
4249
|
-
workInProgress.
|
|
4269
|
+
workInProgress.flags |= Update;
|
|
4250
4270
|
}
|
|
4251
4271
|
} else {
|
|
4252
4272
|
// If an update was already in progress, we should schedule an Update
|
|
4253
4273
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
4254
4274
|
if (typeof instance.componentDidMount === 'function') {
|
|
4255
|
-
workInProgress.
|
|
4275
|
+
workInProgress.flags |= Update;
|
|
4256
4276
|
} // If shouldComponentUpdate returned false, we should still update the
|
|
4257
4277
|
// memoized state to indicate that this work can be reused.
|
|
4258
4278
|
|
|
@@ -4312,13 +4332,13 @@
|
|
|
4312
4332
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
4313
4333
|
if (typeof instance.componentDidUpdate === 'function') {
|
|
4314
4334
|
if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
4315
|
-
workInProgress.
|
|
4335
|
+
workInProgress.flags |= Update;
|
|
4316
4336
|
}
|
|
4317
4337
|
}
|
|
4318
4338
|
|
|
4319
4339
|
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
4320
4340
|
if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
4321
|
-
workInProgress.
|
|
4341
|
+
workInProgress.flags |= Snapshot;
|
|
4322
4342
|
}
|
|
4323
4343
|
}
|
|
4324
4344
|
|
|
@@ -4346,24 +4366,24 @@
|
|
|
4346
4366
|
}
|
|
4347
4367
|
|
|
4348
4368
|
if (typeof instance.componentDidUpdate === 'function') {
|
|
4349
|
-
workInProgress.
|
|
4369
|
+
workInProgress.flags |= Update;
|
|
4350
4370
|
}
|
|
4351
4371
|
|
|
4352
4372
|
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
4353
|
-
workInProgress.
|
|
4373
|
+
workInProgress.flags |= Snapshot;
|
|
4354
4374
|
}
|
|
4355
4375
|
} else {
|
|
4356
4376
|
// If an update was already in progress, we should schedule an Update
|
|
4357
4377
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
4358
4378
|
if (typeof instance.componentDidUpdate === 'function') {
|
|
4359
4379
|
if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
4360
|
-
workInProgress.
|
|
4380
|
+
workInProgress.flags |= Update;
|
|
4361
4381
|
}
|
|
4362
4382
|
}
|
|
4363
4383
|
|
|
4364
4384
|
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
4365
4385
|
if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
4366
|
-
workInProgress.
|
|
4386
|
+
workInProgress.flags |= Snapshot;
|
|
4367
4387
|
}
|
|
4368
4388
|
} // If shouldComponentUpdate returned false, we should still update the
|
|
4369
4389
|
// memoized props/state to indicate that this work can be reused.
|
|
@@ -4568,7 +4588,7 @@
|
|
|
4568
4588
|
}
|
|
4569
4589
|
|
|
4570
4590
|
childToDelete.nextEffect = null;
|
|
4571
|
-
childToDelete.
|
|
4591
|
+
childToDelete.flags = Deletion;
|
|
4572
4592
|
}
|
|
4573
4593
|
|
|
4574
4594
|
function deleteRemainingChildren(returnFiber, currentFirstChild) {
|
|
@@ -4633,7 +4653,7 @@
|
|
|
4633
4653
|
|
|
4634
4654
|
if (oldIndex < lastPlacedIndex) {
|
|
4635
4655
|
// This is a move.
|
|
4636
|
-
newFiber.
|
|
4656
|
+
newFiber.flags = Placement;
|
|
4637
4657
|
return lastPlacedIndex;
|
|
4638
4658
|
} else {
|
|
4639
4659
|
// This item can stay in place.
|
|
@@ -4641,7 +4661,7 @@
|
|
|
4641
4661
|
}
|
|
4642
4662
|
} else {
|
|
4643
4663
|
// This is an insertion.
|
|
4644
|
-
newFiber.
|
|
4664
|
+
newFiber.flags = Placement;
|
|
4645
4665
|
return lastPlacedIndex;
|
|
4646
4666
|
}
|
|
4647
4667
|
}
|
|
@@ -4650,7 +4670,7 @@
|
|
|
4650
4670
|
// This is simpler for the single child case. We only need to do a
|
|
4651
4671
|
// placement for inserting new children.
|
|
4652
4672
|
if (shouldTrackSideEffects && newFiber.alternate === null) {
|
|
4653
|
-
newFiber.
|
|
4673
|
+
newFiber.flags = Placement;
|
|
4654
4674
|
}
|
|
4655
4675
|
|
|
4656
4676
|
return newFiber;
|
|
@@ -5624,13 +5644,6 @@
|
|
|
5624
5644
|
pop(suspenseStackCursor, fiber);
|
|
5625
5645
|
}
|
|
5626
5646
|
|
|
5627
|
-
// A non-null SuspenseState means that it is blocked for one reason or another.
|
|
5628
|
-
// - A non-null dehydrated field means it's blocked pending hydration.
|
|
5629
|
-
// - A non-null dehydrated field can use isSuspenseInstancePending or
|
|
5630
|
-
// isSuspenseInstanceFallback to query the reason for being dehydrated.
|
|
5631
|
-
// - A null dehydrated field means it's blocked by something suspending and
|
|
5632
|
-
// we're currently showing a fallback instead.
|
|
5633
|
-
|
|
5634
5647
|
function shouldCaptureSuspense(workInProgress, hasInvisibleParent) {
|
|
5635
5648
|
// If it was the primary children that just suspended, capture and render the
|
|
5636
5649
|
// fallback. Otherwise, don't capture and bubble to the next boundary.
|
|
@@ -5682,7 +5695,7 @@
|
|
|
5682
5695
|
} else if (node.tag === SuspenseListComponent && // revealOrder undefined can't be trusted because it don't
|
|
5683
5696
|
// keep track of whether it suspended or not.
|
|
5684
5697
|
node.memoizedProps.revealOrder !== undefined) {
|
|
5685
|
-
var didSuspend = (node.
|
|
5698
|
+
var didSuspend = (node.flags & DidCapture) !== NoFlags;
|
|
5686
5699
|
|
|
5687
5700
|
if (didSuspend) {
|
|
5688
5701
|
return node;
|
|
@@ -5712,7 +5725,7 @@
|
|
|
5712
5725
|
return null;
|
|
5713
5726
|
}
|
|
5714
5727
|
|
|
5715
|
-
var
|
|
5728
|
+
var NoFlags$1 =
|
|
5716
5729
|
/* */
|
|
5717
5730
|
0; // Represents whether effect should fire.
|
|
5718
5731
|
|
|
@@ -6081,7 +6094,7 @@
|
|
|
6081
6094
|
}
|
|
6082
6095
|
function bailoutHooks(current, workInProgress, lanes) {
|
|
6083
6096
|
workInProgress.updateQueue = current.updateQueue;
|
|
6084
|
-
workInProgress.
|
|
6097
|
+
workInProgress.flags &= ~(Passive | Update);
|
|
6085
6098
|
current.lanes = removeLanes(current.lanes, lanes);
|
|
6086
6099
|
}
|
|
6087
6100
|
function resetHooksAfterThrow() {
|
|
@@ -6552,8 +6565,7 @@
|
|
|
6552
6565
|
|
|
6553
6566
|
if (!objectIs(snapshot, maybeNewSnapshot)) {
|
|
6554
6567
|
setSnapshot(maybeNewSnapshot);
|
|
6555
|
-
var
|
|
6556
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
6568
|
+
var lane = requestUpdateLane(fiber);
|
|
6557
6569
|
markRootMutableRead(root, lane);
|
|
6558
6570
|
} // If the source mutated between render and now,
|
|
6559
6571
|
// there may be state updates already scheduled from the old source.
|
|
@@ -6572,8 +6584,7 @@
|
|
|
6572
6584
|
try {
|
|
6573
6585
|
latestSetSnapshot(latestGetSnapshot(source._source)); // Record a pending mutable source update with the same expiration time.
|
|
6574
6586
|
|
|
6575
|
-
var
|
|
6576
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
6587
|
+
var lane = requestUpdateLane(fiber);
|
|
6577
6588
|
markRootMutableRead(root, lane);
|
|
6578
6589
|
} catch (error) {
|
|
6579
6590
|
// A selector might throw after a source mutation.
|
|
@@ -6723,14 +6734,14 @@
|
|
|
6723
6734
|
return hook.memoizedState;
|
|
6724
6735
|
}
|
|
6725
6736
|
|
|
6726
|
-
function mountEffectImpl(
|
|
6737
|
+
function mountEffectImpl(fiberFlags, hookFlags, create, deps) {
|
|
6727
6738
|
var hook = mountWorkInProgressHook();
|
|
6728
6739
|
var nextDeps = deps === undefined ? null : deps;
|
|
6729
|
-
currentlyRenderingFiber$1.
|
|
6730
|
-
hook.memoizedState = pushEffect(HasEffect |
|
|
6740
|
+
currentlyRenderingFiber$1.flags |= fiberFlags;
|
|
6741
|
+
hook.memoizedState = pushEffect(HasEffect | hookFlags, create, undefined, nextDeps);
|
|
6731
6742
|
}
|
|
6732
6743
|
|
|
6733
|
-
function updateEffectImpl(
|
|
6744
|
+
function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
|
6734
6745
|
var hook = updateWorkInProgressHook();
|
|
6735
6746
|
var nextDeps = deps === undefined ? null : deps;
|
|
6736
6747
|
var destroy = undefined;
|
|
@@ -6743,14 +6754,14 @@
|
|
|
6743
6754
|
var prevDeps = prevEffect.deps;
|
|
6744
6755
|
|
|
6745
6756
|
if (areHookInputsEqual(nextDeps, prevDeps)) {
|
|
6746
|
-
pushEffect(
|
|
6757
|
+
pushEffect(hookFlags, create, destroy, nextDeps);
|
|
6747
6758
|
return;
|
|
6748
6759
|
}
|
|
6749
6760
|
}
|
|
6750
6761
|
}
|
|
6751
6762
|
|
|
6752
|
-
currentlyRenderingFiber$1.
|
|
6753
|
-
hook.memoizedState = pushEffect(HasEffect |
|
|
6763
|
+
currentlyRenderingFiber$1.flags |= fiberFlags;
|
|
6764
|
+
hook.memoizedState = pushEffect(HasEffect | hookFlags, create, destroy, nextDeps);
|
|
6754
6765
|
}
|
|
6755
6766
|
|
|
6756
6767
|
function mountEffect(create, deps) {
|
|
@@ -6897,61 +6908,61 @@
|
|
|
6897
6908
|
return nextValue;
|
|
6898
6909
|
}
|
|
6899
6910
|
|
|
6900
|
-
function mountDeferredValue(value
|
|
6911
|
+
function mountDeferredValue(value) {
|
|
6901
6912
|
var _mountState = mountState(value),
|
|
6902
6913
|
prevValue = _mountState[0],
|
|
6903
6914
|
setValue = _mountState[1];
|
|
6904
6915
|
|
|
6905
6916
|
mountEffect(function () {
|
|
6906
|
-
var
|
|
6907
|
-
ReactCurrentBatchConfig$1.
|
|
6917
|
+
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
6918
|
+
ReactCurrentBatchConfig$1.transition = 1;
|
|
6908
6919
|
|
|
6909
6920
|
try {
|
|
6910
6921
|
setValue(value);
|
|
6911
6922
|
} finally {
|
|
6912
|
-
ReactCurrentBatchConfig$1.
|
|
6923
|
+
ReactCurrentBatchConfig$1.transition = prevTransition;
|
|
6913
6924
|
}
|
|
6914
|
-
}, [value
|
|
6925
|
+
}, [value]);
|
|
6915
6926
|
return prevValue;
|
|
6916
6927
|
}
|
|
6917
6928
|
|
|
6918
|
-
function updateDeferredValue(value
|
|
6929
|
+
function updateDeferredValue(value) {
|
|
6919
6930
|
var _updateState = updateState(),
|
|
6920
6931
|
prevValue = _updateState[0],
|
|
6921
6932
|
setValue = _updateState[1];
|
|
6922
6933
|
|
|
6923
6934
|
updateEffect(function () {
|
|
6924
|
-
var
|
|
6925
|
-
ReactCurrentBatchConfig$1.
|
|
6935
|
+
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
6936
|
+
ReactCurrentBatchConfig$1.transition = 1;
|
|
6926
6937
|
|
|
6927
6938
|
try {
|
|
6928
6939
|
setValue(value);
|
|
6929
6940
|
} finally {
|
|
6930
|
-
ReactCurrentBatchConfig$1.
|
|
6941
|
+
ReactCurrentBatchConfig$1.transition = prevTransition;
|
|
6931
6942
|
}
|
|
6932
|
-
}, [value
|
|
6943
|
+
}, [value]);
|
|
6933
6944
|
return prevValue;
|
|
6934
6945
|
}
|
|
6935
6946
|
|
|
6936
|
-
function rerenderDeferredValue(value
|
|
6947
|
+
function rerenderDeferredValue(value) {
|
|
6937
6948
|
var _rerenderState = rerenderState(),
|
|
6938
6949
|
prevValue = _rerenderState[0],
|
|
6939
6950
|
setValue = _rerenderState[1];
|
|
6940
6951
|
|
|
6941
6952
|
updateEffect(function () {
|
|
6942
|
-
var
|
|
6943
|
-
ReactCurrentBatchConfig$1.
|
|
6953
|
+
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
6954
|
+
ReactCurrentBatchConfig$1.transition = 1;
|
|
6944
6955
|
|
|
6945
6956
|
try {
|
|
6946
6957
|
setValue(value);
|
|
6947
6958
|
} finally {
|
|
6948
|
-
ReactCurrentBatchConfig$1.
|
|
6959
|
+
ReactCurrentBatchConfig$1.transition = prevTransition;
|
|
6949
6960
|
}
|
|
6950
|
-
}, [value
|
|
6961
|
+
}, [value]);
|
|
6951
6962
|
return prevValue;
|
|
6952
6963
|
}
|
|
6953
6964
|
|
|
6954
|
-
function startTransition(setPending,
|
|
6965
|
+
function startTransition(setPending, callback) {
|
|
6955
6966
|
var priorityLevel = getCurrentPriorityLevel();
|
|
6956
6967
|
|
|
6957
6968
|
{
|
|
@@ -6959,43 +6970,46 @@
|
|
|
6959
6970
|
setPending(true);
|
|
6960
6971
|
});
|
|
6961
6972
|
runWithPriority(priorityLevel > NormalPriority$1 ? NormalPriority$1 : priorityLevel, function () {
|
|
6962
|
-
var
|
|
6963
|
-
ReactCurrentBatchConfig$1.
|
|
6973
|
+
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
6974
|
+
ReactCurrentBatchConfig$1.transition = 1;
|
|
6964
6975
|
|
|
6965
6976
|
try {
|
|
6966
6977
|
setPending(false);
|
|
6967
6978
|
callback();
|
|
6968
6979
|
} finally {
|
|
6969
|
-
ReactCurrentBatchConfig$1.
|
|
6980
|
+
ReactCurrentBatchConfig$1.transition = prevTransition;
|
|
6970
6981
|
}
|
|
6971
6982
|
});
|
|
6972
6983
|
}
|
|
6973
6984
|
}
|
|
6974
6985
|
|
|
6975
|
-
function mountTransition(
|
|
6986
|
+
function mountTransition() {
|
|
6976
6987
|
var _mountState2 = mountState(false),
|
|
6977
6988
|
isPending = _mountState2[0],
|
|
6978
|
-
setPending = _mountState2[1];
|
|
6989
|
+
setPending = _mountState2[1]; // The `start` method can be stored on a ref, since `setPending`
|
|
6990
|
+
// never changes.
|
|
6991
|
+
|
|
6979
6992
|
|
|
6980
|
-
var start =
|
|
6993
|
+
var start = startTransition.bind(null, setPending);
|
|
6994
|
+
mountRef(start);
|
|
6981
6995
|
return [start, isPending];
|
|
6982
6996
|
}
|
|
6983
6997
|
|
|
6984
|
-
function updateTransition(
|
|
6998
|
+
function updateTransition() {
|
|
6985
6999
|
var _updateState2 = updateState(),
|
|
6986
|
-
isPending = _updateState2[0]
|
|
6987
|
-
setPending = _updateState2[1];
|
|
7000
|
+
isPending = _updateState2[0];
|
|
6988
7001
|
|
|
6989
|
-
var
|
|
7002
|
+
var startRef = updateRef();
|
|
7003
|
+
var start = startRef.current;
|
|
6990
7004
|
return [start, isPending];
|
|
6991
7005
|
}
|
|
6992
7006
|
|
|
6993
|
-
function rerenderTransition(
|
|
7007
|
+
function rerenderTransition() {
|
|
6994
7008
|
var _rerenderState2 = rerenderState(),
|
|
6995
|
-
isPending = _rerenderState2[0]
|
|
6996
|
-
setPending = _rerenderState2[1];
|
|
7009
|
+
isPending = _rerenderState2[0];
|
|
6997
7010
|
|
|
6998
|
-
var
|
|
7011
|
+
var startRef = updateRef();
|
|
7012
|
+
var start = startRef.current;
|
|
6999
7013
|
return [start, isPending];
|
|
7000
7014
|
}
|
|
7001
7015
|
|
|
@@ -7048,8 +7062,7 @@
|
|
|
7048
7062
|
}
|
|
7049
7063
|
|
|
7050
7064
|
var eventTime = requestEventTime();
|
|
7051
|
-
var
|
|
7052
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
7065
|
+
var lane = requestUpdateLane(fiber);
|
|
7053
7066
|
var update = {
|
|
7054
7067
|
lane: lane,
|
|
7055
7068
|
action: action,
|
|
@@ -7244,15 +7257,15 @@
|
|
|
7244
7257
|
mountHookTypesDev();
|
|
7245
7258
|
return mountDebugValue();
|
|
7246
7259
|
},
|
|
7247
|
-
useDeferredValue: function (value
|
|
7260
|
+
useDeferredValue: function (value) {
|
|
7248
7261
|
currentHookNameInDev = 'useDeferredValue';
|
|
7249
7262
|
mountHookTypesDev();
|
|
7250
|
-
return mountDeferredValue(value
|
|
7263
|
+
return mountDeferredValue(value);
|
|
7251
7264
|
},
|
|
7252
|
-
useTransition: function (
|
|
7265
|
+
useTransition: function () {
|
|
7253
7266
|
currentHookNameInDev = 'useTransition';
|
|
7254
7267
|
mountHookTypesDev();
|
|
7255
|
-
return mountTransition(
|
|
7268
|
+
return mountTransition();
|
|
7256
7269
|
},
|
|
7257
7270
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7258
7271
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -7341,15 +7354,15 @@
|
|
|
7341
7354
|
updateHookTypesDev();
|
|
7342
7355
|
return mountDebugValue();
|
|
7343
7356
|
},
|
|
7344
|
-
useDeferredValue: function (value
|
|
7357
|
+
useDeferredValue: function (value) {
|
|
7345
7358
|
currentHookNameInDev = 'useDeferredValue';
|
|
7346
7359
|
updateHookTypesDev();
|
|
7347
|
-
return mountDeferredValue(value
|
|
7360
|
+
return mountDeferredValue(value);
|
|
7348
7361
|
},
|
|
7349
|
-
useTransition: function (
|
|
7362
|
+
useTransition: function () {
|
|
7350
7363
|
currentHookNameInDev = 'useTransition';
|
|
7351
7364
|
updateHookTypesDev();
|
|
7352
|
-
return mountTransition(
|
|
7365
|
+
return mountTransition();
|
|
7353
7366
|
},
|
|
7354
7367
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7355
7368
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -7438,15 +7451,15 @@
|
|
|
7438
7451
|
updateHookTypesDev();
|
|
7439
7452
|
return updateDebugValue();
|
|
7440
7453
|
},
|
|
7441
|
-
useDeferredValue: function (value
|
|
7454
|
+
useDeferredValue: function (value) {
|
|
7442
7455
|
currentHookNameInDev = 'useDeferredValue';
|
|
7443
7456
|
updateHookTypesDev();
|
|
7444
|
-
return updateDeferredValue(value
|
|
7457
|
+
return updateDeferredValue(value);
|
|
7445
7458
|
},
|
|
7446
|
-
useTransition: function (
|
|
7459
|
+
useTransition: function () {
|
|
7447
7460
|
currentHookNameInDev = 'useTransition';
|
|
7448
7461
|
updateHookTypesDev();
|
|
7449
|
-
return updateTransition(
|
|
7462
|
+
return updateTransition();
|
|
7450
7463
|
},
|
|
7451
7464
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7452
7465
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -7535,15 +7548,15 @@
|
|
|
7535
7548
|
updateHookTypesDev();
|
|
7536
7549
|
return updateDebugValue();
|
|
7537
7550
|
},
|
|
7538
|
-
useDeferredValue: function (value
|
|
7551
|
+
useDeferredValue: function (value) {
|
|
7539
7552
|
currentHookNameInDev = 'useDeferredValue';
|
|
7540
7553
|
updateHookTypesDev();
|
|
7541
|
-
return rerenderDeferredValue(value
|
|
7554
|
+
return rerenderDeferredValue(value);
|
|
7542
7555
|
},
|
|
7543
|
-
useTransition: function (
|
|
7556
|
+
useTransition: function () {
|
|
7544
7557
|
currentHookNameInDev = 'useTransition';
|
|
7545
7558
|
updateHookTypesDev();
|
|
7546
|
-
return rerenderTransition(
|
|
7559
|
+
return rerenderTransition();
|
|
7547
7560
|
},
|
|
7548
7561
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7549
7562
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -7643,17 +7656,17 @@
|
|
|
7643
7656
|
mountHookTypesDev();
|
|
7644
7657
|
return mountDebugValue();
|
|
7645
7658
|
},
|
|
7646
|
-
useDeferredValue: function (value
|
|
7659
|
+
useDeferredValue: function (value) {
|
|
7647
7660
|
currentHookNameInDev = 'useDeferredValue';
|
|
7648
7661
|
warnInvalidHookAccess();
|
|
7649
7662
|
mountHookTypesDev();
|
|
7650
|
-
return mountDeferredValue(value
|
|
7663
|
+
return mountDeferredValue(value);
|
|
7651
7664
|
},
|
|
7652
|
-
useTransition: function (
|
|
7665
|
+
useTransition: function () {
|
|
7653
7666
|
currentHookNameInDev = 'useTransition';
|
|
7654
7667
|
warnInvalidHookAccess();
|
|
7655
7668
|
mountHookTypesDev();
|
|
7656
|
-
return mountTransition(
|
|
7669
|
+
return mountTransition();
|
|
7657
7670
|
},
|
|
7658
7671
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7659
7672
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -7755,17 +7768,17 @@
|
|
|
7755
7768
|
updateHookTypesDev();
|
|
7756
7769
|
return updateDebugValue();
|
|
7757
7770
|
},
|
|
7758
|
-
useDeferredValue: function (value
|
|
7771
|
+
useDeferredValue: function (value) {
|
|
7759
7772
|
currentHookNameInDev = 'useDeferredValue';
|
|
7760
7773
|
warnInvalidHookAccess();
|
|
7761
7774
|
updateHookTypesDev();
|
|
7762
|
-
return updateDeferredValue(value
|
|
7775
|
+
return updateDeferredValue(value);
|
|
7763
7776
|
},
|
|
7764
|
-
useTransition: function (
|
|
7777
|
+
useTransition: function () {
|
|
7765
7778
|
currentHookNameInDev = 'useTransition';
|
|
7766
7779
|
warnInvalidHookAccess();
|
|
7767
7780
|
updateHookTypesDev();
|
|
7768
|
-
return updateTransition(
|
|
7781
|
+
return updateTransition();
|
|
7769
7782
|
},
|
|
7770
7783
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7771
7784
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -7867,17 +7880,17 @@
|
|
|
7867
7880
|
updateHookTypesDev();
|
|
7868
7881
|
return updateDebugValue();
|
|
7869
7882
|
},
|
|
7870
|
-
useDeferredValue: function (value
|
|
7883
|
+
useDeferredValue: function (value) {
|
|
7871
7884
|
currentHookNameInDev = 'useDeferredValue';
|
|
7872
7885
|
warnInvalidHookAccess();
|
|
7873
7886
|
updateHookTypesDev();
|
|
7874
|
-
return rerenderDeferredValue(value
|
|
7887
|
+
return rerenderDeferredValue(value);
|
|
7875
7888
|
},
|
|
7876
|
-
useTransition: function (
|
|
7889
|
+
useTransition: function () {
|
|
7877
7890
|
currentHookNameInDev = 'useTransition';
|
|
7878
7891
|
warnInvalidHookAccess();
|
|
7879
7892
|
updateHookTypesDev();
|
|
7880
|
-
return rerenderTransition(
|
|
7893
|
+
return rerenderTransition();
|
|
7881
7894
|
},
|
|
7882
7895
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7883
7896
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -8041,7 +8054,7 @@
|
|
|
8041
8054
|
} // React DevTools reads this flag.
|
|
8042
8055
|
|
|
8043
8056
|
|
|
8044
|
-
workInProgress.
|
|
8057
|
+
workInProgress.flags |= PerformedWork;
|
|
8045
8058
|
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
|
8046
8059
|
return workInProgress.child;
|
|
8047
8060
|
}
|
|
@@ -8117,7 +8130,7 @@
|
|
|
8117
8130
|
} // React DevTools reads this flag.
|
|
8118
8131
|
|
|
8119
8132
|
|
|
8120
|
-
workInProgress.
|
|
8133
|
+
workInProgress.flags |= PerformedWork;
|
|
8121
8134
|
var newChild = createWorkInProgress(currentChild, nextProps);
|
|
8122
8135
|
newChild.ref = workInProgress.ref;
|
|
8123
8136
|
newChild.return = workInProgress;
|
|
@@ -8183,7 +8196,7 @@
|
|
|
8183
8196
|
// this is no longer necessary.
|
|
8184
8197
|
workInProgress.lanes = current.lanes;
|
|
8185
8198
|
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
|
8186
|
-
} else if ((current.
|
|
8199
|
+
} else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
|
|
8187
8200
|
// This is a special case that only exists for legacy mode.
|
|
8188
8201
|
// See https://github.com/facebook/react/pull/19216.
|
|
8189
8202
|
didReceiveUpdate = true;
|
|
@@ -8282,7 +8295,7 @@
|
|
|
8282
8295
|
|
|
8283
8296
|
function updateProfiler(current, workInProgress, renderLanes) {
|
|
8284
8297
|
{
|
|
8285
|
-
workInProgress.
|
|
8298
|
+
workInProgress.flags |= Update; // Reset effect durations for the next eventual effect phase.
|
|
8286
8299
|
// These are reset during render to allow the DevTools commit hook a chance to read them,
|
|
8287
8300
|
|
|
8288
8301
|
var stateNode = workInProgress.stateNode;
|
|
@@ -8301,7 +8314,7 @@
|
|
|
8301
8314
|
|
|
8302
8315
|
if (current === null && ref !== null || current !== null && current.ref !== ref) {
|
|
8303
8316
|
// Schedule a Ref effect
|
|
8304
|
-
workInProgress.
|
|
8317
|
+
workInProgress.flags |= Ref;
|
|
8305
8318
|
}
|
|
8306
8319
|
}
|
|
8307
8320
|
|
|
@@ -8343,7 +8356,7 @@
|
|
|
8343
8356
|
} // React DevTools reads this flag.
|
|
8344
8357
|
|
|
8345
8358
|
|
|
8346
|
-
workInProgress.
|
|
8359
|
+
workInProgress.flags |= PerformedWork;
|
|
8347
8360
|
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
|
8348
8361
|
return workInProgress.child;
|
|
8349
8362
|
}
|
|
@@ -8387,7 +8400,7 @@
|
|
|
8387
8400
|
current.alternate = null;
|
|
8388
8401
|
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
8389
8402
|
|
|
8390
|
-
workInProgress.
|
|
8403
|
+
workInProgress.flags |= Placement;
|
|
8391
8404
|
} // In the initial pass we might need to construct the instance.
|
|
8392
8405
|
|
|
8393
8406
|
|
|
@@ -8421,7 +8434,7 @@
|
|
|
8421
8434
|
function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes) {
|
|
8422
8435
|
// Refs should update even if shouldComponentUpdate returns false
|
|
8423
8436
|
markRef(current, workInProgress);
|
|
8424
|
-
var didCaptureError = (workInProgress.
|
|
8437
|
+
var didCaptureError = (workInProgress.flags & DidCapture) !== NoFlags;
|
|
8425
8438
|
|
|
8426
8439
|
if (!shouldUpdate && !didCaptureError) {
|
|
8427
8440
|
// Context providers should defer to sCU for rendering
|
|
@@ -8458,7 +8471,7 @@
|
|
|
8458
8471
|
} // React DevTools reads this flag.
|
|
8459
8472
|
|
|
8460
8473
|
|
|
8461
|
-
workInProgress.
|
|
8474
|
+
workInProgress.flags |= PerformedWork;
|
|
8462
8475
|
|
|
8463
8476
|
if (current !== null && didCaptureError) {
|
|
8464
8477
|
// If we're recovering from an error, reconcile without reusing any of
|
|
@@ -8533,7 +8546,7 @@
|
|
|
8533
8546
|
// Conceptually this is similar to Placement in that a new subtree is
|
|
8534
8547
|
// inserted into the React tree here. It just happens to not need DOM
|
|
8535
8548
|
// mutations because it already exists.
|
|
8536
|
-
node.
|
|
8549
|
+
node.flags = node.flags & ~Placement | Hydrating;
|
|
8537
8550
|
node = node.sibling;
|
|
8538
8551
|
}
|
|
8539
8552
|
} else {
|
|
@@ -8556,7 +8569,7 @@
|
|
|
8556
8569
|
if (prevProps !== null && shouldSetTextContent()) {
|
|
8557
8570
|
// If we're switching from a direct text child to a normal child, or to
|
|
8558
8571
|
// empty, we need to schedule the text content to be reset.
|
|
8559
|
-
workInProgress.
|
|
8572
|
+
workInProgress.flags |= ContentReset;
|
|
8560
8573
|
}
|
|
8561
8574
|
|
|
8562
8575
|
markRef(current, workInProgress);
|
|
@@ -8580,7 +8593,7 @@
|
|
|
8580
8593
|
_current.alternate = null;
|
|
8581
8594
|
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
8582
8595
|
|
|
8583
|
-
workInProgress.
|
|
8596
|
+
workInProgress.flags |= Placement;
|
|
8584
8597
|
}
|
|
8585
8598
|
|
|
8586
8599
|
var props = workInProgress.pendingProps;
|
|
@@ -8672,7 +8685,7 @@
|
|
|
8672
8685
|
_current.alternate = null;
|
|
8673
8686
|
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
8674
8687
|
|
|
8675
|
-
workInProgress.
|
|
8688
|
+
workInProgress.flags |= Placement;
|
|
8676
8689
|
} // Promote the fiber to a class and try rendering again.
|
|
8677
8690
|
|
|
8678
8691
|
|
|
@@ -8705,7 +8718,7 @@
|
|
|
8705
8718
|
_current.alternate = null;
|
|
8706
8719
|
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
8707
8720
|
|
|
8708
|
-
workInProgress.
|
|
8721
|
+
workInProgress.flags |= Placement;
|
|
8709
8722
|
}
|
|
8710
8723
|
|
|
8711
8724
|
var props = workInProgress.pendingProps;
|
|
@@ -8741,7 +8754,7 @@
|
|
|
8741
8754
|
} // React DevTools reads this flag.
|
|
8742
8755
|
|
|
8743
8756
|
|
|
8744
|
-
workInProgress.
|
|
8757
|
+
workInProgress.flags |= PerformedWork;
|
|
8745
8758
|
|
|
8746
8759
|
{
|
|
8747
8760
|
// Support for module components is deprecated and is removed behind a flag.
|
|
@@ -8879,7 +8892,8 @@
|
|
|
8879
8892
|
return {
|
|
8880
8893
|
baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes)
|
|
8881
8894
|
};
|
|
8882
|
-
}
|
|
8895
|
+
} // TODO: Probably should inline this back
|
|
8896
|
+
|
|
8883
8897
|
|
|
8884
8898
|
function shouldRemainOnFallback(suspenseContext, current, workInProgress, renderLanes) {
|
|
8885
8899
|
// If we're already showing a fallback, there are cases where we need to
|
|
@@ -8911,19 +8925,19 @@
|
|
|
8911
8925
|
|
|
8912
8926
|
{
|
|
8913
8927
|
if (shouldSuspend(workInProgress)) {
|
|
8914
|
-
workInProgress.
|
|
8928
|
+
workInProgress.flags |= DidCapture;
|
|
8915
8929
|
}
|
|
8916
8930
|
}
|
|
8917
8931
|
|
|
8918
8932
|
var suspenseContext = suspenseStackCursor.current;
|
|
8919
8933
|
var showFallback = false;
|
|
8920
|
-
var didSuspend = (workInProgress.
|
|
8934
|
+
var didSuspend = (workInProgress.flags & DidCapture) !== NoFlags;
|
|
8921
8935
|
|
|
8922
8936
|
if (didSuspend || shouldRemainOnFallback(suspenseContext, current)) {
|
|
8923
8937
|
// Something in this boundary's subtree already suspended. Switch to
|
|
8924
8938
|
// rendering the fallback children.
|
|
8925
8939
|
showFallback = true;
|
|
8926
|
-
workInProgress.
|
|
8940
|
+
workInProgress.flags &= ~DidCapture;
|
|
8927
8941
|
} else {
|
|
8928
8942
|
// Attempting the main content
|
|
8929
8943
|
if (current === null || current.memoizedState !== null) {
|
|
@@ -8968,17 +8982,41 @@
|
|
|
8968
8982
|
// But only if this has a fallback.
|
|
8969
8983
|
if (nextProps.fallback !== undefined) ;
|
|
8970
8984
|
|
|
8985
|
+
var nextPrimaryChildren = nextProps.children;
|
|
8986
|
+
var nextFallbackChildren = nextProps.fallback;
|
|
8987
|
+
|
|
8971
8988
|
if (showFallback) {
|
|
8972
|
-
var nextPrimaryChildren = nextProps.children;
|
|
8973
|
-
var nextFallbackChildren = nextProps.fallback;
|
|
8974
8989
|
var fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes);
|
|
8975
8990
|
var primaryChildFragment = workInProgress.child;
|
|
8976
8991
|
primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes);
|
|
8977
8992
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
8978
8993
|
return fallbackFragment;
|
|
8994
|
+
} else if (typeof nextProps.unstable_expectedLoadTime === 'number') {
|
|
8995
|
+
// This is a CPU-bound tree. Skip this tree and show a placeholder to
|
|
8996
|
+
// unblock the surrounding content. Then immediately retry after the
|
|
8997
|
+
// initial commit.
|
|
8998
|
+
var _fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes);
|
|
8999
|
+
|
|
9000
|
+
var _primaryChildFragment = workInProgress.child;
|
|
9001
|
+
_primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes);
|
|
9002
|
+
workInProgress.memoizedState = SUSPENDED_MARKER; // Since nothing actually suspended, there will nothing to ping this to
|
|
9003
|
+
// get it started back up to attempt the next item. While in terms of
|
|
9004
|
+
// priority this work has the same priority as this current render, it's
|
|
9005
|
+
// not part of the same transition once the transition has committed. If
|
|
9006
|
+
// it's sync, we still want to yield so that it can be painted.
|
|
9007
|
+
// Conceptually, this is really the same as pinging. We can use any
|
|
9008
|
+
// RetryLane even if it's the one currently rendering since we're leaving
|
|
9009
|
+
// it behind on this node.
|
|
9010
|
+
|
|
9011
|
+
workInProgress.lanes = SomeRetryLane;
|
|
9012
|
+
|
|
9013
|
+
{
|
|
9014
|
+
markSpawnedWork(SomeRetryLane);
|
|
9015
|
+
}
|
|
9016
|
+
|
|
9017
|
+
return _fallbackFragment;
|
|
8979
9018
|
} else {
|
|
8980
|
-
|
|
8981
|
-
return mountSuspensePrimaryChildren(workInProgress, _nextPrimaryChildren, renderLanes);
|
|
9019
|
+
return mountSuspensePrimaryChildren(workInProgress, nextPrimaryChildren, renderLanes);
|
|
8982
9020
|
}
|
|
8983
9021
|
} else {
|
|
8984
9022
|
// This is an update.
|
|
@@ -8990,37 +9028,37 @@
|
|
|
8990
9028
|
|
|
8991
9029
|
if (showFallback) {
|
|
8992
9030
|
var _nextFallbackChildren2 = nextProps.fallback;
|
|
8993
|
-
var
|
|
9031
|
+
var _nextPrimaryChildren2 = nextProps.children;
|
|
8994
9032
|
|
|
8995
|
-
var _fallbackChildFragment = updateSuspenseFallbackChildren(current, workInProgress,
|
|
9033
|
+
var _fallbackChildFragment = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren2, _nextFallbackChildren2, renderLanes);
|
|
8996
9034
|
|
|
8997
|
-
var
|
|
9035
|
+
var _primaryChildFragment3 = workInProgress.child;
|
|
8998
9036
|
var prevOffscreenState = current.child.memoizedState;
|
|
8999
|
-
|
|
9000
|
-
|
|
9037
|
+
_primaryChildFragment3.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes);
|
|
9038
|
+
_primaryChildFragment3.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes);
|
|
9001
9039
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
9002
9040
|
return _fallbackChildFragment;
|
|
9003
9041
|
} else {
|
|
9004
|
-
var
|
|
9042
|
+
var _nextPrimaryChildren3 = nextProps.children;
|
|
9005
9043
|
|
|
9006
|
-
var
|
|
9044
|
+
var _primaryChildFragment4 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren3, renderLanes);
|
|
9007
9045
|
|
|
9008
9046
|
workInProgress.memoizedState = null;
|
|
9009
|
-
return
|
|
9047
|
+
return _primaryChildFragment4;
|
|
9010
9048
|
}
|
|
9011
9049
|
} else {
|
|
9012
9050
|
// The current tree is not already showing a fallback.
|
|
9013
9051
|
if (showFallback) {
|
|
9014
9052
|
// Timed out.
|
|
9015
9053
|
var _nextFallbackChildren3 = nextProps.fallback;
|
|
9016
|
-
var
|
|
9054
|
+
var _nextPrimaryChildren4 = nextProps.children;
|
|
9017
9055
|
|
|
9018
|
-
var _fallbackChildFragment2 = updateSuspenseFallbackChildren(current, workInProgress,
|
|
9056
|
+
var _fallbackChildFragment2 = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren4, _nextFallbackChildren3, renderLanes);
|
|
9019
9057
|
|
|
9020
|
-
var
|
|
9058
|
+
var _primaryChildFragment5 = workInProgress.child;
|
|
9021
9059
|
var _prevOffscreenState = current.child.memoizedState;
|
|
9022
|
-
|
|
9023
|
-
|
|
9060
|
+
_primaryChildFragment5.memoizedState = _prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(_prevOffscreenState, renderLanes);
|
|
9061
|
+
_primaryChildFragment5.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); // Skip the primary children, and continue working on the
|
|
9024
9062
|
// fallback children.
|
|
9025
9063
|
|
|
9026
9064
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
@@ -9028,12 +9066,12 @@
|
|
|
9028
9066
|
} else {
|
|
9029
9067
|
// Still haven't timed out. Continue rendering the children, like we
|
|
9030
9068
|
// normally do.
|
|
9031
|
-
var
|
|
9069
|
+
var _nextPrimaryChildren5 = nextProps.children;
|
|
9032
9070
|
|
|
9033
|
-
var
|
|
9071
|
+
var _primaryChildFragment6 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren5, renderLanes);
|
|
9034
9072
|
|
|
9035
9073
|
workInProgress.memoizedState = null;
|
|
9036
|
-
return
|
|
9074
|
+
return _primaryChildFragment6;
|
|
9037
9075
|
}
|
|
9038
9076
|
}
|
|
9039
9077
|
}
|
|
@@ -9116,7 +9154,7 @@
|
|
|
9116
9154
|
if (currentFallbackChildFragment !== null) {
|
|
9117
9155
|
// Delete the fallback child fragment
|
|
9118
9156
|
currentFallbackChildFragment.nextEffect = null;
|
|
9119
|
-
currentFallbackChildFragment.
|
|
9157
|
+
currentFallbackChildFragment.flags = Deletion;
|
|
9120
9158
|
workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment;
|
|
9121
9159
|
}
|
|
9122
9160
|
|
|
@@ -9187,7 +9225,7 @@
|
|
|
9187
9225
|
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); // Needs a placement effect because the parent (the Suspense boundary) already
|
|
9188
9226
|
// mounted but this is a new fiber.
|
|
9189
9227
|
|
|
9190
|
-
fallbackChildFragment.
|
|
9228
|
+
fallbackChildFragment.flags |= Placement;
|
|
9191
9229
|
}
|
|
9192
9230
|
|
|
9193
9231
|
fallbackChildFragment.return = workInProgress;
|
|
@@ -9425,9 +9463,9 @@
|
|
|
9425
9463
|
|
|
9426
9464
|
if (shouldForceFallback) {
|
|
9427
9465
|
suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
|
9428
|
-
workInProgress.
|
|
9466
|
+
workInProgress.flags |= DidCapture;
|
|
9429
9467
|
} else {
|
|
9430
|
-
var didSuspendBefore = current !== null && (current.
|
|
9468
|
+
var didSuspendBefore = current !== null && (current.flags & DidCapture) !== NoFlags;
|
|
9431
9469
|
|
|
9432
9470
|
if (didSuspendBefore) {
|
|
9433
9471
|
// If we previously forced a fallback, we need to schedule work
|
|
@@ -9637,7 +9675,7 @@
|
|
|
9637
9675
|
} // React DevTools reads this flag.
|
|
9638
9676
|
|
|
9639
9677
|
|
|
9640
|
-
workInProgress.
|
|
9678
|
+
workInProgress.flags |= PerformedWork;
|
|
9641
9679
|
reconcileChildren(current, workInProgress, newChildren, renderLanes);
|
|
9642
9680
|
return workInProgress.child;
|
|
9643
9681
|
}
|
|
@@ -9722,8 +9760,8 @@
|
|
|
9722
9760
|
}
|
|
9723
9761
|
|
|
9724
9762
|
current.nextEffect = null;
|
|
9725
|
-
current.
|
|
9726
|
-
newWorkInProgress.
|
|
9763
|
+
current.flags = Deletion;
|
|
9764
|
+
newWorkInProgress.flags |= Placement; // Restart work from the new fiber.
|
|
9727
9765
|
|
|
9728
9766
|
return newWorkInProgress;
|
|
9729
9767
|
}
|
|
@@ -9790,7 +9828,7 @@
|
|
|
9790
9828
|
var hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes);
|
|
9791
9829
|
|
|
9792
9830
|
if (hasChildWork) {
|
|
9793
|
-
workInProgress.
|
|
9831
|
+
workInProgress.flags |= Update;
|
|
9794
9832
|
} // Reset effect durations for the next eventual effect phase.
|
|
9795
9833
|
// These are reset during render to allow the DevTools commit hook a chance to read them,
|
|
9796
9834
|
|
|
@@ -9844,7 +9882,7 @@
|
|
|
9844
9882
|
|
|
9845
9883
|
case SuspenseListComponent:
|
|
9846
9884
|
{
|
|
9847
|
-
var didSuspendBefore = (current.
|
|
9885
|
+
var didSuspendBefore = (current.flags & DidCapture) !== NoFlags;
|
|
9848
9886
|
|
|
9849
9887
|
var _hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes);
|
|
9850
9888
|
|
|
@@ -9861,7 +9899,7 @@
|
|
|
9861
9899
|
// as before. We can fast bail out.
|
|
9862
9900
|
|
|
9863
9901
|
|
|
9864
|
-
workInProgress.
|
|
9902
|
+
workInProgress.flags |= DidCapture;
|
|
9865
9903
|
} // If nothing suspended before and we're rendering the same children,
|
|
9866
9904
|
// then the tail doesn't matter. Anything new that suspends will work
|
|
9867
9905
|
// in the "together" mode, so we can continue from the state we had.
|
|
@@ -9907,7 +9945,7 @@
|
|
|
9907
9945
|
|
|
9908
9946
|
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
|
9909
9947
|
} else {
|
|
9910
|
-
if ((current.
|
|
9948
|
+
if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
|
|
9911
9949
|
// This is a special case that only exists for legacy mode.
|
|
9912
9950
|
// See https://github.com/facebook/react/pull/19216.
|
|
9913
9951
|
didReceiveUpdate = true;
|
|
@@ -10081,11 +10119,11 @@
|
|
|
10081
10119
|
function markUpdate(workInProgress) {
|
|
10082
10120
|
// Tag the fiber with an update effect. This turns a Placement into
|
|
10083
10121
|
// a PlacementAndUpdate.
|
|
10084
|
-
workInProgress.
|
|
10122
|
+
workInProgress.flags |= Update;
|
|
10085
10123
|
}
|
|
10086
10124
|
|
|
10087
10125
|
function markRef$1(workInProgress) {
|
|
10088
|
-
workInProgress.
|
|
10126
|
+
workInProgress.flags |= Ref;
|
|
10089
10127
|
}
|
|
10090
10128
|
|
|
10091
10129
|
var appendAllChildren;
|
|
@@ -10295,7 +10333,7 @@
|
|
|
10295
10333
|
// This handles the case of React rendering into a container with previous children.
|
|
10296
10334
|
// It's also safe to do for updates too, because current.child would only be null
|
|
10297
10335
|
// if the previous render was null (so the the container would already be empty).
|
|
10298
|
-
workInProgress.
|
|
10336
|
+
workInProgress.flags |= Snapshot;
|
|
10299
10337
|
}
|
|
10300
10338
|
}
|
|
10301
10339
|
|
|
@@ -10399,7 +10437,7 @@
|
|
|
10399
10437
|
popSuspenseContext(workInProgress);
|
|
10400
10438
|
var nextState = workInProgress.memoizedState;
|
|
10401
10439
|
|
|
10402
|
-
if ((workInProgress.
|
|
10440
|
+
if ((workInProgress.flags & DidCapture) !== NoFlags) {
|
|
10403
10441
|
// Something suspended. Re-render with the fallback children.
|
|
10404
10442
|
workInProgress.lanes = renderLanes; // Do not reset the effect list.
|
|
10405
10443
|
|
|
@@ -10456,7 +10494,7 @@
|
|
|
10456
10494
|
// primary children. In mutation mode, we also need the flag to
|
|
10457
10495
|
// *unhide* children that were previously hidden, so check if this
|
|
10458
10496
|
// is currently timed out, too.
|
|
10459
|
-
workInProgress.
|
|
10497
|
+
workInProgress.flags |= Update;
|
|
10460
10498
|
}
|
|
10461
10499
|
}
|
|
10462
10500
|
|
|
@@ -10502,7 +10540,7 @@
|
|
|
10502
10540
|
return null;
|
|
10503
10541
|
}
|
|
10504
10542
|
|
|
10505
|
-
var didSuspendAlready = (workInProgress.
|
|
10543
|
+
var didSuspendAlready = (workInProgress.flags & DidCapture) !== NoFlags;
|
|
10506
10544
|
var renderedTail = renderState.rendering;
|
|
10507
10545
|
|
|
10508
10546
|
if (renderedTail === null) {
|
|
@@ -10517,7 +10555,7 @@
|
|
|
10517
10555
|
// something in the previous committed pass suspended. Otherwise,
|
|
10518
10556
|
// there's no chance so we can skip the expensive call to
|
|
10519
10557
|
// findFirstSuspended.
|
|
10520
|
-
var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.
|
|
10558
|
+
var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.flags & DidCapture) === NoFlags);
|
|
10521
10559
|
|
|
10522
10560
|
if (!cannotBeSuspended) {
|
|
10523
10561
|
var row = workInProgress.child;
|
|
@@ -10527,7 +10565,7 @@
|
|
|
10527
10565
|
|
|
10528
10566
|
if (suspended !== null) {
|
|
10529
10567
|
didSuspendAlready = true;
|
|
10530
|
-
workInProgress.
|
|
10568
|
+
workInProgress.flags |= DidCapture;
|
|
10531
10569
|
cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as
|
|
10532
10570
|
// part of the second pass. In that case nothing will subscribe to
|
|
10533
10571
|
// its thennables. Instead, we'll transfer its thennables to the
|
|
@@ -10545,7 +10583,7 @@
|
|
|
10545
10583
|
|
|
10546
10584
|
if (newThennables !== null) {
|
|
10547
10585
|
workInProgress.updateQueue = newThennables;
|
|
10548
|
-
workInProgress.
|
|
10586
|
+
workInProgress.flags |= Update;
|
|
10549
10587
|
} // Rerender the whole list, but this time, we'll force fallbacks
|
|
10550
10588
|
// to stay in place.
|
|
10551
10589
|
// Reset the effect list before doing the second pass since that's now invalid.
|
|
@@ -10572,7 +10610,7 @@
|
|
|
10572
10610
|
// We have already passed our CPU deadline but we still have rows
|
|
10573
10611
|
// left in the tail. We'll just give up further attempts to render
|
|
10574
10612
|
// the main content and only render fallbacks.
|
|
10575
|
-
workInProgress.
|
|
10613
|
+
workInProgress.flags |= DidCapture;
|
|
10576
10614
|
didSuspendAlready = true;
|
|
10577
10615
|
cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this
|
|
10578
10616
|
// to get it started back up to attempt the next item. While in terms
|
|
@@ -10599,7 +10637,7 @@
|
|
|
10599
10637
|
var _suspended = findFirstSuspended(renderedTail);
|
|
10600
10638
|
|
|
10601
10639
|
if (_suspended !== null) {
|
|
10602
|
-
workInProgress.
|
|
10640
|
+
workInProgress.flags |= DidCapture;
|
|
10603
10641
|
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
|
|
10604
10642
|
// get lost if this row ends up dropped during a second pass.
|
|
10605
10643
|
|
|
@@ -10607,7 +10645,7 @@
|
|
|
10607
10645
|
|
|
10608
10646
|
if (_newThennables !== null) {
|
|
10609
10647
|
workInProgress.updateQueue = _newThennables;
|
|
10610
|
-
workInProgress.
|
|
10648
|
+
workInProgress.flags |= Update;
|
|
10611
10649
|
}
|
|
10612
10650
|
|
|
10613
10651
|
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
|
@@ -10633,7 +10671,7 @@
|
|
|
10633
10671
|
// We have now passed our CPU deadline and we'll just give up further
|
|
10634
10672
|
// attempts to render the main content and only render fallbacks.
|
|
10635
10673
|
// The assumption is that this is usually faster.
|
|
10636
|
-
workInProgress.
|
|
10674
|
+
workInProgress.flags |= DidCapture;
|
|
10637
10675
|
didSuspendAlready = true;
|
|
10638
10676
|
cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this
|
|
10639
10677
|
// to get it started back up to attempt the next item. While in terms
|
|
@@ -10729,7 +10767,7 @@
|
|
|
10729
10767
|
var nextIsHidden = _nextState !== null;
|
|
10730
10768
|
|
|
10731
10769
|
if (prevIsHidden !== nextIsHidden && newProps.mode !== 'unstable-defer-without-hiding') {
|
|
10732
|
-
workInProgress.
|
|
10770
|
+
workInProgress.flags |= Update;
|
|
10733
10771
|
}
|
|
10734
10772
|
}
|
|
10735
10773
|
|
|
@@ -10754,10 +10792,10 @@
|
|
|
10754
10792
|
popContext(workInProgress);
|
|
10755
10793
|
}
|
|
10756
10794
|
|
|
10757
|
-
var
|
|
10795
|
+
var flags = workInProgress.flags;
|
|
10758
10796
|
|
|
10759
|
-
if (
|
|
10760
|
-
workInProgress.
|
|
10797
|
+
if (flags & ShouldCapture) {
|
|
10798
|
+
workInProgress.flags = flags & ~ShouldCapture | DidCapture;
|
|
10761
10799
|
|
|
10762
10800
|
if ( (workInProgress.mode & ProfileMode) !== NoMode) {
|
|
10763
10801
|
transferActualDuration(workInProgress);
|
|
@@ -10774,15 +10812,15 @@
|
|
|
10774
10812
|
popHostContainer(workInProgress);
|
|
10775
10813
|
popTopLevelContextObject(workInProgress);
|
|
10776
10814
|
resetWorkInProgressVersions();
|
|
10777
|
-
var
|
|
10815
|
+
var _flags = workInProgress.flags;
|
|
10778
10816
|
|
|
10779
|
-
if (!((
|
|
10817
|
+
if (!((_flags & DidCapture) === NoFlags)) {
|
|
10780
10818
|
{
|
|
10781
10819
|
throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." );
|
|
10782
10820
|
}
|
|
10783
10821
|
}
|
|
10784
10822
|
|
|
10785
|
-
workInProgress.
|
|
10823
|
+
workInProgress.flags = _flags & ~ShouldCapture | DidCapture;
|
|
10786
10824
|
return workInProgress;
|
|
10787
10825
|
}
|
|
10788
10826
|
|
|
@@ -10797,10 +10835,10 @@
|
|
|
10797
10835
|
{
|
|
10798
10836
|
popSuspenseContext(workInProgress);
|
|
10799
10837
|
|
|
10800
|
-
var
|
|
10838
|
+
var _flags2 = workInProgress.flags;
|
|
10801
10839
|
|
|
10802
|
-
if (
|
|
10803
|
-
workInProgress.
|
|
10840
|
+
if (_flags2 & ShouldCapture) {
|
|
10841
|
+
workInProgress.flags = _flags2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary.
|
|
10804
10842
|
|
|
10805
10843
|
if ( (workInProgress.mode & ProfileMode) !== NoMode) {
|
|
10806
10844
|
transferActualDuration(workInProgress);
|
|
@@ -11084,7 +11122,7 @@
|
|
|
11084
11122
|
|
|
11085
11123
|
function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes) {
|
|
11086
11124
|
// The source fiber did not complete.
|
|
11087
|
-
sourceFiber.
|
|
11125
|
+
sourceFiber.flags |= Incomplete; // Its effect list is no longer valid.
|
|
11088
11126
|
|
|
11089
11127
|
sourceFiber.firstEffect = sourceFiber.lastEffect = null;
|
|
11090
11128
|
|
|
@@ -11135,12 +11173,12 @@
|
|
|
11135
11173
|
|
|
11136
11174
|
|
|
11137
11175
|
if ((_workInProgress.mode & BlockingMode) === NoMode) {
|
|
11138
|
-
_workInProgress.
|
|
11139
|
-
sourceFiber.
|
|
11176
|
+
_workInProgress.flags |= DidCapture;
|
|
11177
|
+
sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete.
|
|
11140
11178
|
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
|
11141
11179
|
// all lifecycle effect tags.
|
|
11142
11180
|
|
|
11143
|
-
sourceFiber.
|
|
11181
|
+
sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete);
|
|
11144
11182
|
|
|
11145
11183
|
if (sourceFiber.tag === ClassComponent) {
|
|
11146
11184
|
var currentSourceFiber = sourceFiber.alternate;
|
|
@@ -11190,8 +11228,8 @@
|
|
|
11190
11228
|
// that we can show the initial loading state as quickly as possible.
|
|
11191
11229
|
//
|
|
11192
11230
|
// If we hit a "Delayed" case, such as when we'd switch from content back into
|
|
11193
|
-
// a fallback, then we should always suspend/restart.
|
|
11194
|
-
// this case. If none is defined, JND is used instead.
|
|
11231
|
+
// a fallback, then we should always suspend/restart. Transitions apply
|
|
11232
|
+
// to this case. If none is defined, JND is used instead.
|
|
11195
11233
|
//
|
|
11196
11234
|
// If we're already showing a fallback and it gets "retried", allowing us to show
|
|
11197
11235
|
// another level, but there's still an inner boundary that would show a fallback,
|
|
@@ -11208,7 +11246,7 @@
|
|
|
11208
11246
|
|
|
11209
11247
|
|
|
11210
11248
|
attachPingListener(root, wakeable, rootRenderLanes);
|
|
11211
|
-
_workInProgress.
|
|
11249
|
+
_workInProgress.flags |= ShouldCapture;
|
|
11212
11250
|
_workInProgress.lanes = rootRenderLanes;
|
|
11213
11251
|
return;
|
|
11214
11252
|
} // This boundary already captured during this render. Continue to the next
|
|
@@ -11235,7 +11273,7 @@
|
|
|
11235
11273
|
case HostRoot:
|
|
11236
11274
|
{
|
|
11237
11275
|
var _errorInfo = value;
|
|
11238
|
-
workInProgress.
|
|
11276
|
+
workInProgress.flags |= ShouldCapture;
|
|
11239
11277
|
var lane = pickArbitraryLane(rootRenderLanes);
|
|
11240
11278
|
workInProgress.lanes = mergeLanes(workInProgress.lanes, lane);
|
|
11241
11279
|
|
|
@@ -11251,8 +11289,8 @@
|
|
|
11251
11289
|
var ctor = workInProgress.type;
|
|
11252
11290
|
var instance = workInProgress.stateNode;
|
|
11253
11291
|
|
|
11254
|
-
if ((workInProgress.
|
|
11255
|
-
workInProgress.
|
|
11292
|
+
if ((workInProgress.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
|
|
11293
|
+
workInProgress.flags |= ShouldCapture;
|
|
11256
11294
|
|
|
11257
11295
|
var _lane = pickArbitraryLane(rootRenderLanes);
|
|
11258
11296
|
|
|
@@ -11504,18 +11542,18 @@
|
|
|
11504
11542
|
}; // Capture errors so they don't interrupt unmounting.
|
|
11505
11543
|
|
|
11506
11544
|
|
|
11507
|
-
function safelyCallComponentWillUnmount(current, instance
|
|
11545
|
+
function safelyCallComponentWillUnmount(current, instance) {
|
|
11508
11546
|
{
|
|
11509
11547
|
invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current, instance);
|
|
11510
11548
|
|
|
11511
11549
|
if (hasCaughtError()) {
|
|
11512
11550
|
var unmountError = clearCaughtError();
|
|
11513
|
-
captureCommitPhaseError(current,
|
|
11551
|
+
captureCommitPhaseError(current, unmountError);
|
|
11514
11552
|
}
|
|
11515
11553
|
}
|
|
11516
11554
|
}
|
|
11517
11555
|
|
|
11518
|
-
function safelyDetachRef(current
|
|
11556
|
+
function safelyDetachRef(current) {
|
|
11519
11557
|
var ref = current.ref;
|
|
11520
11558
|
|
|
11521
11559
|
if (ref !== null) {
|
|
@@ -11525,7 +11563,7 @@
|
|
|
11525
11563
|
|
|
11526
11564
|
if (hasCaughtError()) {
|
|
11527
11565
|
var refError = clearCaughtError();
|
|
11528
|
-
captureCommitPhaseError(current,
|
|
11566
|
+
captureCommitPhaseError(current, refError);
|
|
11529
11567
|
}
|
|
11530
11568
|
}
|
|
11531
11569
|
} else {
|
|
@@ -11534,13 +11572,13 @@
|
|
|
11534
11572
|
}
|
|
11535
11573
|
}
|
|
11536
11574
|
|
|
11537
|
-
function safelyCallDestroy(current,
|
|
11575
|
+
function safelyCallDestroy(current, destroy) {
|
|
11538
11576
|
{
|
|
11539
11577
|
invokeGuardedCallback(null, destroy, null);
|
|
11540
11578
|
|
|
11541
11579
|
if (hasCaughtError()) {
|
|
11542
11580
|
var error = clearCaughtError();
|
|
11543
|
-
captureCommitPhaseError(current,
|
|
11581
|
+
captureCommitPhaseError(current, error);
|
|
11544
11582
|
}
|
|
11545
11583
|
}
|
|
11546
11584
|
}
|
|
@@ -11557,7 +11595,7 @@
|
|
|
11557
11595
|
|
|
11558
11596
|
case ClassComponent:
|
|
11559
11597
|
{
|
|
11560
|
-
if (finishedWork.
|
|
11598
|
+
if (finishedWork.flags & Snapshot) {
|
|
11561
11599
|
if (current !== null) {
|
|
11562
11600
|
var prevProps = current.memoizedProps;
|
|
11563
11601
|
var prevState = current.memoizedState;
|
|
@@ -11599,7 +11637,7 @@
|
|
|
11599
11637
|
case HostRoot:
|
|
11600
11638
|
{
|
|
11601
11639
|
{
|
|
11602
|
-
if (finishedWork.
|
|
11640
|
+
if (finishedWork.flags & Snapshot) {
|
|
11603
11641
|
var root = finishedWork.stateNode;
|
|
11604
11642
|
clearContainer(root.containerInfo);
|
|
11605
11643
|
}
|
|
@@ -11698,7 +11736,7 @@
|
|
|
11698
11736
|
next = _effect.next,
|
|
11699
11737
|
tag = _effect.tag;
|
|
11700
11738
|
|
|
11701
|
-
if ((tag & Passive$1) !==
|
|
11739
|
+
if ((tag & Passive$1) !== NoFlags$1 && (tag & HasEffect) !== NoFlags$1) {
|
|
11702
11740
|
enqueuePendingPassiveHookEffectUnmount(finishedWork, effect);
|
|
11703
11741
|
enqueuePendingPassiveHookEffectMount(finishedWork, effect);
|
|
11704
11742
|
}
|
|
@@ -11731,7 +11769,7 @@
|
|
|
11731
11769
|
{
|
|
11732
11770
|
var instance = finishedWork.stateNode;
|
|
11733
11771
|
|
|
11734
|
-
if (finishedWork.
|
|
11772
|
+
if (finishedWork.flags & Update) {
|
|
11735
11773
|
if (current === null) {
|
|
11736
11774
|
// We could update instance props and state here,
|
|
11737
11775
|
// but instead we rely on them being set during last render.
|
|
@@ -11835,7 +11873,7 @@
|
|
|
11835
11873
|
// These effects should only be committed when components are first mounted,
|
|
11836
11874
|
// aka when there is no current/alternate.
|
|
11837
11875
|
|
|
11838
|
-
if (current === null && finishedWork.
|
|
11876
|
+
if (current === null && finishedWork.flags & Update) {
|
|
11839
11877
|
var type = finishedWork.type;
|
|
11840
11878
|
var props = finishedWork.memoizedProps;
|
|
11841
11879
|
}
|
|
@@ -11987,7 +12025,7 @@
|
|
|
11987
12025
|
// interrupt deletion, so it's okay
|
|
11988
12026
|
|
|
11989
12027
|
|
|
11990
|
-
function commitUnmount(finishedRoot, current,
|
|
12028
|
+
function commitUnmount(finishedRoot, current, renderPriorityLevel) {
|
|
11991
12029
|
onCommitUnmount(current);
|
|
11992
12030
|
|
|
11993
12031
|
switch (current.tag) {
|
|
@@ -12012,11 +12050,11 @@
|
|
|
12012
12050
|
tag = _effect2.tag;
|
|
12013
12051
|
|
|
12014
12052
|
if (destroy !== undefined) {
|
|
12015
|
-
if ((tag & Passive$1) !==
|
|
12053
|
+
if ((tag & Passive$1) !== NoFlags$1) {
|
|
12016
12054
|
enqueuePendingPassiveHookEffectUnmount(current, effect);
|
|
12017
12055
|
} else {
|
|
12018
12056
|
{
|
|
12019
|
-
safelyCallDestroy(current,
|
|
12057
|
+
safelyCallDestroy(current, destroy);
|
|
12020
12058
|
}
|
|
12021
12059
|
}
|
|
12022
12060
|
}
|
|
@@ -12031,11 +12069,11 @@
|
|
|
12031
12069
|
|
|
12032
12070
|
case ClassComponent:
|
|
12033
12071
|
{
|
|
12034
|
-
safelyDetachRef(current
|
|
12072
|
+
safelyDetachRef(current);
|
|
12035
12073
|
var instance = current.stateNode;
|
|
12036
12074
|
|
|
12037
12075
|
if (typeof instance.componentWillUnmount === 'function') {
|
|
12038
|
-
safelyCallComponentWillUnmount(current, instance
|
|
12076
|
+
safelyCallComponentWillUnmount(current, instance);
|
|
12039
12077
|
}
|
|
12040
12078
|
|
|
12041
12079
|
return;
|
|
@@ -12043,7 +12081,7 @@
|
|
|
12043
12081
|
|
|
12044
12082
|
case HostComponent:
|
|
12045
12083
|
{
|
|
12046
|
-
safelyDetachRef(current
|
|
12084
|
+
safelyDetachRef(current);
|
|
12047
12085
|
return;
|
|
12048
12086
|
}
|
|
12049
12087
|
|
|
@@ -12053,7 +12091,7 @@
|
|
|
12053
12091
|
// We are also not using this parent because
|
|
12054
12092
|
// the portal will get pushed immediately.
|
|
12055
12093
|
{
|
|
12056
|
-
unmountHostComponents(finishedRoot, current
|
|
12094
|
+
unmountHostComponents(finishedRoot, current);
|
|
12057
12095
|
}
|
|
12058
12096
|
|
|
12059
12097
|
return;
|
|
@@ -12079,7 +12117,7 @@
|
|
|
12079
12117
|
}
|
|
12080
12118
|
}
|
|
12081
12119
|
|
|
12082
|
-
function commitNestedUnmounts(finishedRoot, root,
|
|
12120
|
+
function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) {
|
|
12083
12121
|
// While we're inside a removed host node we don't want to call
|
|
12084
12122
|
// removeChild on the inner nodes because they're removed by the top
|
|
12085
12123
|
// call anyway. We also want to call componentWillUnmount on all
|
|
@@ -12088,7 +12126,7 @@
|
|
|
12088
12126
|
var node = root;
|
|
12089
12127
|
|
|
12090
12128
|
while (true) {
|
|
12091
|
-
commitUnmount(finishedRoot, node
|
|
12129
|
+
commitUnmount(finishedRoot, node); // Visit children because they may contain more composite or host nodes.
|
|
12092
12130
|
// Skip portals because commitUnmount() currently visits them recursively.
|
|
12093
12131
|
|
|
12094
12132
|
if (node.child !== null && ( // If we use mutation we drill down into portals using commitUnmount above.
|
|
@@ -12193,7 +12231,7 @@
|
|
|
12193
12231
|
while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) {
|
|
12194
12232
|
// If it is not host node and, we might have a host node inside it.
|
|
12195
12233
|
// Try to search down until we find one.
|
|
12196
|
-
if (node.
|
|
12234
|
+
if (node.flags & Placement) {
|
|
12197
12235
|
// If we don't have a child, try the siblings instead.
|
|
12198
12236
|
continue siblings;
|
|
12199
12237
|
} // If we don't have a child, try the siblings instead.
|
|
@@ -12209,7 +12247,7 @@
|
|
|
12209
12247
|
} // Check if this host node is stable or about to be placed.
|
|
12210
12248
|
|
|
12211
12249
|
|
|
12212
|
-
if (!(node.
|
|
12250
|
+
if (!(node.flags & Placement)) {
|
|
12213
12251
|
// Found it!
|
|
12214
12252
|
return node.stateNode;
|
|
12215
12253
|
}
|
|
@@ -12254,9 +12292,9 @@
|
|
|
12254
12292
|
|
|
12255
12293
|
}
|
|
12256
12294
|
|
|
12257
|
-
if (parentFiber.
|
|
12295
|
+
if (parentFiber.flags & ContentReset) {
|
|
12258
12296
|
|
|
12259
|
-
parentFiber.
|
|
12297
|
+
parentFiber.flags &= ~ContentReset;
|
|
12260
12298
|
}
|
|
12261
12299
|
|
|
12262
12300
|
var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its
|
|
@@ -12323,7 +12361,7 @@
|
|
|
12323
12361
|
}
|
|
12324
12362
|
}
|
|
12325
12363
|
|
|
12326
|
-
function unmountHostComponents(finishedRoot, current,
|
|
12364
|
+
function unmountHostComponents(finishedRoot, current, renderPriorityLevel) {
|
|
12327
12365
|
// We only have the top Fiber that was deleted but we need to recurse down its
|
|
12328
12366
|
// children to find all the terminal nodes.
|
|
12329
12367
|
var node = current; // Each iteration, currentParent is populated with node's host parent if not
|
|
@@ -12372,7 +12410,7 @@
|
|
|
12372
12410
|
}
|
|
12373
12411
|
|
|
12374
12412
|
if (node.tag === HostComponent || node.tag === HostText) {
|
|
12375
|
-
commitNestedUnmounts(finishedRoot, node
|
|
12413
|
+
commitNestedUnmounts(finishedRoot, node); // After all the children have unmounted, it is now safe to remove the
|
|
12376
12414
|
// node from the tree.
|
|
12377
12415
|
|
|
12378
12416
|
if (currentParentIsContainer) {
|
|
@@ -12393,7 +12431,7 @@
|
|
|
12393
12431
|
continue;
|
|
12394
12432
|
}
|
|
12395
12433
|
} else {
|
|
12396
|
-
commitUnmount(finishedRoot, node
|
|
12434
|
+
commitUnmount(finishedRoot, node); // Visit children because we may find more host components below.
|
|
12397
12435
|
|
|
12398
12436
|
if (node.child !== null) {
|
|
12399
12437
|
node.child.return = node;
|
|
@@ -12425,11 +12463,11 @@
|
|
|
12425
12463
|
}
|
|
12426
12464
|
}
|
|
12427
12465
|
|
|
12428
|
-
function commitDeletion(finishedRoot, current,
|
|
12466
|
+
function commitDeletion(finishedRoot, current, renderPriorityLevel) {
|
|
12429
12467
|
{
|
|
12430
12468
|
// Recursively delete all host nodes from the parent.
|
|
12431
12469
|
// Detach refs and call componentWillUnmount() on the whole subtree.
|
|
12432
|
-
unmountHostComponents(finishedRoot, current
|
|
12470
|
+
unmountHostComponents(finishedRoot, current);
|
|
12433
12471
|
}
|
|
12434
12472
|
|
|
12435
12473
|
var alternate = current.alternate;
|
|
@@ -12830,7 +12868,7 @@
|
|
|
12830
12868
|
currentEventTime = now();
|
|
12831
12869
|
return currentEventTime;
|
|
12832
12870
|
}
|
|
12833
|
-
function requestUpdateLane(fiber
|
|
12871
|
+
function requestUpdateLane(fiber) {
|
|
12834
12872
|
// Special cases
|
|
12835
12873
|
var mode = fiber.mode;
|
|
12836
12874
|
|
|
@@ -12858,10 +12896,9 @@
|
|
|
12858
12896
|
currentEventWipLanes = workInProgressRootIncludedLanes;
|
|
12859
12897
|
}
|
|
12860
12898
|
|
|
12861
|
-
|
|
12862
|
-
|
|
12863
|
-
|
|
12864
|
-
// TODO: This will coerce numbers larger than 31 bits to 0.
|
|
12899
|
+
var isTransition = requestCurrentTransition() !== NoTransition;
|
|
12900
|
+
|
|
12901
|
+
if (isTransition) {
|
|
12865
12902
|
if (currentEventPendingLanes !== NoLanes) {
|
|
12866
12903
|
currentEventPendingLanes = mostRecentlyUpdatedRoot !== null ? mostRecentlyUpdatedRoot.pendingLanes : NoLanes;
|
|
12867
12904
|
}
|
|
@@ -13015,7 +13052,7 @@
|
|
|
13015
13052
|
}
|
|
13016
13053
|
|
|
13017
13054
|
{
|
|
13018
|
-
if (alternate === null && (sourceFiber.
|
|
13055
|
+
if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
13019
13056
|
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
|
|
13020
13057
|
}
|
|
13021
13058
|
} // Walk the parent path to the root and update the child expiration time.
|
|
@@ -13032,7 +13069,7 @@
|
|
|
13032
13069
|
alternate.childLanes = mergeLanes(alternate.childLanes, lane);
|
|
13033
13070
|
} else {
|
|
13034
13071
|
{
|
|
13035
|
-
if ((parent.
|
|
13072
|
+
if ((parent.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
13036
13073
|
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
|
|
13037
13074
|
}
|
|
13038
13075
|
}
|
|
@@ -13287,7 +13324,7 @@
|
|
|
13287
13324
|
if (!shouldForceFlushFallbacksInDEV()) {
|
|
13288
13325
|
// This is not a transition, but we did trigger an avoided state.
|
|
13289
13326
|
// Schedule a placeholder to display after a short delay, using the Just
|
|
13290
|
-
//
|
|
13327
|
+
// Noticeable Difference.
|
|
13291
13328
|
// TODO: Is the JND optimization worth the added complexity? If this is
|
|
13292
13329
|
// the only reason we track the event time, then probably not.
|
|
13293
13330
|
// Consider removing.
|
|
@@ -13796,7 +13833,7 @@
|
|
|
13796
13833
|
var current = completedWork.alternate;
|
|
13797
13834
|
var returnFiber = completedWork.return; // Check if the work completed or if something threw.
|
|
13798
13835
|
|
|
13799
|
-
if ((completedWork.
|
|
13836
|
+
if ((completedWork.flags & Incomplete) === NoFlags) {
|
|
13800
13837
|
setCurrentFiber(completedWork);
|
|
13801
13838
|
var next = void 0;
|
|
13802
13839
|
|
|
@@ -13820,7 +13857,7 @@
|
|
|
13820
13857
|
resetChildLanes(completedWork);
|
|
13821
13858
|
|
|
13822
13859
|
if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete
|
|
13823
|
-
(returnFiber.
|
|
13860
|
+
(returnFiber.flags & Incomplete) === NoFlags) {
|
|
13824
13861
|
// Append all the effects of the subtree and this fiber onto the effect
|
|
13825
13862
|
// list of the parent. The completion order of the children affects the
|
|
13826
13863
|
// side-effect order.
|
|
@@ -13842,11 +13879,11 @@
|
|
|
13842
13879
|
// at the end.
|
|
13843
13880
|
|
|
13844
13881
|
|
|
13845
|
-
var
|
|
13882
|
+
var flags = completedWork.flags; // Skip both NoWork and PerformedWork tags when creating the effect
|
|
13846
13883
|
// list. PerformedWork effect is read by React DevTools but shouldn't be
|
|
13847
13884
|
// committed.
|
|
13848
13885
|
|
|
13849
|
-
if (
|
|
13886
|
+
if (flags > PerformedWork) {
|
|
13850
13887
|
if (returnFiber.lastEffect !== null) {
|
|
13851
13888
|
returnFiber.lastEffect.nextEffect = completedWork;
|
|
13852
13889
|
} else {
|
|
@@ -13868,7 +13905,7 @@
|
|
|
13868
13905
|
// back here again.
|
|
13869
13906
|
// Since we're restarting, remove anything that is not a host effect
|
|
13870
13907
|
// from the effect tag.
|
|
13871
|
-
_next.
|
|
13908
|
+
_next.flags &= HostEffectMask;
|
|
13872
13909
|
workInProgress = _next;
|
|
13873
13910
|
return;
|
|
13874
13911
|
}
|
|
@@ -13891,7 +13928,7 @@
|
|
|
13891
13928
|
if (returnFiber !== null) {
|
|
13892
13929
|
// Mark the parent fiber as incomplete and clear its effect list.
|
|
13893
13930
|
returnFiber.firstEffect = returnFiber.lastEffect = null;
|
|
13894
|
-
returnFiber.
|
|
13931
|
+
returnFiber.flags |= Incomplete;
|
|
13895
13932
|
}
|
|
13896
13933
|
}
|
|
13897
13934
|
|
|
@@ -14045,7 +14082,7 @@
|
|
|
14045
14082
|
|
|
14046
14083
|
var firstEffect;
|
|
14047
14084
|
|
|
14048
|
-
if (finishedWork.
|
|
14085
|
+
if (finishedWork.flags > PerformedWork) {
|
|
14049
14086
|
// A fiber's effect list consists only of its children, not itself. So if
|
|
14050
14087
|
// the root has an effect, we need to add it to the end of the list. The
|
|
14051
14088
|
// resulting list is the set that would belong to the root's parent, if it
|
|
@@ -14090,7 +14127,7 @@
|
|
|
14090
14127
|
}
|
|
14091
14128
|
|
|
14092
14129
|
var error = clearCaughtError();
|
|
14093
|
-
captureCommitPhaseError(nextEffect,
|
|
14130
|
+
captureCommitPhaseError(nextEffect, error);
|
|
14094
14131
|
nextEffect = nextEffect.nextEffect;
|
|
14095
14132
|
}
|
|
14096
14133
|
}
|
|
@@ -14121,7 +14158,7 @@
|
|
|
14121
14158
|
|
|
14122
14159
|
var _error = clearCaughtError();
|
|
14123
14160
|
|
|
14124
|
-
captureCommitPhaseError(nextEffect,
|
|
14161
|
+
captureCommitPhaseError(nextEffect, _error);
|
|
14125
14162
|
nextEffect = nextEffect.nextEffect;
|
|
14126
14163
|
}
|
|
14127
14164
|
}
|
|
@@ -14151,7 +14188,7 @@
|
|
|
14151
14188
|
|
|
14152
14189
|
var _error2 = clearCaughtError();
|
|
14153
14190
|
|
|
14154
|
-
captureCommitPhaseError(nextEffect,
|
|
14191
|
+
captureCommitPhaseError(nextEffect, _error2);
|
|
14155
14192
|
nextEffect = nextEffect.nextEffect;
|
|
14156
14193
|
}
|
|
14157
14194
|
}
|
|
@@ -14197,7 +14234,7 @@
|
|
|
14197
14234
|
var nextNextEffect = nextEffect.nextEffect;
|
|
14198
14235
|
nextEffect.nextEffect = null;
|
|
14199
14236
|
|
|
14200
|
-
if (nextEffect.
|
|
14237
|
+
if (nextEffect.flags & Deletion) {
|
|
14201
14238
|
detachFiberAfterEffects(nextEffect);
|
|
14202
14239
|
}
|
|
14203
14240
|
|
|
@@ -14283,7 +14320,7 @@
|
|
|
14283
14320
|
var current = nextEffect.alternate;
|
|
14284
14321
|
|
|
14285
14322
|
if (!shouldFireAfterActiveInstanceBlur && focusedInstanceHandle !== null) {
|
|
14286
|
-
if ((nextEffect.
|
|
14323
|
+
if ((nextEffect.flags & Deletion) !== NoFlags) {
|
|
14287
14324
|
if (doesFiberContain(nextEffect, focusedInstanceHandle)) {
|
|
14288
14325
|
shouldFireAfterActiveInstanceBlur = true;
|
|
14289
14326
|
}
|
|
@@ -14295,15 +14332,15 @@
|
|
|
14295
14332
|
}
|
|
14296
14333
|
}
|
|
14297
14334
|
|
|
14298
|
-
var
|
|
14335
|
+
var flags = nextEffect.flags;
|
|
14299
14336
|
|
|
14300
|
-
if ((
|
|
14337
|
+
if ((flags & Snapshot) !== NoFlags) {
|
|
14301
14338
|
setCurrentFiber(nextEffect);
|
|
14302
14339
|
commitBeforeMutationLifeCycles(current, nextEffect);
|
|
14303
14340
|
resetCurrentFiber();
|
|
14304
14341
|
}
|
|
14305
14342
|
|
|
14306
|
-
if ((
|
|
14343
|
+
if ((flags & Passive) !== NoFlags) {
|
|
14307
14344
|
// If there are passive effects, schedule a callback to flush at
|
|
14308
14345
|
// the earliest opportunity.
|
|
14309
14346
|
if (!rootDoesHavePassiveEffects) {
|
|
@@ -14323,13 +14360,13 @@
|
|
|
14323
14360
|
// TODO: Should probably move the bulk of this function to commitWork.
|
|
14324
14361
|
while (nextEffect !== null) {
|
|
14325
14362
|
setCurrentFiber(nextEffect);
|
|
14326
|
-
var
|
|
14363
|
+
var flags = nextEffect.flags;
|
|
14327
14364
|
|
|
14328
|
-
if (
|
|
14365
|
+
if (flags & ContentReset) {
|
|
14329
14366
|
commitResetTextContent(nextEffect);
|
|
14330
14367
|
}
|
|
14331
14368
|
|
|
14332
|
-
if (
|
|
14369
|
+
if (flags & Ref) {
|
|
14333
14370
|
var current = nextEffect.alternate;
|
|
14334
14371
|
|
|
14335
14372
|
if (current !== null) {
|
|
@@ -14341,9 +14378,9 @@
|
|
|
14341
14378
|
// switch on that value.
|
|
14342
14379
|
|
|
14343
14380
|
|
|
14344
|
-
var
|
|
14381
|
+
var primaryFlags = flags & (Placement | Update | Deletion | Hydrating);
|
|
14345
14382
|
|
|
14346
|
-
switch (
|
|
14383
|
+
switch (primaryFlags) {
|
|
14347
14384
|
case Placement:
|
|
14348
14385
|
{
|
|
14349
14386
|
commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is
|
|
@@ -14351,7 +14388,7 @@
|
|
|
14351
14388
|
// TODO: findDOMNode doesn't rely on this any more but isMounted does
|
|
14352
14389
|
// and isMounted is deprecated anyway so we should be able to kill this.
|
|
14353
14390
|
|
|
14354
|
-
nextEffect.
|
|
14391
|
+
nextEffect.flags &= ~Placement;
|
|
14355
14392
|
break;
|
|
14356
14393
|
}
|
|
14357
14394
|
|
|
@@ -14361,7 +14398,7 @@
|
|
|
14361
14398
|
commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is
|
|
14362
14399
|
// inserted, before any life-cycles like componentDidMount gets called.
|
|
14363
14400
|
|
|
14364
|
-
nextEffect.
|
|
14401
|
+
nextEffect.flags &= ~Placement; // Update
|
|
14365
14402
|
|
|
14366
14403
|
var _current = nextEffect.alternate;
|
|
14367
14404
|
commitWork(_current, nextEffect);
|
|
@@ -14370,13 +14407,13 @@
|
|
|
14370
14407
|
|
|
14371
14408
|
case Hydrating:
|
|
14372
14409
|
{
|
|
14373
|
-
nextEffect.
|
|
14410
|
+
nextEffect.flags &= ~Hydrating;
|
|
14374
14411
|
break;
|
|
14375
14412
|
}
|
|
14376
14413
|
|
|
14377
14414
|
case HydratingAndUpdate:
|
|
14378
14415
|
{
|
|
14379
|
-
nextEffect.
|
|
14416
|
+
nextEffect.flags &= ~Hydrating; // Update
|
|
14380
14417
|
|
|
14381
14418
|
var _current2 = nextEffect.alternate;
|
|
14382
14419
|
commitWork(_current2, nextEffect);
|
|
@@ -14392,7 +14429,7 @@
|
|
|
14392
14429
|
|
|
14393
14430
|
case Deletion:
|
|
14394
14431
|
{
|
|
14395
|
-
commitDeletion(root, nextEffect
|
|
14432
|
+
commitDeletion(root, nextEffect);
|
|
14396
14433
|
break;
|
|
14397
14434
|
}
|
|
14398
14435
|
}
|
|
@@ -14407,15 +14444,15 @@
|
|
|
14407
14444
|
|
|
14408
14445
|
while (nextEffect !== null) {
|
|
14409
14446
|
setCurrentFiber(nextEffect);
|
|
14410
|
-
var
|
|
14447
|
+
var flags = nextEffect.flags;
|
|
14411
14448
|
|
|
14412
|
-
if (
|
|
14449
|
+
if (flags & (Update | Callback)) {
|
|
14413
14450
|
var current = nextEffect.alternate;
|
|
14414
14451
|
commitLifeCycles(root, current, nextEffect);
|
|
14415
14452
|
}
|
|
14416
14453
|
|
|
14417
14454
|
{
|
|
14418
|
-
if (
|
|
14455
|
+
if (flags & Ref) {
|
|
14419
14456
|
commitAttachRef(nextEffect);
|
|
14420
14457
|
}
|
|
14421
14458
|
}
|
|
@@ -14453,11 +14490,11 @@
|
|
|
14453
14490
|
pendingPassiveHookEffectsUnmount.push(effect, fiber);
|
|
14454
14491
|
|
|
14455
14492
|
{
|
|
14456
|
-
fiber.
|
|
14493
|
+
fiber.flags |= PassiveUnmountPendingDev;
|
|
14457
14494
|
var alternate = fiber.alternate;
|
|
14458
14495
|
|
|
14459
14496
|
if (alternate !== null) {
|
|
14460
|
-
alternate.
|
|
14497
|
+
alternate.flags |= PassiveUnmountPendingDev;
|
|
14461
14498
|
}
|
|
14462
14499
|
}
|
|
14463
14500
|
|
|
@@ -14515,11 +14552,11 @@
|
|
|
14515
14552
|
_effect.destroy = undefined;
|
|
14516
14553
|
|
|
14517
14554
|
{
|
|
14518
|
-
fiber.
|
|
14555
|
+
fiber.flags &= ~PassiveUnmountPendingDev;
|
|
14519
14556
|
var alternate = fiber.alternate;
|
|
14520
14557
|
|
|
14521
14558
|
if (alternate !== null) {
|
|
14522
|
-
alternate.
|
|
14559
|
+
alternate.flags &= ~PassiveUnmountPendingDev;
|
|
14523
14560
|
}
|
|
14524
14561
|
}
|
|
14525
14562
|
|
|
@@ -14539,7 +14576,7 @@
|
|
|
14539
14576
|
}
|
|
14540
14577
|
|
|
14541
14578
|
var error = clearCaughtError();
|
|
14542
|
-
captureCommitPhaseError(fiber,
|
|
14579
|
+
captureCommitPhaseError(fiber, error);
|
|
14543
14580
|
}
|
|
14544
14581
|
|
|
14545
14582
|
resetCurrentFiber();
|
|
@@ -14571,7 +14608,7 @@
|
|
|
14571
14608
|
|
|
14572
14609
|
var _error4 = clearCaughtError();
|
|
14573
14610
|
|
|
14574
|
-
captureCommitPhaseError(_fiber,
|
|
14611
|
+
captureCommitPhaseError(_fiber, _error4);
|
|
14575
14612
|
}
|
|
14576
14613
|
|
|
14577
14614
|
resetCurrentFiber();
|
|
@@ -14588,7 +14625,7 @@
|
|
|
14588
14625
|
|
|
14589
14626
|
effect.nextEffect = null;
|
|
14590
14627
|
|
|
14591
|
-
if (effect.
|
|
14628
|
+
if (effect.flags & Deletion) {
|
|
14592
14629
|
detachFiberAfterEffects(effect);
|
|
14593
14630
|
}
|
|
14594
14631
|
|
|
@@ -14646,7 +14683,7 @@
|
|
|
14646
14683
|
}
|
|
14647
14684
|
}
|
|
14648
14685
|
|
|
14649
|
-
function captureCommitPhaseError(sourceFiber,
|
|
14686
|
+
function captureCommitPhaseError(sourceFiber, error) {
|
|
14650
14687
|
if (sourceFiber.tag === HostRoot) {
|
|
14651
14688
|
// Error was thrown at the root. There is no parent, so the root
|
|
14652
14689
|
// itself should capture it.
|
|
@@ -14654,11 +14691,7 @@
|
|
|
14654
14691
|
return;
|
|
14655
14692
|
}
|
|
14656
14693
|
|
|
14657
|
-
var fiber =
|
|
14658
|
-
|
|
14659
|
-
{
|
|
14660
|
-
fiber = sourceFiber.return;
|
|
14661
|
-
}
|
|
14694
|
+
var fiber = sourceFiber.return;
|
|
14662
14695
|
|
|
14663
14696
|
while (fiber !== null) {
|
|
14664
14697
|
if (fiber.tag === HostRoot) {
|
|
@@ -14879,7 +14912,7 @@
|
|
|
14879
14912
|
// we can assume that they would have prevented this update.
|
|
14880
14913
|
|
|
14881
14914
|
|
|
14882
|
-
if ((fiber.
|
|
14915
|
+
if ((fiber.flags & PassiveUnmountPendingDev) !== NoFlags) {
|
|
14883
14916
|
return;
|
|
14884
14917
|
} // We show the whole stack but dedupe on the top component's name because
|
|
14885
14918
|
// the problematic code almost always lies inside that component.
|
|
@@ -15177,26 +15210,10 @@
|
|
|
15177
15210
|
});
|
|
15178
15211
|
}
|
|
15179
15212
|
} // `act` testing API
|
|
15180
|
-
//
|
|
15181
|
-
// TODO: This is mostly a copy-paste from the legacy `act`, which does not have
|
|
15182
|
-
// access to the same internals that we do here. Some trade offs in the
|
|
15183
|
-
// implementation no longer make sense.
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
var isFlushingAct = false;
|
|
15187
|
-
var isInsideThisAct = false; // TODO: Yes, this is confusing. See above comment. We'll refactor it.
|
|
15188
15213
|
|
|
15189
15214
|
function shouldForceFlushFallbacksInDEV() {
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
if (IsThisRendererActing.current) {
|
|
15193
|
-
// `isInsideAct` is only used by the reconciler implementation of `act`.
|
|
15194
|
-
// We don't want to flush suspense fallbacks until the end.
|
|
15195
|
-
return !isInsideThisAct;
|
|
15196
|
-
} // Flush callbacks at the end.
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
return isFlushingAct;
|
|
15215
|
+
// Never force flush in production. This function should get stripped out.
|
|
15216
|
+
return actingUpdatesScopeDepth > 0;
|
|
15200
15217
|
}
|
|
15201
15218
|
|
|
15202
15219
|
var flushMockScheduler = Scheduler$1.unstable_flushAllWithoutAsserting;
|
|
@@ -15205,19 +15222,12 @@
|
|
|
15205
15222
|
|
|
15206
15223
|
function flushActWork() {
|
|
15207
15224
|
if (flushMockScheduler !== undefined) {
|
|
15208
|
-
var prevIsFlushing = isFlushingAct;
|
|
15209
|
-
isFlushingAct = true;
|
|
15210
15225
|
|
|
15211
15226
|
try {
|
|
15212
15227
|
return flushMockScheduler();
|
|
15213
15228
|
} finally {
|
|
15214
|
-
isFlushingAct = prevIsFlushing;
|
|
15215
15229
|
}
|
|
15216
15230
|
} else {
|
|
15217
|
-
// No mock scheduler available. However, the only type of pending work is
|
|
15218
|
-
// passive effects, which we control. So we can flush that.
|
|
15219
|
-
var _prevIsFlushing = isFlushingAct;
|
|
15220
|
-
isFlushingAct = true;
|
|
15221
15231
|
|
|
15222
15232
|
try {
|
|
15223
15233
|
var didFlushWork = false;
|
|
@@ -15228,7 +15238,6 @@
|
|
|
15228
15238
|
|
|
15229
15239
|
return didFlushWork;
|
|
15230
15240
|
} finally {
|
|
15231
|
-
isFlushingAct = _prevIsFlushing;
|
|
15232
15241
|
}
|
|
15233
15242
|
}
|
|
15234
15243
|
}
|
|
@@ -15257,16 +15266,13 @@
|
|
|
15257
15266
|
actingUpdatesScopeDepth++;
|
|
15258
15267
|
var previousIsSomeRendererActing = IsSomeRendererActing.current;
|
|
15259
15268
|
var previousIsThisRendererActing = IsThisRendererActing.current;
|
|
15260
|
-
var previousIsInsideThisAct = isInsideThisAct;
|
|
15261
15269
|
IsSomeRendererActing.current = true;
|
|
15262
15270
|
IsThisRendererActing.current = true;
|
|
15263
|
-
isInsideThisAct = true;
|
|
15264
15271
|
|
|
15265
15272
|
function onDone() {
|
|
15266
15273
|
actingUpdatesScopeDepth--;
|
|
15267
15274
|
IsSomeRendererActing.current = previousIsSomeRendererActing;
|
|
15268
15275
|
IsThisRendererActing.current = previousIsThisRendererActing;
|
|
15269
|
-
isInsideThisAct = previousIsInsideThisAct;
|
|
15270
15276
|
|
|
15271
15277
|
{
|
|
15272
15278
|
if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
|
|
@@ -15807,7 +15813,7 @@
|
|
|
15807
15813
|
this.dependencies = null;
|
|
15808
15814
|
this.mode = mode; // Effects
|
|
15809
15815
|
|
|
15810
|
-
this.
|
|
15816
|
+
this.flags = NoFlags;
|
|
15811
15817
|
this.nextEffect = null;
|
|
15812
15818
|
this.firstEffect = null;
|
|
15813
15819
|
this.lastEffect = null;
|
|
@@ -15929,7 +15935,7 @@
|
|
|
15929
15935
|
workInProgress.type = current.type; // We already have an alternate.
|
|
15930
15936
|
// Reset the effect tag.
|
|
15931
15937
|
|
|
15932
|
-
workInProgress.
|
|
15938
|
+
workInProgress.flags = NoFlags; // The effect list is no longer valid.
|
|
15933
15939
|
|
|
15934
15940
|
workInProgress.nextEffect = null;
|
|
15935
15941
|
workInProgress.firstEffect = null;
|
|
@@ -16000,7 +16006,7 @@
|
|
|
16000
16006
|
// avoid doing another reconciliation.
|
|
16001
16007
|
// Reset the effect tag but keep any Placement tags, since that's something
|
|
16002
16008
|
// that child fiber is setting, not the reconciliation.
|
|
16003
|
-
workInProgress.
|
|
16009
|
+
workInProgress.flags &= Placement; // The effect list is no longer valid.
|
|
16004
16010
|
|
|
16005
16011
|
workInProgress.nextEffect = null;
|
|
16006
16012
|
workInProgress.firstEffect = null;
|
|
@@ -16416,8 +16422,7 @@
|
|
|
16416
16422
|
}
|
|
16417
16423
|
}
|
|
16418
16424
|
|
|
16419
|
-
var
|
|
16420
|
-
var lane = requestUpdateLane(current$1, suspenseConfig);
|
|
16425
|
+
var lane = requestUpdateLane(current$1);
|
|
16421
16426
|
|
|
16422
16427
|
var context = getContextForSubtree(parentComponent);
|
|
16423
16428
|
|
|
@@ -16481,29 +16486,96 @@
|
|
|
16481
16486
|
return shouldSuspendImpl(fiber);
|
|
16482
16487
|
}
|
|
16483
16488
|
var overrideHookState = null;
|
|
16489
|
+
var overrideHookStateDeletePath = null;
|
|
16490
|
+
var overrideHookStateRenamePath = null;
|
|
16484
16491
|
var overrideProps = null;
|
|
16492
|
+
var overridePropsDeletePath = null;
|
|
16493
|
+
var overridePropsRenamePath = null;
|
|
16485
16494
|
var scheduleUpdate = null;
|
|
16486
16495
|
var setSuspenseHandler = null;
|
|
16487
16496
|
|
|
16488
16497
|
{
|
|
16489
|
-
var
|
|
16490
|
-
|
|
16498
|
+
var copyWithDeleteImpl = function (obj, path, index) {
|
|
16499
|
+
var key = path[index];
|
|
16500
|
+
var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
|
|
16501
|
+
|
|
16502
|
+
if (index + 1 === path.length) {
|
|
16503
|
+
if (Array.isArray(updated)) {
|
|
16504
|
+
updated.splice(key, 1);
|
|
16505
|
+
} else {
|
|
16506
|
+
delete updated[key];
|
|
16507
|
+
}
|
|
16508
|
+
|
|
16509
|
+
return updated;
|
|
16510
|
+
} // $FlowFixMe number or string is fine here
|
|
16511
|
+
|
|
16512
|
+
|
|
16513
|
+
updated[key] = copyWithDeleteImpl(obj[key], path, index + 1);
|
|
16514
|
+
return updated;
|
|
16515
|
+
};
|
|
16516
|
+
|
|
16517
|
+
var copyWithDelete = function (obj, path) {
|
|
16518
|
+
return copyWithDeleteImpl(obj, path, 0);
|
|
16519
|
+
};
|
|
16520
|
+
|
|
16521
|
+
var copyWithRenameImpl = function (obj, oldPath, newPath, index) {
|
|
16522
|
+
var oldKey = oldPath[index];
|
|
16523
|
+
var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
|
|
16524
|
+
|
|
16525
|
+
if (index + 1 === oldPath.length) {
|
|
16526
|
+
var newKey = newPath[index]; // $FlowFixMe number or string is fine here
|
|
16527
|
+
|
|
16528
|
+
updated[newKey] = updated[oldKey];
|
|
16529
|
+
|
|
16530
|
+
if (Array.isArray(updated)) {
|
|
16531
|
+
updated.splice(oldKey, 1);
|
|
16532
|
+
} else {
|
|
16533
|
+
delete updated[oldKey];
|
|
16534
|
+
}
|
|
16535
|
+
} else {
|
|
16536
|
+
// $FlowFixMe number or string is fine here
|
|
16537
|
+
updated[oldKey] = copyWithRenameImpl( // $FlowFixMe number or string is fine here
|
|
16538
|
+
obj[oldKey], oldPath, newPath, index + 1);
|
|
16539
|
+
}
|
|
16540
|
+
|
|
16541
|
+
return updated;
|
|
16542
|
+
};
|
|
16543
|
+
|
|
16544
|
+
var copyWithRename = function (obj, oldPath, newPath) {
|
|
16545
|
+
if (oldPath.length !== newPath.length) {
|
|
16546
|
+
warn('copyWithRename() expects paths of the same length');
|
|
16547
|
+
|
|
16548
|
+
return;
|
|
16549
|
+
} else {
|
|
16550
|
+
for (var i = 0; i < newPath.length - 1; i++) {
|
|
16551
|
+
if (oldPath[i] !== newPath[i]) {
|
|
16552
|
+
warn('copyWithRename() expects paths to be the same except for the deepest key');
|
|
16553
|
+
|
|
16554
|
+
return;
|
|
16555
|
+
}
|
|
16556
|
+
}
|
|
16557
|
+
}
|
|
16558
|
+
|
|
16559
|
+
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
16560
|
+
};
|
|
16561
|
+
|
|
16562
|
+
var copyWithSetImpl = function (obj, path, index, value) {
|
|
16563
|
+
if (index >= path.length) {
|
|
16491
16564
|
return value;
|
|
16492
16565
|
}
|
|
16493
16566
|
|
|
16494
|
-
var key = path[
|
|
16567
|
+
var key = path[index];
|
|
16495
16568
|
var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); // $FlowFixMe number or string is fine here
|
|
16496
16569
|
|
|
16497
|
-
updated[key] = copyWithSetImpl(obj[key], path,
|
|
16570
|
+
updated[key] = copyWithSetImpl(obj[key], path, index + 1, value);
|
|
16498
16571
|
return updated;
|
|
16499
16572
|
};
|
|
16500
16573
|
|
|
16501
16574
|
var copyWithSet = function (obj, path, value) {
|
|
16502
16575
|
return copyWithSetImpl(obj, path, 0, value);
|
|
16503
|
-
};
|
|
16504
|
-
|
|
16576
|
+
};
|
|
16505
16577
|
|
|
16506
|
-
|
|
16578
|
+
var findHook = function (fiber, id) {
|
|
16507
16579
|
// For now, the "id" of stateful hooks is just the stateful hook index.
|
|
16508
16580
|
// This may change in the future with e.g. nested hooks.
|
|
16509
16581
|
var currentHook = fiber.memoizedState;
|
|
@@ -16513,10 +16585,51 @@
|
|
|
16513
16585
|
id--;
|
|
16514
16586
|
}
|
|
16515
16587
|
|
|
16516
|
-
|
|
16517
|
-
|
|
16518
|
-
|
|
16519
|
-
|
|
16588
|
+
return currentHook;
|
|
16589
|
+
}; // Support DevTools editable values for useState and useReducer.
|
|
16590
|
+
|
|
16591
|
+
|
|
16592
|
+
overrideHookState = function (fiber, id, path, value) {
|
|
16593
|
+
var hook = findHook(fiber, id);
|
|
16594
|
+
|
|
16595
|
+
if (hook !== null) {
|
|
16596
|
+
var newState = copyWithSet(hook.memoizedState, path, value);
|
|
16597
|
+
hook.memoizedState = newState;
|
|
16598
|
+
hook.baseState = newState; // We aren't actually adding an update to the queue,
|
|
16599
|
+
// because there is no update we can add for useReducer hooks that won't trigger an error.
|
|
16600
|
+
// (There's no appropriate action type for DevTools overrides.)
|
|
16601
|
+
// As a result though, React will see the scheduled update as a noop and bailout.
|
|
16602
|
+
// Shallow cloning props works as a workaround for now to bypass the bailout check.
|
|
16603
|
+
|
|
16604
|
+
fiber.memoizedProps = _assign({}, fiber.memoizedProps);
|
|
16605
|
+
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
16606
|
+
}
|
|
16607
|
+
};
|
|
16608
|
+
|
|
16609
|
+
overrideHookStateDeletePath = function (fiber, id, path) {
|
|
16610
|
+
var hook = findHook(fiber, id);
|
|
16611
|
+
|
|
16612
|
+
if (hook !== null) {
|
|
16613
|
+
var newState = copyWithDelete(hook.memoizedState, path);
|
|
16614
|
+
hook.memoizedState = newState;
|
|
16615
|
+
hook.baseState = newState; // We aren't actually adding an update to the queue,
|
|
16616
|
+
// because there is no update we can add for useReducer hooks that won't trigger an error.
|
|
16617
|
+
// (There's no appropriate action type for DevTools overrides.)
|
|
16618
|
+
// As a result though, React will see the scheduled update as a noop and bailout.
|
|
16619
|
+
// Shallow cloning props works as a workaround for now to bypass the bailout check.
|
|
16620
|
+
|
|
16621
|
+
fiber.memoizedProps = _assign({}, fiber.memoizedProps);
|
|
16622
|
+
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
16623
|
+
}
|
|
16624
|
+
};
|
|
16625
|
+
|
|
16626
|
+
overrideHookStateRenamePath = function (fiber, id, oldPath, newPath) {
|
|
16627
|
+
var hook = findHook(fiber, id);
|
|
16628
|
+
|
|
16629
|
+
if (hook !== null) {
|
|
16630
|
+
var newState = copyWithRename(hook.memoizedState, oldPath, newPath);
|
|
16631
|
+
hook.memoizedState = newState;
|
|
16632
|
+
hook.baseState = newState; // We aren't actually adding an update to the queue,
|
|
16520
16633
|
// because there is no update we can add for useReducer hooks that won't trigger an error.
|
|
16521
16634
|
// (There's no appropriate action type for DevTools overrides.)
|
|
16522
16635
|
// As a result though, React will see the scheduled update as a noop and bailout.
|
|
@@ -16538,6 +16651,26 @@
|
|
|
16538
16651
|
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
16539
16652
|
};
|
|
16540
16653
|
|
|
16654
|
+
overridePropsDeletePath = function (fiber, path) {
|
|
16655
|
+
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path);
|
|
16656
|
+
|
|
16657
|
+
if (fiber.alternate) {
|
|
16658
|
+
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
16659
|
+
}
|
|
16660
|
+
|
|
16661
|
+
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
16662
|
+
};
|
|
16663
|
+
|
|
16664
|
+
overridePropsRenamePath = function (fiber, oldPath, newPath) {
|
|
16665
|
+
fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
|
|
16666
|
+
|
|
16667
|
+
if (fiber.alternate) {
|
|
16668
|
+
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
16669
|
+
}
|
|
16670
|
+
|
|
16671
|
+
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
16672
|
+
};
|
|
16673
|
+
|
|
16541
16674
|
scheduleUpdate = function (fiber) {
|
|
16542
16675
|
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
16543
16676
|
};
|
|
@@ -16574,7 +16707,11 @@
|
|
|
16574
16707
|
rendererPackageName: devToolsConfig.rendererPackageName,
|
|
16575
16708
|
rendererConfig: devToolsConfig.rendererConfig,
|
|
16576
16709
|
overrideHookState: overrideHookState,
|
|
16710
|
+
overrideHookStateDeletePath: overrideHookStateDeletePath,
|
|
16711
|
+
overrideHookStateRenamePath: overrideHookStateRenamePath,
|
|
16577
16712
|
overrideProps: overrideProps,
|
|
16713
|
+
overridePropsDeletePath: overridePropsDeletePath,
|
|
16714
|
+
overridePropsRenamePath: overridePropsRenamePath,
|
|
16578
16715
|
setSuspenseHandler: setSuspenseHandler,
|
|
16579
16716
|
scheduleUpdate: scheduleUpdate,
|
|
16580
16717
|
currentDispatcherRef: ReactCurrentDispatcher,
|
|
@@ -16590,6 +16727,7 @@
|
|
|
16590
16727
|
});
|
|
16591
16728
|
}
|
|
16592
16729
|
|
|
16730
|
+
var IsSomeRendererActing$1 = ReactSharedInternals.IsSomeRendererActing;
|
|
16593
16731
|
var defaultTestOptions = {
|
|
16594
16732
|
createNodeMock: function () {
|
|
16595
16733
|
return null;
|
|
@@ -17144,10 +17282,110 @@
|
|
|
17144
17282
|
version: ReactVersion,
|
|
17145
17283
|
rendererPackageName: 'react-test-renderer'
|
|
17146
17284
|
});
|
|
17285
|
+
var actingUpdatesScopeDepth$1 = 0; // This version of `act` is only used by our tests. Unlike the public version
|
|
17286
|
+
// of `act`, it's designed to work identically in both production and
|
|
17287
|
+
// development. It may have slightly different behavior from the public
|
|
17288
|
+
// version, too, since our constraints in our test suite are not the same as
|
|
17289
|
+
// those of developers using React — we're testing React itself, as opposed to
|
|
17290
|
+
// building an app with React.
|
|
17291
|
+
// TODO: Migrate our tests to use ReactNoop. Although we would need to figure
|
|
17292
|
+
// out a solution for Relay, which has some Concurrent Mode tests.
|
|
17293
|
+
|
|
17294
|
+
function unstable_concurrentAct(scope) {
|
|
17295
|
+
if (Scheduler.unstable_flushAllWithoutAsserting === undefined) {
|
|
17296
|
+
throw Error('This version of `act` requires a special mock build of Scheduler.');
|
|
17297
|
+
}
|
|
17298
|
+
|
|
17299
|
+
if (setTimeout._isMockFunction !== true) {
|
|
17300
|
+
throw Error("This version of `act` requires Jest's timer mocks " + '(i.e. jest.useFakeTimers).');
|
|
17301
|
+
}
|
|
17302
|
+
|
|
17303
|
+
var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth$1;
|
|
17304
|
+
var previousIsSomeRendererActing = IsSomeRendererActing$1.current;
|
|
17305
|
+
var previousIsThisRendererActing = IsThisRendererActing.current;
|
|
17306
|
+
IsSomeRendererActing$1.current = true;
|
|
17307
|
+
IsThisRendererActing.current = true;
|
|
17308
|
+
actingUpdatesScopeDepth$1++;
|
|
17309
|
+
|
|
17310
|
+
var unwind = function () {
|
|
17311
|
+
actingUpdatesScopeDepth$1--;
|
|
17312
|
+
IsSomeRendererActing$1.current = previousIsSomeRendererActing;
|
|
17313
|
+
IsThisRendererActing.current = previousIsThisRendererActing;
|
|
17314
|
+
|
|
17315
|
+
{
|
|
17316
|
+
if (actingUpdatesScopeDepth$1 > previousActingUpdatesScopeDepth) {
|
|
17317
|
+
// if it's _less than_ previousActingUpdatesScopeDepth, then we can
|
|
17318
|
+
// assume the 'other' one has warned
|
|
17319
|
+
error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
|
17320
|
+
}
|
|
17321
|
+
}
|
|
17322
|
+
}; // TODO: This would be way simpler if 1) we required a promise to be
|
|
17323
|
+
// returned and 2) we could use async/await. Since it's only our used in
|
|
17324
|
+
// our test suite, we should be able to.
|
|
17325
|
+
|
|
17326
|
+
|
|
17327
|
+
try {
|
|
17328
|
+
var thenable = batchedUpdates(scope);
|
|
17329
|
+
|
|
17330
|
+
if (typeof thenable === 'object' && thenable !== null && typeof thenable.then === 'function') {
|
|
17331
|
+
return {
|
|
17332
|
+
then: function (resolve, reject) {
|
|
17333
|
+
thenable.then(function () {
|
|
17334
|
+
flushActWork$1(function () {
|
|
17335
|
+
unwind();
|
|
17336
|
+
resolve();
|
|
17337
|
+
}, function (error) {
|
|
17338
|
+
unwind();
|
|
17339
|
+
reject(error);
|
|
17340
|
+
});
|
|
17341
|
+
}, function (error) {
|
|
17342
|
+
unwind();
|
|
17343
|
+
reject(error);
|
|
17344
|
+
});
|
|
17345
|
+
}
|
|
17346
|
+
};
|
|
17347
|
+
} else {
|
|
17348
|
+
try {
|
|
17349
|
+
// TODO: Let's not support non-async scopes at all in our tests. Need to
|
|
17350
|
+
// migrate existing tests.
|
|
17351
|
+
var didFlushWork;
|
|
17352
|
+
|
|
17353
|
+
do {
|
|
17354
|
+
didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
|
|
17355
|
+
} while (didFlushWork);
|
|
17356
|
+
} finally {
|
|
17357
|
+
unwind();
|
|
17358
|
+
}
|
|
17359
|
+
}
|
|
17360
|
+
} catch (error) {
|
|
17361
|
+
unwind();
|
|
17362
|
+
throw error;
|
|
17363
|
+
}
|
|
17364
|
+
}
|
|
17365
|
+
|
|
17366
|
+
function flushActWork$1(resolve, reject) {
|
|
17367
|
+
// Flush suspended fallbacks
|
|
17368
|
+
// $FlowFixMe: Flow doesn't know about global Jest object
|
|
17369
|
+
jest.runOnlyPendingTimers();
|
|
17370
|
+
enqueueTask(function () {
|
|
17371
|
+
try {
|
|
17372
|
+
var didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
|
|
17373
|
+
|
|
17374
|
+
if (didFlushWork) {
|
|
17375
|
+
flushActWork$1(resolve, reject);
|
|
17376
|
+
} else {
|
|
17377
|
+
resolve();
|
|
17378
|
+
}
|
|
17379
|
+
} catch (error) {
|
|
17380
|
+
reject(error);
|
|
17381
|
+
}
|
|
17382
|
+
});
|
|
17383
|
+
}
|
|
17147
17384
|
|
|
17148
17385
|
exports._Scheduler = Scheduler;
|
|
17149
17386
|
exports.act = act;
|
|
17150
17387
|
exports.create = create;
|
|
17151
17388
|
exports.unstable_batchedUpdates = batchedUpdates;
|
|
17389
|
+
exports.unstable_concurrentAct = unstable_concurrentAct;
|
|
17152
17390
|
|
|
17153
17391
|
})));
|