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.
|
|
@@ -13,43 +13,12 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
13
13
|
(function() {
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
+
var React = require('react');
|
|
16
17
|
var _assign = require('object-assign');
|
|
17
18
|
var Scheduler = require('scheduler/unstable_mock');
|
|
18
|
-
var React = require('react');
|
|
19
19
|
var Scheduler$1 = require('scheduler');
|
|
20
20
|
var tracing = require('scheduler/tracing');
|
|
21
21
|
|
|
22
|
-
function _defineProperties(target, props) {
|
|
23
|
-
for (var i = 0; i < props.length; i++) {
|
|
24
|
-
var descriptor = props[i];
|
|
25
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
26
|
-
descriptor.configurable = true;
|
|
27
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
28
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
33
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
34
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
35
|
-
return Constructor;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
39
|
-
if (source == null) return {};
|
|
40
|
-
var target = {};
|
|
41
|
-
var sourceKeys = Object.keys(source);
|
|
42
|
-
var key, i;
|
|
43
|
-
|
|
44
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
45
|
-
key = sourceKeys[i];
|
|
46
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
47
|
-
target[key] = source[key];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return target;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
22
|
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
54
23
|
|
|
55
24
|
// by calls to these methods by a Babel plugin.
|
|
@@ -100,6 +69,37 @@ function printWarning(level, format, args) {
|
|
|
100
69
|
}
|
|
101
70
|
}
|
|
102
71
|
|
|
72
|
+
function _defineProperties(target, props) {
|
|
73
|
+
for (var i = 0; i < props.length; i++) {
|
|
74
|
+
var descriptor = props[i];
|
|
75
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
76
|
+
descriptor.configurable = true;
|
|
77
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
78
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
83
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
84
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
85
|
+
return Constructor;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
89
|
+
if (source == null) return {};
|
|
90
|
+
var target = {};
|
|
91
|
+
var sourceKeys = Object.keys(source);
|
|
92
|
+
var key, i;
|
|
93
|
+
|
|
94
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
95
|
+
key = sourceKeys[i];
|
|
96
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
97
|
+
target[key] = source[key];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return target;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
103
|
var FunctionComponent = 0;
|
|
104
104
|
var ClassComponent = 1;
|
|
105
105
|
var IndeterminateComponent = 2; // Before we know whether it is function or class
|
|
@@ -248,7 +248,7 @@ function getComponentName(type) {
|
|
|
248
248
|
return 'Portal';
|
|
249
249
|
|
|
250
250
|
case REACT_PROFILER_TYPE:
|
|
251
|
-
return
|
|
251
|
+
return 'Profiler';
|
|
252
252
|
|
|
253
253
|
case REACT_STRICT_MODE_TYPE:
|
|
254
254
|
return 'StrictMode';
|
|
@@ -298,8 +298,8 @@ function getComponentName(type) {
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
// Don't change these two values. They're used by React Dev Tools.
|
|
301
|
-
var
|
|
302
|
-
/*
|
|
301
|
+
var NoFlags =
|
|
302
|
+
/* */
|
|
303
303
|
0;
|
|
304
304
|
var PerformedWork =
|
|
305
305
|
/* */
|
|
@@ -382,7 +382,7 @@ function getNearestMountedFiber(fiber) {
|
|
|
382
382
|
do {
|
|
383
383
|
node = nextNode;
|
|
384
384
|
|
|
385
|
-
if ((node.
|
|
385
|
+
if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
386
386
|
// This is an insertion or in-progress hydration. The nearest possible
|
|
387
387
|
// mounted fiber is the parent but we need to continue to figure out
|
|
388
388
|
// if that one is still mounted.
|
|
@@ -1596,7 +1596,7 @@ function onScheduleRoot(root, children) {
|
|
|
1596
1596
|
function onCommitRoot(root, priorityLevel) {
|
|
1597
1597
|
if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') {
|
|
1598
1598
|
try {
|
|
1599
|
-
var didError = (root.current.
|
|
1599
|
+
var didError = (root.current.flags & DidCapture) === DidCapture;
|
|
1600
1600
|
|
|
1601
1601
|
if (enableProfilerTimer) {
|
|
1602
1602
|
injectedHook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
|
@@ -2024,7 +2024,21 @@ function computeExpirationTime(lane, currentTime) {
|
|
|
2024
2024
|
|
|
2025
2025
|
if (priority >= InputContinuousLanePriority) {
|
|
2026
2026
|
// User interactions should expire slightly more quickly.
|
|
2027
|
-
|
|
2027
|
+
//
|
|
2028
|
+
// NOTE: This is set to the corresponding constant as in Scheduler.js. When
|
|
2029
|
+
// we made it larger, a product metric in www regressed, suggesting there's
|
|
2030
|
+
// a user interaction that's being starved by a series of synchronous
|
|
2031
|
+
// updates. If that theory is correct, the proper solution is to fix the
|
|
2032
|
+
// starvation. However, this scenario supports the idea that expiration
|
|
2033
|
+
// times are an important safeguard when starvation does happen.
|
|
2034
|
+
//
|
|
2035
|
+
// Also note that, in the case of user input specifically, this will soon no
|
|
2036
|
+
// longer be an issue because we plan to make user input synchronous by
|
|
2037
|
+
// default (until you enter `startTransition`, of course.)
|
|
2038
|
+
//
|
|
2039
|
+
// If weren't planning to make these updates synchronous soon anyway, I
|
|
2040
|
+
// would probably make this number a configurable parameter.
|
|
2041
|
+
return currentTime + 250;
|
|
2028
2042
|
} else if (priority >= TransitionPriority) {
|
|
2029
2043
|
return currentTime + 5000;
|
|
2030
2044
|
} else {
|
|
@@ -2255,7 +2269,15 @@ function laneToLanes(lane) {
|
|
|
2255
2269
|
return lane;
|
|
2256
2270
|
}
|
|
2257
2271
|
function createLaneMap(initial) {
|
|
2258
|
-
|
|
2272
|
+
// Intentionally pushing one by one.
|
|
2273
|
+
// https://v8.dev/blog/elements-kinds#avoid-creating-holes
|
|
2274
|
+
var laneMap = [];
|
|
2275
|
+
|
|
2276
|
+
for (var i = 0; i < TotalLanes; i++) {
|
|
2277
|
+
laneMap.push(initial);
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
return laneMap;
|
|
2259
2281
|
}
|
|
2260
2282
|
function markRootUpdated(root, updateLane, eventTime) {
|
|
2261
2283
|
root.pendingLanes |= updateLane; // TODO: Theoretically, any update to any lane can unblock any other lane. But
|
|
@@ -2534,7 +2556,7 @@ function flushSyncCallbackQueueImpl() {
|
|
|
2534
2556
|
}
|
|
2535
2557
|
|
|
2536
2558
|
// TODO: this is special because it gets imported during build.
|
|
2537
|
-
var ReactVersion = '17.0.
|
|
2559
|
+
var ReactVersion = '17.0.1';
|
|
2538
2560
|
|
|
2539
2561
|
var NoMode = 0;
|
|
2540
2562
|
var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root
|
|
@@ -2545,6 +2567,12 @@ var ConcurrentMode = 4;
|
|
|
2545
2567
|
var ProfileMode = 8;
|
|
2546
2568
|
var DebugTracingMode = 16;
|
|
2547
2569
|
|
|
2570
|
+
var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
2571
|
+
var NoTransition = 0;
|
|
2572
|
+
function requestCurrentTransition() {
|
|
2573
|
+
return ReactCurrentBatchConfig.transition;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2548
2576
|
/**
|
|
2549
2577
|
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
2550
2578
|
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
@@ -3409,7 +3437,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
|
|
|
3409
3437
|
|
|
3410
3438
|
case CaptureUpdate:
|
|
3411
3439
|
{
|
|
3412
|
-
workInProgress.
|
|
3440
|
+
workInProgress.flags = workInProgress.flags & ~ShouldCapture | DidCapture;
|
|
3413
3441
|
}
|
|
3414
3442
|
// Intentional fallthrough
|
|
3415
3443
|
|
|
@@ -3567,7 +3595,7 @@ function processUpdateQueue(workInProgress, props, instance, renderLanes) {
|
|
|
3567
3595
|
var callback = update.callback;
|
|
3568
3596
|
|
|
3569
3597
|
if (callback !== null) {
|
|
3570
|
-
workInProgress.
|
|
3598
|
+
workInProgress.flags |= Callback;
|
|
3571
3599
|
var effects = queue.effects;
|
|
3572
3600
|
|
|
3573
3601
|
if (effects === null) {
|
|
@@ -3658,11 +3686,6 @@ function commitUpdateQueue(finishedWork, finishedQueue, instance) {
|
|
|
3658
3686
|
}
|
|
3659
3687
|
}
|
|
3660
3688
|
|
|
3661
|
-
var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
3662
|
-
function requestCurrentSuspenseConfig() {
|
|
3663
|
-
return ReactCurrentBatchConfig.suspense;
|
|
3664
|
-
}
|
|
3665
|
-
|
|
3666
3689
|
var fakeInternalInstance = {};
|
|
3667
3690
|
var isArray = Array.isArray; // React.Component uses a shared frozen object by default.
|
|
3668
3691
|
// We'll use it to determine whether we need to initialize legacy refs.
|
|
@@ -3759,8 +3782,7 @@ var classComponentUpdater = {
|
|
|
3759
3782
|
enqueueSetState: function (inst, payload, callback) {
|
|
3760
3783
|
var fiber = get(inst);
|
|
3761
3784
|
var eventTime = requestEventTime();
|
|
3762
|
-
var
|
|
3763
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
3785
|
+
var lane = requestUpdateLane(fiber);
|
|
3764
3786
|
var update = createUpdate(eventTime, lane);
|
|
3765
3787
|
update.payload = payload;
|
|
3766
3788
|
|
|
@@ -3778,8 +3800,7 @@ var classComponentUpdater = {
|
|
|
3778
3800
|
enqueueReplaceState: function (inst, payload, callback) {
|
|
3779
3801
|
var fiber = get(inst);
|
|
3780
3802
|
var eventTime = requestEventTime();
|
|
3781
|
-
var
|
|
3782
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
3803
|
+
var lane = requestUpdateLane(fiber);
|
|
3783
3804
|
var update = createUpdate(eventTime, lane);
|
|
3784
3805
|
update.tag = ReplaceState;
|
|
3785
3806
|
update.payload = payload;
|
|
@@ -3798,8 +3819,7 @@ var classComponentUpdater = {
|
|
|
3798
3819
|
enqueueForceUpdate: function (inst, callback) {
|
|
3799
3820
|
var fiber = get(inst);
|
|
3800
3821
|
var eventTime = requestEventTime();
|
|
3801
|
-
var
|
|
3802
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
3822
|
+
var lane = requestUpdateLane(fiber);
|
|
3803
3823
|
var update = createUpdate(eventTime, lane);
|
|
3804
3824
|
update.tag = ForceUpdate;
|
|
3805
3825
|
|
|
@@ -4169,7 +4189,7 @@ function mountClassInstance(workInProgress, ctor, newProps, renderLanes) {
|
|
|
4169
4189
|
}
|
|
4170
4190
|
|
|
4171
4191
|
if (typeof instance.componentDidMount === 'function') {
|
|
4172
|
-
workInProgress.
|
|
4192
|
+
workInProgress.flags |= Update;
|
|
4173
4193
|
}
|
|
4174
4194
|
}
|
|
4175
4195
|
|
|
@@ -4211,7 +4231,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) {
|
|
|
4211
4231
|
// If an update was already in progress, we should schedule an Update
|
|
4212
4232
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
4213
4233
|
if (typeof instance.componentDidMount === 'function') {
|
|
4214
|
-
workInProgress.
|
|
4234
|
+
workInProgress.flags |= Update;
|
|
4215
4235
|
}
|
|
4216
4236
|
|
|
4217
4237
|
return false;
|
|
@@ -4238,13 +4258,13 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) {
|
|
|
4238
4258
|
}
|
|
4239
4259
|
|
|
4240
4260
|
if (typeof instance.componentDidMount === 'function') {
|
|
4241
|
-
workInProgress.
|
|
4261
|
+
workInProgress.flags |= Update;
|
|
4242
4262
|
}
|
|
4243
4263
|
} else {
|
|
4244
4264
|
// If an update was already in progress, we should schedule an Update
|
|
4245
4265
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
4246
4266
|
if (typeof instance.componentDidMount === 'function') {
|
|
4247
|
-
workInProgress.
|
|
4267
|
+
workInProgress.flags |= Update;
|
|
4248
4268
|
} // If shouldComponentUpdate returned false, we should still update the
|
|
4249
4269
|
// memoized state to indicate that this work can be reused.
|
|
4250
4270
|
|
|
@@ -4304,13 +4324,13 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderLane
|
|
|
4304
4324
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
4305
4325
|
if (typeof instance.componentDidUpdate === 'function') {
|
|
4306
4326
|
if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
4307
|
-
workInProgress.
|
|
4327
|
+
workInProgress.flags |= Update;
|
|
4308
4328
|
}
|
|
4309
4329
|
}
|
|
4310
4330
|
|
|
4311
4331
|
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
4312
4332
|
if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
4313
|
-
workInProgress.
|
|
4333
|
+
workInProgress.flags |= Snapshot;
|
|
4314
4334
|
}
|
|
4315
4335
|
}
|
|
4316
4336
|
|
|
@@ -4338,24 +4358,24 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderLane
|
|
|
4338
4358
|
}
|
|
4339
4359
|
|
|
4340
4360
|
if (typeof instance.componentDidUpdate === 'function') {
|
|
4341
|
-
workInProgress.
|
|
4361
|
+
workInProgress.flags |= Update;
|
|
4342
4362
|
}
|
|
4343
4363
|
|
|
4344
4364
|
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
4345
|
-
workInProgress.
|
|
4365
|
+
workInProgress.flags |= Snapshot;
|
|
4346
4366
|
}
|
|
4347
4367
|
} else {
|
|
4348
4368
|
// If an update was already in progress, we should schedule an Update
|
|
4349
4369
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
4350
4370
|
if (typeof instance.componentDidUpdate === 'function') {
|
|
4351
4371
|
if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
4352
|
-
workInProgress.
|
|
4372
|
+
workInProgress.flags |= Update;
|
|
4353
4373
|
}
|
|
4354
4374
|
}
|
|
4355
4375
|
|
|
4356
4376
|
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
4357
4377
|
if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
4358
|
-
workInProgress.
|
|
4378
|
+
workInProgress.flags |= Snapshot;
|
|
4359
4379
|
}
|
|
4360
4380
|
} // If shouldComponentUpdate returned false, we should still update the
|
|
4361
4381
|
// memoized props/state to indicate that this work can be reused.
|
|
@@ -4560,7 +4580,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
4560
4580
|
}
|
|
4561
4581
|
|
|
4562
4582
|
childToDelete.nextEffect = null;
|
|
4563
|
-
childToDelete.
|
|
4583
|
+
childToDelete.flags = Deletion;
|
|
4564
4584
|
}
|
|
4565
4585
|
|
|
4566
4586
|
function deleteRemainingChildren(returnFiber, currentFirstChild) {
|
|
@@ -4625,7 +4645,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
4625
4645
|
|
|
4626
4646
|
if (oldIndex < lastPlacedIndex) {
|
|
4627
4647
|
// This is a move.
|
|
4628
|
-
newFiber.
|
|
4648
|
+
newFiber.flags = Placement;
|
|
4629
4649
|
return lastPlacedIndex;
|
|
4630
4650
|
} else {
|
|
4631
4651
|
// This item can stay in place.
|
|
@@ -4633,7 +4653,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
4633
4653
|
}
|
|
4634
4654
|
} else {
|
|
4635
4655
|
// This is an insertion.
|
|
4636
|
-
newFiber.
|
|
4656
|
+
newFiber.flags = Placement;
|
|
4637
4657
|
return lastPlacedIndex;
|
|
4638
4658
|
}
|
|
4639
4659
|
}
|
|
@@ -4642,7 +4662,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
4642
4662
|
// This is simpler for the single child case. We only need to do a
|
|
4643
4663
|
// placement for inserting new children.
|
|
4644
4664
|
if (shouldTrackSideEffects && newFiber.alternate === null) {
|
|
4645
|
-
newFiber.
|
|
4665
|
+
newFiber.flags = Placement;
|
|
4646
4666
|
}
|
|
4647
4667
|
|
|
4648
4668
|
return newFiber;
|
|
@@ -5616,13 +5636,6 @@ function popSuspenseContext(fiber) {
|
|
|
5616
5636
|
pop(suspenseStackCursor, fiber);
|
|
5617
5637
|
}
|
|
5618
5638
|
|
|
5619
|
-
// A non-null SuspenseState means that it is blocked for one reason or another.
|
|
5620
|
-
// - A non-null dehydrated field means it's blocked pending hydration.
|
|
5621
|
-
// - A non-null dehydrated field can use isSuspenseInstancePending or
|
|
5622
|
-
// isSuspenseInstanceFallback to query the reason for being dehydrated.
|
|
5623
|
-
// - A null dehydrated field means it's blocked by something suspending and
|
|
5624
|
-
// we're currently showing a fallback instead.
|
|
5625
|
-
|
|
5626
5639
|
function shouldCaptureSuspense(workInProgress, hasInvisibleParent) {
|
|
5627
5640
|
// If it was the primary children that just suspended, capture and render the
|
|
5628
5641
|
// fallback. Otherwise, don't capture and bubble to the next boundary.
|
|
@@ -5674,7 +5687,7 @@ function findFirstSuspended(row) {
|
|
|
5674
5687
|
} else if (node.tag === SuspenseListComponent && // revealOrder undefined can't be trusted because it don't
|
|
5675
5688
|
// keep track of whether it suspended or not.
|
|
5676
5689
|
node.memoizedProps.revealOrder !== undefined) {
|
|
5677
|
-
var didSuspend = (node.
|
|
5690
|
+
var didSuspend = (node.flags & DidCapture) !== NoFlags;
|
|
5678
5691
|
|
|
5679
5692
|
if (didSuspend) {
|
|
5680
5693
|
return node;
|
|
@@ -5704,7 +5717,7 @@ function findFirstSuspended(row) {
|
|
|
5704
5717
|
return null;
|
|
5705
5718
|
}
|
|
5706
5719
|
|
|
5707
|
-
var
|
|
5720
|
+
var NoFlags$1 =
|
|
5708
5721
|
/* */
|
|
5709
5722
|
0; // Represents whether effect should fire.
|
|
5710
5723
|
|
|
@@ -6073,7 +6086,7 @@ function renderWithHooks(current, workInProgress, Component, props, secondArg, n
|
|
|
6073
6086
|
}
|
|
6074
6087
|
function bailoutHooks(current, workInProgress, lanes) {
|
|
6075
6088
|
workInProgress.updateQueue = current.updateQueue;
|
|
6076
|
-
workInProgress.
|
|
6089
|
+
workInProgress.flags &= ~(Passive | Update);
|
|
6077
6090
|
current.lanes = removeLanes(current.lanes, lanes);
|
|
6078
6091
|
}
|
|
6079
6092
|
function resetHooksAfterThrow() {
|
|
@@ -6544,8 +6557,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) {
|
|
|
6544
6557
|
|
|
6545
6558
|
if (!objectIs(snapshot, maybeNewSnapshot)) {
|
|
6546
6559
|
setSnapshot(maybeNewSnapshot);
|
|
6547
|
-
var
|
|
6548
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
6560
|
+
var lane = requestUpdateLane(fiber);
|
|
6549
6561
|
markRootMutableRead(root, lane);
|
|
6550
6562
|
} // If the source mutated between render and now,
|
|
6551
6563
|
// there may be state updates already scheduled from the old source.
|
|
@@ -6564,8 +6576,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) {
|
|
|
6564
6576
|
try {
|
|
6565
6577
|
latestSetSnapshot(latestGetSnapshot(source._source)); // Record a pending mutable source update with the same expiration time.
|
|
6566
6578
|
|
|
6567
|
-
var
|
|
6568
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
6579
|
+
var lane = requestUpdateLane(fiber);
|
|
6569
6580
|
markRootMutableRead(root, lane);
|
|
6570
6581
|
} catch (error) {
|
|
6571
6582
|
// A selector might throw after a source mutation.
|
|
@@ -6715,14 +6726,14 @@ function updateRef(initialValue) {
|
|
|
6715
6726
|
return hook.memoizedState;
|
|
6716
6727
|
}
|
|
6717
6728
|
|
|
6718
|
-
function mountEffectImpl(
|
|
6729
|
+
function mountEffectImpl(fiberFlags, hookFlags, create, deps) {
|
|
6719
6730
|
var hook = mountWorkInProgressHook();
|
|
6720
6731
|
var nextDeps = deps === undefined ? null : deps;
|
|
6721
|
-
currentlyRenderingFiber$1.
|
|
6722
|
-
hook.memoizedState = pushEffect(HasEffect |
|
|
6732
|
+
currentlyRenderingFiber$1.flags |= fiberFlags;
|
|
6733
|
+
hook.memoizedState = pushEffect(HasEffect | hookFlags, create, undefined, nextDeps);
|
|
6723
6734
|
}
|
|
6724
6735
|
|
|
6725
|
-
function updateEffectImpl(
|
|
6736
|
+
function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
|
6726
6737
|
var hook = updateWorkInProgressHook();
|
|
6727
6738
|
var nextDeps = deps === undefined ? null : deps;
|
|
6728
6739
|
var destroy = undefined;
|
|
@@ -6735,14 +6746,14 @@ function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
|
|
|
6735
6746
|
var prevDeps = prevEffect.deps;
|
|
6736
6747
|
|
|
6737
6748
|
if (areHookInputsEqual(nextDeps, prevDeps)) {
|
|
6738
|
-
pushEffect(
|
|
6749
|
+
pushEffect(hookFlags, create, destroy, nextDeps);
|
|
6739
6750
|
return;
|
|
6740
6751
|
}
|
|
6741
6752
|
}
|
|
6742
6753
|
}
|
|
6743
6754
|
|
|
6744
|
-
currentlyRenderingFiber$1.
|
|
6745
|
-
hook.memoizedState = pushEffect(HasEffect |
|
|
6755
|
+
currentlyRenderingFiber$1.flags |= fiberFlags;
|
|
6756
|
+
hook.memoizedState = pushEffect(HasEffect | hookFlags, create, destroy, nextDeps);
|
|
6746
6757
|
}
|
|
6747
6758
|
|
|
6748
6759
|
function mountEffect(create, deps) {
|
|
@@ -6889,61 +6900,61 @@ function updateMemo(nextCreate, deps) {
|
|
|
6889
6900
|
return nextValue;
|
|
6890
6901
|
}
|
|
6891
6902
|
|
|
6892
|
-
function mountDeferredValue(value
|
|
6903
|
+
function mountDeferredValue(value) {
|
|
6893
6904
|
var _mountState = mountState(value),
|
|
6894
6905
|
prevValue = _mountState[0],
|
|
6895
6906
|
setValue = _mountState[1];
|
|
6896
6907
|
|
|
6897
6908
|
mountEffect(function () {
|
|
6898
|
-
var
|
|
6899
|
-
ReactCurrentBatchConfig$1.
|
|
6909
|
+
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
6910
|
+
ReactCurrentBatchConfig$1.transition = 1;
|
|
6900
6911
|
|
|
6901
6912
|
try {
|
|
6902
6913
|
setValue(value);
|
|
6903
6914
|
} finally {
|
|
6904
|
-
ReactCurrentBatchConfig$1.
|
|
6915
|
+
ReactCurrentBatchConfig$1.transition = prevTransition;
|
|
6905
6916
|
}
|
|
6906
|
-
}, [value
|
|
6917
|
+
}, [value]);
|
|
6907
6918
|
return prevValue;
|
|
6908
6919
|
}
|
|
6909
6920
|
|
|
6910
|
-
function updateDeferredValue(value
|
|
6921
|
+
function updateDeferredValue(value) {
|
|
6911
6922
|
var _updateState = updateState(),
|
|
6912
6923
|
prevValue = _updateState[0],
|
|
6913
6924
|
setValue = _updateState[1];
|
|
6914
6925
|
|
|
6915
6926
|
updateEffect(function () {
|
|
6916
|
-
var
|
|
6917
|
-
ReactCurrentBatchConfig$1.
|
|
6927
|
+
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
6928
|
+
ReactCurrentBatchConfig$1.transition = 1;
|
|
6918
6929
|
|
|
6919
6930
|
try {
|
|
6920
6931
|
setValue(value);
|
|
6921
6932
|
} finally {
|
|
6922
|
-
ReactCurrentBatchConfig$1.
|
|
6933
|
+
ReactCurrentBatchConfig$1.transition = prevTransition;
|
|
6923
6934
|
}
|
|
6924
|
-
}, [value
|
|
6935
|
+
}, [value]);
|
|
6925
6936
|
return prevValue;
|
|
6926
6937
|
}
|
|
6927
6938
|
|
|
6928
|
-
function rerenderDeferredValue(value
|
|
6939
|
+
function rerenderDeferredValue(value) {
|
|
6929
6940
|
var _rerenderState = rerenderState(),
|
|
6930
6941
|
prevValue = _rerenderState[0],
|
|
6931
6942
|
setValue = _rerenderState[1];
|
|
6932
6943
|
|
|
6933
6944
|
updateEffect(function () {
|
|
6934
|
-
var
|
|
6935
|
-
ReactCurrentBatchConfig$1.
|
|
6945
|
+
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
6946
|
+
ReactCurrentBatchConfig$1.transition = 1;
|
|
6936
6947
|
|
|
6937
6948
|
try {
|
|
6938
6949
|
setValue(value);
|
|
6939
6950
|
} finally {
|
|
6940
|
-
ReactCurrentBatchConfig$1.
|
|
6951
|
+
ReactCurrentBatchConfig$1.transition = prevTransition;
|
|
6941
6952
|
}
|
|
6942
|
-
}, [value
|
|
6953
|
+
}, [value]);
|
|
6943
6954
|
return prevValue;
|
|
6944
6955
|
}
|
|
6945
6956
|
|
|
6946
|
-
function startTransition(setPending,
|
|
6957
|
+
function startTransition(setPending, callback) {
|
|
6947
6958
|
var priorityLevel = getCurrentPriorityLevel();
|
|
6948
6959
|
|
|
6949
6960
|
{
|
|
@@ -6951,43 +6962,46 @@ function startTransition(setPending, config, callback) {
|
|
|
6951
6962
|
setPending(true);
|
|
6952
6963
|
});
|
|
6953
6964
|
runWithPriority(priorityLevel > NormalPriority$1 ? NormalPriority$1 : priorityLevel, function () {
|
|
6954
|
-
var
|
|
6955
|
-
ReactCurrentBatchConfig$1.
|
|
6965
|
+
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
6966
|
+
ReactCurrentBatchConfig$1.transition = 1;
|
|
6956
6967
|
|
|
6957
6968
|
try {
|
|
6958
6969
|
setPending(false);
|
|
6959
6970
|
callback();
|
|
6960
6971
|
} finally {
|
|
6961
|
-
ReactCurrentBatchConfig$1.
|
|
6972
|
+
ReactCurrentBatchConfig$1.transition = prevTransition;
|
|
6962
6973
|
}
|
|
6963
6974
|
});
|
|
6964
6975
|
}
|
|
6965
6976
|
}
|
|
6966
6977
|
|
|
6967
|
-
function mountTransition(
|
|
6978
|
+
function mountTransition() {
|
|
6968
6979
|
var _mountState2 = mountState(false),
|
|
6969
6980
|
isPending = _mountState2[0],
|
|
6970
|
-
setPending = _mountState2[1];
|
|
6981
|
+
setPending = _mountState2[1]; // The `start` method can be stored on a ref, since `setPending`
|
|
6982
|
+
// never changes.
|
|
6971
6983
|
|
|
6972
|
-
|
|
6984
|
+
|
|
6985
|
+
var start = startTransition.bind(null, setPending);
|
|
6986
|
+
mountRef(start);
|
|
6973
6987
|
return [start, isPending];
|
|
6974
6988
|
}
|
|
6975
6989
|
|
|
6976
|
-
function updateTransition(
|
|
6990
|
+
function updateTransition() {
|
|
6977
6991
|
var _updateState2 = updateState(),
|
|
6978
|
-
isPending = _updateState2[0]
|
|
6979
|
-
setPending = _updateState2[1];
|
|
6992
|
+
isPending = _updateState2[0];
|
|
6980
6993
|
|
|
6981
|
-
var
|
|
6994
|
+
var startRef = updateRef();
|
|
6995
|
+
var start = startRef.current;
|
|
6982
6996
|
return [start, isPending];
|
|
6983
6997
|
}
|
|
6984
6998
|
|
|
6985
|
-
function rerenderTransition(
|
|
6999
|
+
function rerenderTransition() {
|
|
6986
7000
|
var _rerenderState2 = rerenderState(),
|
|
6987
|
-
isPending = _rerenderState2[0]
|
|
6988
|
-
setPending = _rerenderState2[1];
|
|
7001
|
+
isPending = _rerenderState2[0];
|
|
6989
7002
|
|
|
6990
|
-
var
|
|
7003
|
+
var startRef = updateRef();
|
|
7004
|
+
var start = startRef.current;
|
|
6991
7005
|
return [start, isPending];
|
|
6992
7006
|
}
|
|
6993
7007
|
|
|
@@ -7040,8 +7054,7 @@ function dispatchAction(fiber, queue, action) {
|
|
|
7040
7054
|
}
|
|
7041
7055
|
|
|
7042
7056
|
var eventTime = requestEventTime();
|
|
7043
|
-
var
|
|
7044
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
7057
|
+
var lane = requestUpdateLane(fiber);
|
|
7045
7058
|
var update = {
|
|
7046
7059
|
lane: lane,
|
|
7047
7060
|
action: action,
|
|
@@ -7236,15 +7249,15 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
7236
7249
|
mountHookTypesDev();
|
|
7237
7250
|
return mountDebugValue();
|
|
7238
7251
|
},
|
|
7239
|
-
useDeferredValue: function (value
|
|
7252
|
+
useDeferredValue: function (value) {
|
|
7240
7253
|
currentHookNameInDev = 'useDeferredValue';
|
|
7241
7254
|
mountHookTypesDev();
|
|
7242
|
-
return mountDeferredValue(value
|
|
7255
|
+
return mountDeferredValue(value);
|
|
7243
7256
|
},
|
|
7244
|
-
useTransition: function (
|
|
7257
|
+
useTransition: function () {
|
|
7245
7258
|
currentHookNameInDev = 'useTransition';
|
|
7246
7259
|
mountHookTypesDev();
|
|
7247
|
-
return mountTransition(
|
|
7260
|
+
return mountTransition();
|
|
7248
7261
|
},
|
|
7249
7262
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7250
7263
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -7333,15 +7346,15 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
7333
7346
|
updateHookTypesDev();
|
|
7334
7347
|
return mountDebugValue();
|
|
7335
7348
|
},
|
|
7336
|
-
useDeferredValue: function (value
|
|
7349
|
+
useDeferredValue: function (value) {
|
|
7337
7350
|
currentHookNameInDev = 'useDeferredValue';
|
|
7338
7351
|
updateHookTypesDev();
|
|
7339
|
-
return mountDeferredValue(value
|
|
7352
|
+
return mountDeferredValue(value);
|
|
7340
7353
|
},
|
|
7341
|
-
useTransition: function (
|
|
7354
|
+
useTransition: function () {
|
|
7342
7355
|
currentHookNameInDev = 'useTransition';
|
|
7343
7356
|
updateHookTypesDev();
|
|
7344
|
-
return mountTransition(
|
|
7357
|
+
return mountTransition();
|
|
7345
7358
|
},
|
|
7346
7359
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7347
7360
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -7430,15 +7443,15 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
7430
7443
|
updateHookTypesDev();
|
|
7431
7444
|
return updateDebugValue();
|
|
7432
7445
|
},
|
|
7433
|
-
useDeferredValue: function (value
|
|
7446
|
+
useDeferredValue: function (value) {
|
|
7434
7447
|
currentHookNameInDev = 'useDeferredValue';
|
|
7435
7448
|
updateHookTypesDev();
|
|
7436
|
-
return updateDeferredValue(value
|
|
7449
|
+
return updateDeferredValue(value);
|
|
7437
7450
|
},
|
|
7438
|
-
useTransition: function (
|
|
7451
|
+
useTransition: function () {
|
|
7439
7452
|
currentHookNameInDev = 'useTransition';
|
|
7440
7453
|
updateHookTypesDev();
|
|
7441
|
-
return updateTransition(
|
|
7454
|
+
return updateTransition();
|
|
7442
7455
|
},
|
|
7443
7456
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7444
7457
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -7527,15 +7540,15 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
7527
7540
|
updateHookTypesDev();
|
|
7528
7541
|
return updateDebugValue();
|
|
7529
7542
|
},
|
|
7530
|
-
useDeferredValue: function (value
|
|
7543
|
+
useDeferredValue: function (value) {
|
|
7531
7544
|
currentHookNameInDev = 'useDeferredValue';
|
|
7532
7545
|
updateHookTypesDev();
|
|
7533
|
-
return rerenderDeferredValue(value
|
|
7546
|
+
return rerenderDeferredValue(value);
|
|
7534
7547
|
},
|
|
7535
|
-
useTransition: function (
|
|
7548
|
+
useTransition: function () {
|
|
7536
7549
|
currentHookNameInDev = 'useTransition';
|
|
7537
7550
|
updateHookTypesDev();
|
|
7538
|
-
return rerenderTransition(
|
|
7551
|
+
return rerenderTransition();
|
|
7539
7552
|
},
|
|
7540
7553
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7541
7554
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -7635,17 +7648,17 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
7635
7648
|
mountHookTypesDev();
|
|
7636
7649
|
return mountDebugValue();
|
|
7637
7650
|
},
|
|
7638
|
-
useDeferredValue: function (value
|
|
7651
|
+
useDeferredValue: function (value) {
|
|
7639
7652
|
currentHookNameInDev = 'useDeferredValue';
|
|
7640
7653
|
warnInvalidHookAccess();
|
|
7641
7654
|
mountHookTypesDev();
|
|
7642
|
-
return mountDeferredValue(value
|
|
7655
|
+
return mountDeferredValue(value);
|
|
7643
7656
|
},
|
|
7644
|
-
useTransition: function (
|
|
7657
|
+
useTransition: function () {
|
|
7645
7658
|
currentHookNameInDev = 'useTransition';
|
|
7646
7659
|
warnInvalidHookAccess();
|
|
7647
7660
|
mountHookTypesDev();
|
|
7648
|
-
return mountTransition(
|
|
7661
|
+
return mountTransition();
|
|
7649
7662
|
},
|
|
7650
7663
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7651
7664
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -7747,17 +7760,17 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
7747
7760
|
updateHookTypesDev();
|
|
7748
7761
|
return updateDebugValue();
|
|
7749
7762
|
},
|
|
7750
|
-
useDeferredValue: function (value
|
|
7763
|
+
useDeferredValue: function (value) {
|
|
7751
7764
|
currentHookNameInDev = 'useDeferredValue';
|
|
7752
7765
|
warnInvalidHookAccess();
|
|
7753
7766
|
updateHookTypesDev();
|
|
7754
|
-
return updateDeferredValue(value
|
|
7767
|
+
return updateDeferredValue(value);
|
|
7755
7768
|
},
|
|
7756
|
-
useTransition: function (
|
|
7769
|
+
useTransition: function () {
|
|
7757
7770
|
currentHookNameInDev = 'useTransition';
|
|
7758
7771
|
warnInvalidHookAccess();
|
|
7759
7772
|
updateHookTypesDev();
|
|
7760
|
-
return updateTransition(
|
|
7773
|
+
return updateTransition();
|
|
7761
7774
|
},
|
|
7762
7775
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7763
7776
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -7859,17 +7872,17 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
7859
7872
|
updateHookTypesDev();
|
|
7860
7873
|
return updateDebugValue();
|
|
7861
7874
|
},
|
|
7862
|
-
useDeferredValue: function (value
|
|
7875
|
+
useDeferredValue: function (value) {
|
|
7863
7876
|
currentHookNameInDev = 'useDeferredValue';
|
|
7864
7877
|
warnInvalidHookAccess();
|
|
7865
7878
|
updateHookTypesDev();
|
|
7866
|
-
return rerenderDeferredValue(value
|
|
7879
|
+
return rerenderDeferredValue(value);
|
|
7867
7880
|
},
|
|
7868
|
-
useTransition: function (
|
|
7881
|
+
useTransition: function () {
|
|
7869
7882
|
currentHookNameInDev = 'useTransition';
|
|
7870
7883
|
warnInvalidHookAccess();
|
|
7871
7884
|
updateHookTypesDev();
|
|
7872
|
-
return rerenderTransition(
|
|
7885
|
+
return rerenderTransition();
|
|
7873
7886
|
},
|
|
7874
7887
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
7875
7888
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -8033,7 +8046,7 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL
|
|
|
8033
8046
|
} // React DevTools reads this flag.
|
|
8034
8047
|
|
|
8035
8048
|
|
|
8036
|
-
workInProgress.
|
|
8049
|
+
workInProgress.flags |= PerformedWork;
|
|
8037
8050
|
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
|
8038
8051
|
return workInProgress.child;
|
|
8039
8052
|
}
|
|
@@ -8109,7 +8122,7 @@ function updateMemoComponent(current, workInProgress, Component, nextProps, upda
|
|
|
8109
8122
|
} // React DevTools reads this flag.
|
|
8110
8123
|
|
|
8111
8124
|
|
|
8112
|
-
workInProgress.
|
|
8125
|
+
workInProgress.flags |= PerformedWork;
|
|
8113
8126
|
var newChild = createWorkInProgress(currentChild, nextProps);
|
|
8114
8127
|
newChild.ref = workInProgress.ref;
|
|
8115
8128
|
newChild.return = workInProgress;
|
|
@@ -8175,7 +8188,7 @@ function updateSimpleMemoComponent(current, workInProgress, Component, nextProps
|
|
|
8175
8188
|
// this is no longer necessary.
|
|
8176
8189
|
workInProgress.lanes = current.lanes;
|
|
8177
8190
|
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
|
8178
|
-
} else if ((current.
|
|
8191
|
+
} else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
|
|
8179
8192
|
// This is a special case that only exists for legacy mode.
|
|
8180
8193
|
// See https://github.com/facebook/react/pull/19216.
|
|
8181
8194
|
didReceiveUpdate = true;
|
|
@@ -8274,7 +8287,7 @@ function updateMode(current, workInProgress, renderLanes) {
|
|
|
8274
8287
|
|
|
8275
8288
|
function updateProfiler(current, workInProgress, renderLanes) {
|
|
8276
8289
|
{
|
|
8277
|
-
workInProgress.
|
|
8290
|
+
workInProgress.flags |= Update; // Reset effect durations for the next eventual effect phase.
|
|
8278
8291
|
// These are reset during render to allow the DevTools commit hook a chance to read them,
|
|
8279
8292
|
|
|
8280
8293
|
var stateNode = workInProgress.stateNode;
|
|
@@ -8293,7 +8306,7 @@ function markRef(current, workInProgress) {
|
|
|
8293
8306
|
|
|
8294
8307
|
if (current === null && ref !== null || current !== null && current.ref !== ref) {
|
|
8295
8308
|
// Schedule a Ref effect
|
|
8296
|
-
workInProgress.
|
|
8309
|
+
workInProgress.flags |= Ref;
|
|
8297
8310
|
}
|
|
8298
8311
|
}
|
|
8299
8312
|
|
|
@@ -8335,7 +8348,7 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps,
|
|
|
8335
8348
|
} // React DevTools reads this flag.
|
|
8336
8349
|
|
|
8337
8350
|
|
|
8338
|
-
workInProgress.
|
|
8351
|
+
workInProgress.flags |= PerformedWork;
|
|
8339
8352
|
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
|
8340
8353
|
return workInProgress.child;
|
|
8341
8354
|
}
|
|
@@ -8379,7 +8392,7 @@ function updateClassComponent(current, workInProgress, Component, nextProps, ren
|
|
|
8379
8392
|
current.alternate = null;
|
|
8380
8393
|
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
8381
8394
|
|
|
8382
|
-
workInProgress.
|
|
8395
|
+
workInProgress.flags |= Placement;
|
|
8383
8396
|
} // In the initial pass we might need to construct the instance.
|
|
8384
8397
|
|
|
8385
8398
|
|
|
@@ -8413,7 +8426,7 @@ function updateClassComponent(current, workInProgress, Component, nextProps, ren
|
|
|
8413
8426
|
function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes) {
|
|
8414
8427
|
// Refs should update even if shouldComponentUpdate returns false
|
|
8415
8428
|
markRef(current, workInProgress);
|
|
8416
|
-
var didCaptureError = (workInProgress.
|
|
8429
|
+
var didCaptureError = (workInProgress.flags & DidCapture) !== NoFlags;
|
|
8417
8430
|
|
|
8418
8431
|
if (!shouldUpdate && !didCaptureError) {
|
|
8419
8432
|
// Context providers should defer to sCU for rendering
|
|
@@ -8450,7 +8463,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate,
|
|
|
8450
8463
|
} // React DevTools reads this flag.
|
|
8451
8464
|
|
|
8452
8465
|
|
|
8453
|
-
workInProgress.
|
|
8466
|
+
workInProgress.flags |= PerformedWork;
|
|
8454
8467
|
|
|
8455
8468
|
if (current !== null && didCaptureError) {
|
|
8456
8469
|
// If we're recovering from an error, reconcile without reusing any of
|
|
@@ -8525,7 +8538,7 @@ function updateHostRoot(current, workInProgress, renderLanes) {
|
|
|
8525
8538
|
// Conceptually this is similar to Placement in that a new subtree is
|
|
8526
8539
|
// inserted into the React tree here. It just happens to not need DOM
|
|
8527
8540
|
// mutations because it already exists.
|
|
8528
|
-
node.
|
|
8541
|
+
node.flags = node.flags & ~Placement | Hydrating;
|
|
8529
8542
|
node = node.sibling;
|
|
8530
8543
|
}
|
|
8531
8544
|
} else {
|
|
@@ -8548,7 +8561,7 @@ function updateHostComponent(current, workInProgress, renderLanes) {
|
|
|
8548
8561
|
if (prevProps !== null && shouldSetTextContent()) {
|
|
8549
8562
|
// If we're switching from a direct text child to a normal child, or to
|
|
8550
8563
|
// empty, we need to schedule the text content to be reset.
|
|
8551
|
-
workInProgress.
|
|
8564
|
+
workInProgress.flags |= ContentReset;
|
|
8552
8565
|
}
|
|
8553
8566
|
|
|
8554
8567
|
markRef(current, workInProgress);
|
|
@@ -8572,7 +8585,7 @@ function mountLazyComponent(_current, workInProgress, elementType, updateLanes,
|
|
|
8572
8585
|
_current.alternate = null;
|
|
8573
8586
|
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
8574
8587
|
|
|
8575
|
-
workInProgress.
|
|
8588
|
+
workInProgress.flags |= Placement;
|
|
8576
8589
|
}
|
|
8577
8590
|
|
|
8578
8591
|
var props = workInProgress.pendingProps;
|
|
@@ -8664,7 +8677,7 @@ function mountIncompleteClassComponent(_current, workInProgress, Component, next
|
|
|
8664
8677
|
_current.alternate = null;
|
|
8665
8678
|
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
8666
8679
|
|
|
8667
|
-
workInProgress.
|
|
8680
|
+
workInProgress.flags |= Placement;
|
|
8668
8681
|
} // Promote the fiber to a class and try rendering again.
|
|
8669
8682
|
|
|
8670
8683
|
|
|
@@ -8697,7 +8710,7 @@ function mountIndeterminateComponent(_current, workInProgress, Component, render
|
|
|
8697
8710
|
_current.alternate = null;
|
|
8698
8711
|
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
8699
8712
|
|
|
8700
|
-
workInProgress.
|
|
8713
|
+
workInProgress.flags |= Placement;
|
|
8701
8714
|
}
|
|
8702
8715
|
|
|
8703
8716
|
var props = workInProgress.pendingProps;
|
|
@@ -8733,7 +8746,7 @@ function mountIndeterminateComponent(_current, workInProgress, Component, render
|
|
|
8733
8746
|
} // React DevTools reads this flag.
|
|
8734
8747
|
|
|
8735
8748
|
|
|
8736
|
-
workInProgress.
|
|
8749
|
+
workInProgress.flags |= PerformedWork;
|
|
8737
8750
|
|
|
8738
8751
|
{
|
|
8739
8752
|
// Support for module components is deprecated and is removed behind a flag.
|
|
@@ -8871,7 +8884,8 @@ function updateSuspenseOffscreenState(prevOffscreenState, renderLanes) {
|
|
|
8871
8884
|
return {
|
|
8872
8885
|
baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes)
|
|
8873
8886
|
};
|
|
8874
|
-
}
|
|
8887
|
+
} // TODO: Probably should inline this back
|
|
8888
|
+
|
|
8875
8889
|
|
|
8876
8890
|
function shouldRemainOnFallback(suspenseContext, current, workInProgress, renderLanes) {
|
|
8877
8891
|
// If we're already showing a fallback, there are cases where we need to
|
|
@@ -8903,19 +8917,19 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
|
|
|
8903
8917
|
|
|
8904
8918
|
{
|
|
8905
8919
|
if (shouldSuspend(workInProgress)) {
|
|
8906
|
-
workInProgress.
|
|
8920
|
+
workInProgress.flags |= DidCapture;
|
|
8907
8921
|
}
|
|
8908
8922
|
}
|
|
8909
8923
|
|
|
8910
8924
|
var suspenseContext = suspenseStackCursor.current;
|
|
8911
8925
|
var showFallback = false;
|
|
8912
|
-
var didSuspend = (workInProgress.
|
|
8926
|
+
var didSuspend = (workInProgress.flags & DidCapture) !== NoFlags;
|
|
8913
8927
|
|
|
8914
8928
|
if (didSuspend || shouldRemainOnFallback(suspenseContext, current)) {
|
|
8915
8929
|
// Something in this boundary's subtree already suspended. Switch to
|
|
8916
8930
|
// rendering the fallback children.
|
|
8917
8931
|
showFallback = true;
|
|
8918
|
-
workInProgress.
|
|
8932
|
+
workInProgress.flags &= ~DidCapture;
|
|
8919
8933
|
} else {
|
|
8920
8934
|
// Attempting the main content
|
|
8921
8935
|
if (current === null || current.memoizedState !== null) {
|
|
@@ -8960,17 +8974,41 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
|
|
|
8960
8974
|
// But only if this has a fallback.
|
|
8961
8975
|
if (nextProps.fallback !== undefined) ;
|
|
8962
8976
|
|
|
8977
|
+
var nextPrimaryChildren = nextProps.children;
|
|
8978
|
+
var nextFallbackChildren = nextProps.fallback;
|
|
8979
|
+
|
|
8963
8980
|
if (showFallback) {
|
|
8964
|
-
var nextPrimaryChildren = nextProps.children;
|
|
8965
|
-
var nextFallbackChildren = nextProps.fallback;
|
|
8966
8981
|
var fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes);
|
|
8967
8982
|
var primaryChildFragment = workInProgress.child;
|
|
8968
8983
|
primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes);
|
|
8969
8984
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
8970
8985
|
return fallbackFragment;
|
|
8986
|
+
} else if (typeof nextProps.unstable_expectedLoadTime === 'number') {
|
|
8987
|
+
// This is a CPU-bound tree. Skip this tree and show a placeholder to
|
|
8988
|
+
// unblock the surrounding content. Then immediately retry after the
|
|
8989
|
+
// initial commit.
|
|
8990
|
+
var _fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes);
|
|
8991
|
+
|
|
8992
|
+
var _primaryChildFragment = workInProgress.child;
|
|
8993
|
+
_primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes);
|
|
8994
|
+
workInProgress.memoizedState = SUSPENDED_MARKER; // Since nothing actually suspended, there will nothing to ping this to
|
|
8995
|
+
// get it started back up to attempt the next item. While in terms of
|
|
8996
|
+
// priority this work has the same priority as this current render, it's
|
|
8997
|
+
// not part of the same transition once the transition has committed. If
|
|
8998
|
+
// it's sync, we still want to yield so that it can be painted.
|
|
8999
|
+
// Conceptually, this is really the same as pinging. We can use any
|
|
9000
|
+
// RetryLane even if it's the one currently rendering since we're leaving
|
|
9001
|
+
// it behind on this node.
|
|
9002
|
+
|
|
9003
|
+
workInProgress.lanes = SomeRetryLane;
|
|
9004
|
+
|
|
9005
|
+
{
|
|
9006
|
+
markSpawnedWork(SomeRetryLane);
|
|
9007
|
+
}
|
|
9008
|
+
|
|
9009
|
+
return _fallbackFragment;
|
|
8971
9010
|
} else {
|
|
8972
|
-
|
|
8973
|
-
return mountSuspensePrimaryChildren(workInProgress, _nextPrimaryChildren, renderLanes);
|
|
9011
|
+
return mountSuspensePrimaryChildren(workInProgress, nextPrimaryChildren, renderLanes);
|
|
8974
9012
|
}
|
|
8975
9013
|
} else {
|
|
8976
9014
|
// This is an update.
|
|
@@ -8982,37 +9020,37 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
|
|
|
8982
9020
|
|
|
8983
9021
|
if (showFallback) {
|
|
8984
9022
|
var _nextFallbackChildren2 = nextProps.fallback;
|
|
8985
|
-
var
|
|
9023
|
+
var _nextPrimaryChildren2 = nextProps.children;
|
|
8986
9024
|
|
|
8987
|
-
var _fallbackChildFragment = updateSuspenseFallbackChildren(current, workInProgress,
|
|
9025
|
+
var _fallbackChildFragment = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren2, _nextFallbackChildren2, renderLanes);
|
|
8988
9026
|
|
|
8989
|
-
var
|
|
9027
|
+
var _primaryChildFragment3 = workInProgress.child;
|
|
8990
9028
|
var prevOffscreenState = current.child.memoizedState;
|
|
8991
|
-
|
|
8992
|
-
|
|
9029
|
+
_primaryChildFragment3.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes);
|
|
9030
|
+
_primaryChildFragment3.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes);
|
|
8993
9031
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
8994
9032
|
return _fallbackChildFragment;
|
|
8995
9033
|
} else {
|
|
8996
|
-
var
|
|
9034
|
+
var _nextPrimaryChildren3 = nextProps.children;
|
|
8997
9035
|
|
|
8998
|
-
var
|
|
9036
|
+
var _primaryChildFragment4 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren3, renderLanes);
|
|
8999
9037
|
|
|
9000
9038
|
workInProgress.memoizedState = null;
|
|
9001
|
-
return
|
|
9039
|
+
return _primaryChildFragment4;
|
|
9002
9040
|
}
|
|
9003
9041
|
} else {
|
|
9004
9042
|
// The current tree is not already showing a fallback.
|
|
9005
9043
|
if (showFallback) {
|
|
9006
9044
|
// Timed out.
|
|
9007
9045
|
var _nextFallbackChildren3 = nextProps.fallback;
|
|
9008
|
-
var
|
|
9046
|
+
var _nextPrimaryChildren4 = nextProps.children;
|
|
9009
9047
|
|
|
9010
|
-
var _fallbackChildFragment2 = updateSuspenseFallbackChildren(current, workInProgress,
|
|
9048
|
+
var _fallbackChildFragment2 = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren4, _nextFallbackChildren3, renderLanes);
|
|
9011
9049
|
|
|
9012
|
-
var
|
|
9050
|
+
var _primaryChildFragment5 = workInProgress.child;
|
|
9013
9051
|
var _prevOffscreenState = current.child.memoizedState;
|
|
9014
|
-
|
|
9015
|
-
|
|
9052
|
+
_primaryChildFragment5.memoizedState = _prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(_prevOffscreenState, renderLanes);
|
|
9053
|
+
_primaryChildFragment5.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); // Skip the primary children, and continue working on the
|
|
9016
9054
|
// fallback children.
|
|
9017
9055
|
|
|
9018
9056
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
@@ -9020,12 +9058,12 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
|
|
|
9020
9058
|
} else {
|
|
9021
9059
|
// Still haven't timed out. Continue rendering the children, like we
|
|
9022
9060
|
// normally do.
|
|
9023
|
-
var
|
|
9061
|
+
var _nextPrimaryChildren5 = nextProps.children;
|
|
9024
9062
|
|
|
9025
|
-
var
|
|
9063
|
+
var _primaryChildFragment6 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren5, renderLanes);
|
|
9026
9064
|
|
|
9027
9065
|
workInProgress.memoizedState = null;
|
|
9028
|
-
return
|
|
9066
|
+
return _primaryChildFragment6;
|
|
9029
9067
|
}
|
|
9030
9068
|
}
|
|
9031
9069
|
}
|
|
@@ -9108,7 +9146,7 @@ function updateSuspensePrimaryChildren(current, workInProgress, primaryChildren,
|
|
|
9108
9146
|
if (currentFallbackChildFragment !== null) {
|
|
9109
9147
|
// Delete the fallback child fragment
|
|
9110
9148
|
currentFallbackChildFragment.nextEffect = null;
|
|
9111
|
-
currentFallbackChildFragment.
|
|
9149
|
+
currentFallbackChildFragment.flags = Deletion;
|
|
9112
9150
|
workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment;
|
|
9113
9151
|
}
|
|
9114
9152
|
|
|
@@ -9179,7 +9217,7 @@ function updateSuspenseFallbackChildren(current, workInProgress, primaryChildren
|
|
|
9179
9217
|
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); // Needs a placement effect because the parent (the Suspense boundary) already
|
|
9180
9218
|
// mounted but this is a new fiber.
|
|
9181
9219
|
|
|
9182
|
-
fallbackChildFragment.
|
|
9220
|
+
fallbackChildFragment.flags |= Placement;
|
|
9183
9221
|
}
|
|
9184
9222
|
|
|
9185
9223
|
fallbackChildFragment.return = workInProgress;
|
|
@@ -9417,9 +9455,9 @@ function updateSuspenseListComponent(current, workInProgress, renderLanes) {
|
|
|
9417
9455
|
|
|
9418
9456
|
if (shouldForceFallback) {
|
|
9419
9457
|
suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
|
9420
|
-
workInProgress.
|
|
9458
|
+
workInProgress.flags |= DidCapture;
|
|
9421
9459
|
} else {
|
|
9422
|
-
var didSuspendBefore = current !== null && (current.
|
|
9460
|
+
var didSuspendBefore = current !== null && (current.flags & DidCapture) !== NoFlags;
|
|
9423
9461
|
|
|
9424
9462
|
if (didSuspendBefore) {
|
|
9425
9463
|
// If we previously forced a fallback, we need to schedule work
|
|
@@ -9629,7 +9667,7 @@ function updateContextConsumer(current, workInProgress, renderLanes) {
|
|
|
9629
9667
|
} // React DevTools reads this flag.
|
|
9630
9668
|
|
|
9631
9669
|
|
|
9632
|
-
workInProgress.
|
|
9670
|
+
workInProgress.flags |= PerformedWork;
|
|
9633
9671
|
reconcileChildren(current, workInProgress, newChildren, renderLanes);
|
|
9634
9672
|
return workInProgress.child;
|
|
9635
9673
|
}
|
|
@@ -9714,8 +9752,8 @@ function remountFiber(current, oldWorkInProgress, newWorkInProgress) {
|
|
|
9714
9752
|
}
|
|
9715
9753
|
|
|
9716
9754
|
current.nextEffect = null;
|
|
9717
|
-
current.
|
|
9718
|
-
newWorkInProgress.
|
|
9755
|
+
current.flags = Deletion;
|
|
9756
|
+
newWorkInProgress.flags |= Placement; // Restart work from the new fiber.
|
|
9719
9757
|
|
|
9720
9758
|
return newWorkInProgress;
|
|
9721
9759
|
}
|
|
@@ -9782,7 +9820,7 @@ function beginWork(current, workInProgress, renderLanes) {
|
|
|
9782
9820
|
var hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes);
|
|
9783
9821
|
|
|
9784
9822
|
if (hasChildWork) {
|
|
9785
|
-
workInProgress.
|
|
9823
|
+
workInProgress.flags |= Update;
|
|
9786
9824
|
} // Reset effect durations for the next eventual effect phase.
|
|
9787
9825
|
// These are reset during render to allow the DevTools commit hook a chance to read them,
|
|
9788
9826
|
|
|
@@ -9836,7 +9874,7 @@ function beginWork(current, workInProgress, renderLanes) {
|
|
|
9836
9874
|
|
|
9837
9875
|
case SuspenseListComponent:
|
|
9838
9876
|
{
|
|
9839
|
-
var didSuspendBefore = (current.
|
|
9877
|
+
var didSuspendBefore = (current.flags & DidCapture) !== NoFlags;
|
|
9840
9878
|
|
|
9841
9879
|
var _hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes);
|
|
9842
9880
|
|
|
@@ -9853,7 +9891,7 @@ function beginWork(current, workInProgress, renderLanes) {
|
|
|
9853
9891
|
// as before. We can fast bail out.
|
|
9854
9892
|
|
|
9855
9893
|
|
|
9856
|
-
workInProgress.
|
|
9894
|
+
workInProgress.flags |= DidCapture;
|
|
9857
9895
|
} // If nothing suspended before and we're rendering the same children,
|
|
9858
9896
|
// then the tail doesn't matter. Anything new that suspends will work
|
|
9859
9897
|
// in the "together" mode, so we can continue from the state we had.
|
|
@@ -9899,7 +9937,7 @@ function beginWork(current, workInProgress, renderLanes) {
|
|
|
9899
9937
|
|
|
9900
9938
|
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
|
9901
9939
|
} else {
|
|
9902
|
-
if ((current.
|
|
9940
|
+
if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
|
|
9903
9941
|
// This is a special case that only exists for legacy mode.
|
|
9904
9942
|
// See https://github.com/facebook/react/pull/19216.
|
|
9905
9943
|
didReceiveUpdate = true;
|
|
@@ -10073,11 +10111,11 @@ function beginWork(current, workInProgress, renderLanes) {
|
|
|
10073
10111
|
function markUpdate(workInProgress) {
|
|
10074
10112
|
// Tag the fiber with an update effect. This turns a Placement into
|
|
10075
10113
|
// a PlacementAndUpdate.
|
|
10076
|
-
workInProgress.
|
|
10114
|
+
workInProgress.flags |= Update;
|
|
10077
10115
|
}
|
|
10078
10116
|
|
|
10079
10117
|
function markRef$1(workInProgress) {
|
|
10080
|
-
workInProgress.
|
|
10118
|
+
workInProgress.flags |= Ref;
|
|
10081
10119
|
}
|
|
10082
10120
|
|
|
10083
10121
|
var appendAllChildren;
|
|
@@ -10287,7 +10325,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
10287
10325
|
// This handles the case of React rendering into a container with previous children.
|
|
10288
10326
|
// It's also safe to do for updates too, because current.child would only be null
|
|
10289
10327
|
// if the previous render was null (so the the container would already be empty).
|
|
10290
|
-
workInProgress.
|
|
10328
|
+
workInProgress.flags |= Snapshot;
|
|
10291
10329
|
}
|
|
10292
10330
|
}
|
|
10293
10331
|
|
|
@@ -10391,7 +10429,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
10391
10429
|
popSuspenseContext(workInProgress);
|
|
10392
10430
|
var nextState = workInProgress.memoizedState;
|
|
10393
10431
|
|
|
10394
|
-
if ((workInProgress.
|
|
10432
|
+
if ((workInProgress.flags & DidCapture) !== NoFlags) {
|
|
10395
10433
|
// Something suspended. Re-render with the fallback children.
|
|
10396
10434
|
workInProgress.lanes = renderLanes; // Do not reset the effect list.
|
|
10397
10435
|
|
|
@@ -10448,7 +10486,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
10448
10486
|
// primary children. In mutation mode, we also need the flag to
|
|
10449
10487
|
// *unhide* children that were previously hidden, so check if this
|
|
10450
10488
|
// is currently timed out, too.
|
|
10451
|
-
workInProgress.
|
|
10489
|
+
workInProgress.flags |= Update;
|
|
10452
10490
|
}
|
|
10453
10491
|
}
|
|
10454
10492
|
|
|
@@ -10494,7 +10532,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
10494
10532
|
return null;
|
|
10495
10533
|
}
|
|
10496
10534
|
|
|
10497
|
-
var didSuspendAlready = (workInProgress.
|
|
10535
|
+
var didSuspendAlready = (workInProgress.flags & DidCapture) !== NoFlags;
|
|
10498
10536
|
var renderedTail = renderState.rendering;
|
|
10499
10537
|
|
|
10500
10538
|
if (renderedTail === null) {
|
|
@@ -10509,7 +10547,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
10509
10547
|
// something in the previous committed pass suspended. Otherwise,
|
|
10510
10548
|
// there's no chance so we can skip the expensive call to
|
|
10511
10549
|
// findFirstSuspended.
|
|
10512
|
-
var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.
|
|
10550
|
+
var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.flags & DidCapture) === NoFlags);
|
|
10513
10551
|
|
|
10514
10552
|
if (!cannotBeSuspended) {
|
|
10515
10553
|
var row = workInProgress.child;
|
|
@@ -10519,7 +10557,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
10519
10557
|
|
|
10520
10558
|
if (suspended !== null) {
|
|
10521
10559
|
didSuspendAlready = true;
|
|
10522
|
-
workInProgress.
|
|
10560
|
+
workInProgress.flags |= DidCapture;
|
|
10523
10561
|
cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as
|
|
10524
10562
|
// part of the second pass. In that case nothing will subscribe to
|
|
10525
10563
|
// its thennables. Instead, we'll transfer its thennables to the
|
|
@@ -10537,7 +10575,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
10537
10575
|
|
|
10538
10576
|
if (newThennables !== null) {
|
|
10539
10577
|
workInProgress.updateQueue = newThennables;
|
|
10540
|
-
workInProgress.
|
|
10578
|
+
workInProgress.flags |= Update;
|
|
10541
10579
|
} // Rerender the whole list, but this time, we'll force fallbacks
|
|
10542
10580
|
// to stay in place.
|
|
10543
10581
|
// Reset the effect list before doing the second pass since that's now invalid.
|
|
@@ -10564,7 +10602,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
10564
10602
|
// We have already passed our CPU deadline but we still have rows
|
|
10565
10603
|
// left in the tail. We'll just give up further attempts to render
|
|
10566
10604
|
// the main content and only render fallbacks.
|
|
10567
|
-
workInProgress.
|
|
10605
|
+
workInProgress.flags |= DidCapture;
|
|
10568
10606
|
didSuspendAlready = true;
|
|
10569
10607
|
cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this
|
|
10570
10608
|
// to get it started back up to attempt the next item. While in terms
|
|
@@ -10591,7 +10629,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
10591
10629
|
var _suspended = findFirstSuspended(renderedTail);
|
|
10592
10630
|
|
|
10593
10631
|
if (_suspended !== null) {
|
|
10594
|
-
workInProgress.
|
|
10632
|
+
workInProgress.flags |= DidCapture;
|
|
10595
10633
|
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
|
|
10596
10634
|
// get lost if this row ends up dropped during a second pass.
|
|
10597
10635
|
|
|
@@ -10599,7 +10637,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
10599
10637
|
|
|
10600
10638
|
if (_newThennables !== null) {
|
|
10601
10639
|
workInProgress.updateQueue = _newThennables;
|
|
10602
|
-
workInProgress.
|
|
10640
|
+
workInProgress.flags |= Update;
|
|
10603
10641
|
}
|
|
10604
10642
|
|
|
10605
10643
|
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
|
@@ -10625,7 +10663,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
10625
10663
|
// We have now passed our CPU deadline and we'll just give up further
|
|
10626
10664
|
// attempts to render the main content and only render fallbacks.
|
|
10627
10665
|
// The assumption is that this is usually faster.
|
|
10628
|
-
workInProgress.
|
|
10666
|
+
workInProgress.flags |= DidCapture;
|
|
10629
10667
|
didSuspendAlready = true;
|
|
10630
10668
|
cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this
|
|
10631
10669
|
// to get it started back up to attempt the next item. While in terms
|
|
@@ -10721,7 +10759,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
10721
10759
|
var nextIsHidden = _nextState !== null;
|
|
10722
10760
|
|
|
10723
10761
|
if (prevIsHidden !== nextIsHidden && newProps.mode !== 'unstable-defer-without-hiding') {
|
|
10724
|
-
workInProgress.
|
|
10762
|
+
workInProgress.flags |= Update;
|
|
10725
10763
|
}
|
|
10726
10764
|
}
|
|
10727
10765
|
|
|
@@ -10746,10 +10784,10 @@ function unwindWork(workInProgress, renderLanes) {
|
|
|
10746
10784
|
popContext(workInProgress);
|
|
10747
10785
|
}
|
|
10748
10786
|
|
|
10749
|
-
var
|
|
10787
|
+
var flags = workInProgress.flags;
|
|
10750
10788
|
|
|
10751
|
-
if (
|
|
10752
|
-
workInProgress.
|
|
10789
|
+
if (flags & ShouldCapture) {
|
|
10790
|
+
workInProgress.flags = flags & ~ShouldCapture | DidCapture;
|
|
10753
10791
|
|
|
10754
10792
|
if ( (workInProgress.mode & ProfileMode) !== NoMode) {
|
|
10755
10793
|
transferActualDuration(workInProgress);
|
|
@@ -10766,15 +10804,15 @@ function unwindWork(workInProgress, renderLanes) {
|
|
|
10766
10804
|
popHostContainer(workInProgress);
|
|
10767
10805
|
popTopLevelContextObject(workInProgress);
|
|
10768
10806
|
resetWorkInProgressVersions();
|
|
10769
|
-
var
|
|
10807
|
+
var _flags = workInProgress.flags;
|
|
10770
10808
|
|
|
10771
|
-
if (!((
|
|
10809
|
+
if (!((_flags & DidCapture) === NoFlags)) {
|
|
10772
10810
|
{
|
|
10773
10811
|
throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." );
|
|
10774
10812
|
}
|
|
10775
10813
|
}
|
|
10776
10814
|
|
|
10777
|
-
workInProgress.
|
|
10815
|
+
workInProgress.flags = _flags & ~ShouldCapture | DidCapture;
|
|
10778
10816
|
return workInProgress;
|
|
10779
10817
|
}
|
|
10780
10818
|
|
|
@@ -10789,10 +10827,10 @@ function unwindWork(workInProgress, renderLanes) {
|
|
|
10789
10827
|
{
|
|
10790
10828
|
popSuspenseContext(workInProgress);
|
|
10791
10829
|
|
|
10792
|
-
var
|
|
10830
|
+
var _flags2 = workInProgress.flags;
|
|
10793
10831
|
|
|
10794
|
-
if (
|
|
10795
|
-
workInProgress.
|
|
10832
|
+
if (_flags2 & ShouldCapture) {
|
|
10833
|
+
workInProgress.flags = _flags2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary.
|
|
10796
10834
|
|
|
10797
10835
|
if ( (workInProgress.mode & ProfileMode) !== NoMode) {
|
|
10798
10836
|
transferActualDuration(workInProgress);
|
|
@@ -11076,7 +11114,7 @@ function attachPingListener(root, wakeable, lanes) {
|
|
|
11076
11114
|
|
|
11077
11115
|
function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes) {
|
|
11078
11116
|
// The source fiber did not complete.
|
|
11079
|
-
sourceFiber.
|
|
11117
|
+
sourceFiber.flags |= Incomplete; // Its effect list is no longer valid.
|
|
11080
11118
|
|
|
11081
11119
|
sourceFiber.firstEffect = sourceFiber.lastEffect = null;
|
|
11082
11120
|
|
|
@@ -11127,12 +11165,12 @@ function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes)
|
|
|
11127
11165
|
|
|
11128
11166
|
|
|
11129
11167
|
if ((_workInProgress.mode & BlockingMode) === NoMode) {
|
|
11130
|
-
_workInProgress.
|
|
11131
|
-
sourceFiber.
|
|
11168
|
+
_workInProgress.flags |= DidCapture;
|
|
11169
|
+
sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete.
|
|
11132
11170
|
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
|
11133
11171
|
// all lifecycle effect tags.
|
|
11134
11172
|
|
|
11135
|
-
sourceFiber.
|
|
11173
|
+
sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete);
|
|
11136
11174
|
|
|
11137
11175
|
if (sourceFiber.tag === ClassComponent) {
|
|
11138
11176
|
var currentSourceFiber = sourceFiber.alternate;
|
|
@@ -11182,8 +11220,8 @@ function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes)
|
|
|
11182
11220
|
// that we can show the initial loading state as quickly as possible.
|
|
11183
11221
|
//
|
|
11184
11222
|
// If we hit a "Delayed" case, such as when we'd switch from content back into
|
|
11185
|
-
// a fallback, then we should always suspend/restart.
|
|
11186
|
-
// this case. If none is defined, JND is used instead.
|
|
11223
|
+
// a fallback, then we should always suspend/restart. Transitions apply
|
|
11224
|
+
// to this case. If none is defined, JND is used instead.
|
|
11187
11225
|
//
|
|
11188
11226
|
// If we're already showing a fallback and it gets "retried", allowing us to show
|
|
11189
11227
|
// another level, but there's still an inner boundary that would show a fallback,
|
|
@@ -11200,7 +11238,7 @@ function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes)
|
|
|
11200
11238
|
|
|
11201
11239
|
|
|
11202
11240
|
attachPingListener(root, wakeable, rootRenderLanes);
|
|
11203
|
-
_workInProgress.
|
|
11241
|
+
_workInProgress.flags |= ShouldCapture;
|
|
11204
11242
|
_workInProgress.lanes = rootRenderLanes;
|
|
11205
11243
|
return;
|
|
11206
11244
|
} // This boundary already captured during this render. Continue to the next
|
|
@@ -11227,7 +11265,7 @@ function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes)
|
|
|
11227
11265
|
case HostRoot:
|
|
11228
11266
|
{
|
|
11229
11267
|
var _errorInfo = value;
|
|
11230
|
-
workInProgress.
|
|
11268
|
+
workInProgress.flags |= ShouldCapture;
|
|
11231
11269
|
var lane = pickArbitraryLane(rootRenderLanes);
|
|
11232
11270
|
workInProgress.lanes = mergeLanes(workInProgress.lanes, lane);
|
|
11233
11271
|
|
|
@@ -11243,8 +11281,8 @@ function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes)
|
|
|
11243
11281
|
var ctor = workInProgress.type;
|
|
11244
11282
|
var instance = workInProgress.stateNode;
|
|
11245
11283
|
|
|
11246
|
-
if ((workInProgress.
|
|
11247
|
-
workInProgress.
|
|
11284
|
+
if ((workInProgress.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
|
|
11285
|
+
workInProgress.flags |= ShouldCapture;
|
|
11248
11286
|
|
|
11249
11287
|
var _lane = pickArbitraryLane(rootRenderLanes);
|
|
11250
11288
|
|
|
@@ -11496,18 +11534,18 @@ var callComponentWillUnmountWithTimer = function (current, instance) {
|
|
|
11496
11534
|
}; // Capture errors so they don't interrupt unmounting.
|
|
11497
11535
|
|
|
11498
11536
|
|
|
11499
|
-
function safelyCallComponentWillUnmount(current, instance
|
|
11537
|
+
function safelyCallComponentWillUnmount(current, instance) {
|
|
11500
11538
|
{
|
|
11501
11539
|
invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current, instance);
|
|
11502
11540
|
|
|
11503
11541
|
if (hasCaughtError()) {
|
|
11504
11542
|
var unmountError = clearCaughtError();
|
|
11505
|
-
captureCommitPhaseError(current,
|
|
11543
|
+
captureCommitPhaseError(current, unmountError);
|
|
11506
11544
|
}
|
|
11507
11545
|
}
|
|
11508
11546
|
}
|
|
11509
11547
|
|
|
11510
|
-
function safelyDetachRef(current
|
|
11548
|
+
function safelyDetachRef(current) {
|
|
11511
11549
|
var ref = current.ref;
|
|
11512
11550
|
|
|
11513
11551
|
if (ref !== null) {
|
|
@@ -11517,7 +11555,7 @@ function safelyDetachRef(current, nearestMountedAncestor) {
|
|
|
11517
11555
|
|
|
11518
11556
|
if (hasCaughtError()) {
|
|
11519
11557
|
var refError = clearCaughtError();
|
|
11520
|
-
captureCommitPhaseError(current,
|
|
11558
|
+
captureCommitPhaseError(current, refError);
|
|
11521
11559
|
}
|
|
11522
11560
|
}
|
|
11523
11561
|
} else {
|
|
@@ -11526,13 +11564,13 @@ function safelyDetachRef(current, nearestMountedAncestor) {
|
|
|
11526
11564
|
}
|
|
11527
11565
|
}
|
|
11528
11566
|
|
|
11529
|
-
function safelyCallDestroy(current,
|
|
11567
|
+
function safelyCallDestroy(current, destroy) {
|
|
11530
11568
|
{
|
|
11531
11569
|
invokeGuardedCallback(null, destroy, null);
|
|
11532
11570
|
|
|
11533
11571
|
if (hasCaughtError()) {
|
|
11534
11572
|
var error = clearCaughtError();
|
|
11535
|
-
captureCommitPhaseError(current,
|
|
11573
|
+
captureCommitPhaseError(current, error);
|
|
11536
11574
|
}
|
|
11537
11575
|
}
|
|
11538
11576
|
}
|
|
@@ -11549,7 +11587,7 @@ function commitBeforeMutationLifeCycles(current, finishedWork) {
|
|
|
11549
11587
|
|
|
11550
11588
|
case ClassComponent:
|
|
11551
11589
|
{
|
|
11552
|
-
if (finishedWork.
|
|
11590
|
+
if (finishedWork.flags & Snapshot) {
|
|
11553
11591
|
if (current !== null) {
|
|
11554
11592
|
var prevProps = current.memoizedProps;
|
|
11555
11593
|
var prevState = current.memoizedState;
|
|
@@ -11591,7 +11629,7 @@ function commitBeforeMutationLifeCycles(current, finishedWork) {
|
|
|
11591
11629
|
case HostRoot:
|
|
11592
11630
|
{
|
|
11593
11631
|
{
|
|
11594
|
-
if (finishedWork.
|
|
11632
|
+
if (finishedWork.flags & Snapshot) {
|
|
11595
11633
|
var root = finishedWork.stateNode;
|
|
11596
11634
|
clearContainer(root.containerInfo);
|
|
11597
11635
|
}
|
|
@@ -11690,7 +11728,7 @@ function schedulePassiveEffects(finishedWork) {
|
|
|
11690
11728
|
next = _effect.next,
|
|
11691
11729
|
tag = _effect.tag;
|
|
11692
11730
|
|
|
11693
|
-
if ((tag & Passive$1) !==
|
|
11731
|
+
if ((tag & Passive$1) !== NoFlags$1 && (tag & HasEffect) !== NoFlags$1) {
|
|
11694
11732
|
enqueuePendingPassiveHookEffectUnmount(finishedWork, effect);
|
|
11695
11733
|
enqueuePendingPassiveHookEffectMount(finishedWork, effect);
|
|
11696
11734
|
}
|
|
@@ -11723,7 +11761,7 @@ function commitLifeCycles(finishedRoot, current, finishedWork, committedLanes) {
|
|
|
11723
11761
|
{
|
|
11724
11762
|
var instance = finishedWork.stateNode;
|
|
11725
11763
|
|
|
11726
|
-
if (finishedWork.
|
|
11764
|
+
if (finishedWork.flags & Update) {
|
|
11727
11765
|
if (current === null) {
|
|
11728
11766
|
// We could update instance props and state here,
|
|
11729
11767
|
// but instead we rely on them being set during last render.
|
|
@@ -11827,7 +11865,7 @@ function commitLifeCycles(finishedRoot, current, finishedWork, committedLanes) {
|
|
|
11827
11865
|
// These effects should only be committed when components are first mounted,
|
|
11828
11866
|
// aka when there is no current/alternate.
|
|
11829
11867
|
|
|
11830
|
-
if (current === null && finishedWork.
|
|
11868
|
+
if (current === null && finishedWork.flags & Update) {
|
|
11831
11869
|
var type = finishedWork.type;
|
|
11832
11870
|
var props = finishedWork.memoizedProps;
|
|
11833
11871
|
}
|
|
@@ -11979,7 +12017,7 @@ function commitDetachRef(current) {
|
|
|
11979
12017
|
// interrupt deletion, so it's okay
|
|
11980
12018
|
|
|
11981
12019
|
|
|
11982
|
-
function commitUnmount(finishedRoot, current,
|
|
12020
|
+
function commitUnmount(finishedRoot, current, renderPriorityLevel) {
|
|
11983
12021
|
onCommitUnmount(current);
|
|
11984
12022
|
|
|
11985
12023
|
switch (current.tag) {
|
|
@@ -12004,11 +12042,11 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor, renderPrio
|
|
|
12004
12042
|
tag = _effect2.tag;
|
|
12005
12043
|
|
|
12006
12044
|
if (destroy !== undefined) {
|
|
12007
|
-
if ((tag & Passive$1) !==
|
|
12045
|
+
if ((tag & Passive$1) !== NoFlags$1) {
|
|
12008
12046
|
enqueuePendingPassiveHookEffectUnmount(current, effect);
|
|
12009
12047
|
} else {
|
|
12010
12048
|
{
|
|
12011
|
-
safelyCallDestroy(current,
|
|
12049
|
+
safelyCallDestroy(current, destroy);
|
|
12012
12050
|
}
|
|
12013
12051
|
}
|
|
12014
12052
|
}
|
|
@@ -12023,11 +12061,11 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor, renderPrio
|
|
|
12023
12061
|
|
|
12024
12062
|
case ClassComponent:
|
|
12025
12063
|
{
|
|
12026
|
-
safelyDetachRef(current
|
|
12064
|
+
safelyDetachRef(current);
|
|
12027
12065
|
var instance = current.stateNode;
|
|
12028
12066
|
|
|
12029
12067
|
if (typeof instance.componentWillUnmount === 'function') {
|
|
12030
|
-
safelyCallComponentWillUnmount(current, instance
|
|
12068
|
+
safelyCallComponentWillUnmount(current, instance);
|
|
12031
12069
|
}
|
|
12032
12070
|
|
|
12033
12071
|
return;
|
|
@@ -12035,7 +12073,7 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor, renderPrio
|
|
|
12035
12073
|
|
|
12036
12074
|
case HostComponent:
|
|
12037
12075
|
{
|
|
12038
|
-
safelyDetachRef(current
|
|
12076
|
+
safelyDetachRef(current);
|
|
12039
12077
|
return;
|
|
12040
12078
|
}
|
|
12041
12079
|
|
|
@@ -12045,7 +12083,7 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor, renderPrio
|
|
|
12045
12083
|
// We are also not using this parent because
|
|
12046
12084
|
// the portal will get pushed immediately.
|
|
12047
12085
|
{
|
|
12048
|
-
unmountHostComponents(finishedRoot, current
|
|
12086
|
+
unmountHostComponents(finishedRoot, current);
|
|
12049
12087
|
}
|
|
12050
12088
|
|
|
12051
12089
|
return;
|
|
@@ -12071,7 +12109,7 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor, renderPrio
|
|
|
12071
12109
|
}
|
|
12072
12110
|
}
|
|
12073
12111
|
|
|
12074
|
-
function commitNestedUnmounts(finishedRoot, root,
|
|
12112
|
+
function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) {
|
|
12075
12113
|
// While we're inside a removed host node we don't want to call
|
|
12076
12114
|
// removeChild on the inner nodes because they're removed by the top
|
|
12077
12115
|
// call anyway. We also want to call componentWillUnmount on all
|
|
@@ -12080,7 +12118,7 @@ function commitNestedUnmounts(finishedRoot, root, nearestMountedAncestor, render
|
|
|
12080
12118
|
var node = root;
|
|
12081
12119
|
|
|
12082
12120
|
while (true) {
|
|
12083
|
-
commitUnmount(finishedRoot, node
|
|
12121
|
+
commitUnmount(finishedRoot, node); // Visit children because they may contain more composite or host nodes.
|
|
12084
12122
|
// Skip portals because commitUnmount() currently visits them recursively.
|
|
12085
12123
|
|
|
12086
12124
|
if (node.child !== null && ( // If we use mutation we drill down into portals using commitUnmount above.
|
|
@@ -12185,7 +12223,7 @@ function getHostSibling(fiber) {
|
|
|
12185
12223
|
while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) {
|
|
12186
12224
|
// If it is not host node and, we might have a host node inside it.
|
|
12187
12225
|
// Try to search down until we find one.
|
|
12188
|
-
if (node.
|
|
12226
|
+
if (node.flags & Placement) {
|
|
12189
12227
|
// If we don't have a child, try the siblings instead.
|
|
12190
12228
|
continue siblings;
|
|
12191
12229
|
} // If we don't have a child, try the siblings instead.
|
|
@@ -12201,7 +12239,7 @@ function getHostSibling(fiber) {
|
|
|
12201
12239
|
} // Check if this host node is stable or about to be placed.
|
|
12202
12240
|
|
|
12203
12241
|
|
|
12204
|
-
if (!(node.
|
|
12242
|
+
if (!(node.flags & Placement)) {
|
|
12205
12243
|
// Found it!
|
|
12206
12244
|
return node.stateNode;
|
|
12207
12245
|
}
|
|
@@ -12246,9 +12284,9 @@ function commitPlacement(finishedWork) {
|
|
|
12246
12284
|
|
|
12247
12285
|
}
|
|
12248
12286
|
|
|
12249
|
-
if (parentFiber.
|
|
12287
|
+
if (parentFiber.flags & ContentReset) {
|
|
12250
12288
|
|
|
12251
|
-
parentFiber.
|
|
12289
|
+
parentFiber.flags &= ~ContentReset;
|
|
12252
12290
|
}
|
|
12253
12291
|
|
|
12254
12292
|
var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its
|
|
@@ -12315,7 +12353,7 @@ function insertOrAppendPlacementNode(node, before, parent) {
|
|
|
12315
12353
|
}
|
|
12316
12354
|
}
|
|
12317
12355
|
|
|
12318
|
-
function unmountHostComponents(finishedRoot, current,
|
|
12356
|
+
function unmountHostComponents(finishedRoot, current, renderPriorityLevel) {
|
|
12319
12357
|
// We only have the top Fiber that was deleted but we need to recurse down its
|
|
12320
12358
|
// children to find all the terminal nodes.
|
|
12321
12359
|
var node = current; // Each iteration, currentParent is populated with node's host parent if not
|
|
@@ -12364,7 +12402,7 @@ function unmountHostComponents(finishedRoot, current, nearestMountedAncestor, re
|
|
|
12364
12402
|
}
|
|
12365
12403
|
|
|
12366
12404
|
if (node.tag === HostComponent || node.tag === HostText) {
|
|
12367
|
-
commitNestedUnmounts(finishedRoot, node
|
|
12405
|
+
commitNestedUnmounts(finishedRoot, node); // After all the children have unmounted, it is now safe to remove the
|
|
12368
12406
|
// node from the tree.
|
|
12369
12407
|
|
|
12370
12408
|
if (currentParentIsContainer) {
|
|
@@ -12385,7 +12423,7 @@ function unmountHostComponents(finishedRoot, current, nearestMountedAncestor, re
|
|
|
12385
12423
|
continue;
|
|
12386
12424
|
}
|
|
12387
12425
|
} else {
|
|
12388
|
-
commitUnmount(finishedRoot, node
|
|
12426
|
+
commitUnmount(finishedRoot, node); // Visit children because we may find more host components below.
|
|
12389
12427
|
|
|
12390
12428
|
if (node.child !== null) {
|
|
12391
12429
|
node.child.return = node;
|
|
@@ -12417,11 +12455,11 @@ function unmountHostComponents(finishedRoot, current, nearestMountedAncestor, re
|
|
|
12417
12455
|
}
|
|
12418
12456
|
}
|
|
12419
12457
|
|
|
12420
|
-
function commitDeletion(finishedRoot, current,
|
|
12458
|
+
function commitDeletion(finishedRoot, current, renderPriorityLevel) {
|
|
12421
12459
|
{
|
|
12422
12460
|
// Recursively delete all host nodes from the parent.
|
|
12423
12461
|
// Detach refs and call componentWillUnmount() on the whole subtree.
|
|
12424
|
-
unmountHostComponents(finishedRoot, current
|
|
12462
|
+
unmountHostComponents(finishedRoot, current);
|
|
12425
12463
|
}
|
|
12426
12464
|
|
|
12427
12465
|
var alternate = current.alternate;
|
|
@@ -12822,7 +12860,7 @@ function requestEventTime() {
|
|
|
12822
12860
|
currentEventTime = now();
|
|
12823
12861
|
return currentEventTime;
|
|
12824
12862
|
}
|
|
12825
|
-
function requestUpdateLane(fiber
|
|
12863
|
+
function requestUpdateLane(fiber) {
|
|
12826
12864
|
// Special cases
|
|
12827
12865
|
var mode = fiber.mode;
|
|
12828
12866
|
|
|
@@ -12850,10 +12888,9 @@ function requestUpdateLane(fiber, suspenseConfig) {
|
|
|
12850
12888
|
currentEventWipLanes = workInProgressRootIncludedLanes;
|
|
12851
12889
|
}
|
|
12852
12890
|
|
|
12853
|
-
|
|
12854
|
-
|
|
12855
|
-
|
|
12856
|
-
// TODO: This will coerce numbers larger than 31 bits to 0.
|
|
12891
|
+
var isTransition = requestCurrentTransition() !== NoTransition;
|
|
12892
|
+
|
|
12893
|
+
if (isTransition) {
|
|
12857
12894
|
if (currentEventPendingLanes !== NoLanes) {
|
|
12858
12895
|
currentEventPendingLanes = mostRecentlyUpdatedRoot !== null ? mostRecentlyUpdatedRoot.pendingLanes : NoLanes;
|
|
12859
12896
|
}
|
|
@@ -13007,7 +13044,7 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
|
|
13007
13044
|
}
|
|
13008
13045
|
|
|
13009
13046
|
{
|
|
13010
|
-
if (alternate === null && (sourceFiber.
|
|
13047
|
+
if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
13011
13048
|
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
|
|
13012
13049
|
}
|
|
13013
13050
|
} // Walk the parent path to the root and update the child expiration time.
|
|
@@ -13024,7 +13061,7 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
|
|
13024
13061
|
alternate.childLanes = mergeLanes(alternate.childLanes, lane);
|
|
13025
13062
|
} else {
|
|
13026
13063
|
{
|
|
13027
|
-
if ((parent.
|
|
13064
|
+
if ((parent.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
13028
13065
|
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
|
|
13029
13066
|
}
|
|
13030
13067
|
}
|
|
@@ -13279,7 +13316,7 @@ function finishConcurrentRender(root, exitStatus, lanes) {
|
|
|
13279
13316
|
if (!shouldForceFlushFallbacksInDEV()) {
|
|
13280
13317
|
// This is not a transition, but we did trigger an avoided state.
|
|
13281
13318
|
// Schedule a placeholder to display after a short delay, using the Just
|
|
13282
|
-
//
|
|
13319
|
+
// Noticeable Difference.
|
|
13283
13320
|
// TODO: Is the JND optimization worth the added complexity? If this is
|
|
13284
13321
|
// the only reason we track the event time, then probably not.
|
|
13285
13322
|
// Consider removing.
|
|
@@ -13788,7 +13825,7 @@ function completeUnitOfWork(unitOfWork) {
|
|
|
13788
13825
|
var current = completedWork.alternate;
|
|
13789
13826
|
var returnFiber = completedWork.return; // Check if the work completed or if something threw.
|
|
13790
13827
|
|
|
13791
|
-
if ((completedWork.
|
|
13828
|
+
if ((completedWork.flags & Incomplete) === NoFlags) {
|
|
13792
13829
|
setCurrentFiber(completedWork);
|
|
13793
13830
|
var next = void 0;
|
|
13794
13831
|
|
|
@@ -13812,7 +13849,7 @@ function completeUnitOfWork(unitOfWork) {
|
|
|
13812
13849
|
resetChildLanes(completedWork);
|
|
13813
13850
|
|
|
13814
13851
|
if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete
|
|
13815
|
-
(returnFiber.
|
|
13852
|
+
(returnFiber.flags & Incomplete) === NoFlags) {
|
|
13816
13853
|
// Append all the effects of the subtree and this fiber onto the effect
|
|
13817
13854
|
// list of the parent. The completion order of the children affects the
|
|
13818
13855
|
// side-effect order.
|
|
@@ -13834,11 +13871,11 @@ function completeUnitOfWork(unitOfWork) {
|
|
|
13834
13871
|
// at the end.
|
|
13835
13872
|
|
|
13836
13873
|
|
|
13837
|
-
var
|
|
13874
|
+
var flags = completedWork.flags; // Skip both NoWork and PerformedWork tags when creating the effect
|
|
13838
13875
|
// list. PerformedWork effect is read by React DevTools but shouldn't be
|
|
13839
13876
|
// committed.
|
|
13840
13877
|
|
|
13841
|
-
if (
|
|
13878
|
+
if (flags > PerformedWork) {
|
|
13842
13879
|
if (returnFiber.lastEffect !== null) {
|
|
13843
13880
|
returnFiber.lastEffect.nextEffect = completedWork;
|
|
13844
13881
|
} else {
|
|
@@ -13860,7 +13897,7 @@ function completeUnitOfWork(unitOfWork) {
|
|
|
13860
13897
|
// back here again.
|
|
13861
13898
|
// Since we're restarting, remove anything that is not a host effect
|
|
13862
13899
|
// from the effect tag.
|
|
13863
|
-
_next.
|
|
13900
|
+
_next.flags &= HostEffectMask;
|
|
13864
13901
|
workInProgress = _next;
|
|
13865
13902
|
return;
|
|
13866
13903
|
}
|
|
@@ -13883,7 +13920,7 @@ function completeUnitOfWork(unitOfWork) {
|
|
|
13883
13920
|
if (returnFiber !== null) {
|
|
13884
13921
|
// Mark the parent fiber as incomplete and clear its effect list.
|
|
13885
13922
|
returnFiber.firstEffect = returnFiber.lastEffect = null;
|
|
13886
|
-
returnFiber.
|
|
13923
|
+
returnFiber.flags |= Incomplete;
|
|
13887
13924
|
}
|
|
13888
13925
|
}
|
|
13889
13926
|
|
|
@@ -14037,7 +14074,7 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14037
14074
|
|
|
14038
14075
|
var firstEffect;
|
|
14039
14076
|
|
|
14040
|
-
if (finishedWork.
|
|
14077
|
+
if (finishedWork.flags > PerformedWork) {
|
|
14041
14078
|
// A fiber's effect list consists only of its children, not itself. So if
|
|
14042
14079
|
// the root has an effect, we need to add it to the end of the list. The
|
|
14043
14080
|
// resulting list is the set that would belong to the root's parent, if it
|
|
@@ -14082,7 +14119,7 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14082
14119
|
}
|
|
14083
14120
|
|
|
14084
14121
|
var error = clearCaughtError();
|
|
14085
|
-
captureCommitPhaseError(nextEffect,
|
|
14122
|
+
captureCommitPhaseError(nextEffect, error);
|
|
14086
14123
|
nextEffect = nextEffect.nextEffect;
|
|
14087
14124
|
}
|
|
14088
14125
|
}
|
|
@@ -14113,7 +14150,7 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14113
14150
|
|
|
14114
14151
|
var _error = clearCaughtError();
|
|
14115
14152
|
|
|
14116
|
-
captureCommitPhaseError(nextEffect,
|
|
14153
|
+
captureCommitPhaseError(nextEffect, _error);
|
|
14117
14154
|
nextEffect = nextEffect.nextEffect;
|
|
14118
14155
|
}
|
|
14119
14156
|
}
|
|
@@ -14143,7 +14180,7 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14143
14180
|
|
|
14144
14181
|
var _error2 = clearCaughtError();
|
|
14145
14182
|
|
|
14146
|
-
captureCommitPhaseError(nextEffect,
|
|
14183
|
+
captureCommitPhaseError(nextEffect, _error2);
|
|
14147
14184
|
nextEffect = nextEffect.nextEffect;
|
|
14148
14185
|
}
|
|
14149
14186
|
}
|
|
@@ -14189,7 +14226,7 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
14189
14226
|
var nextNextEffect = nextEffect.nextEffect;
|
|
14190
14227
|
nextEffect.nextEffect = null;
|
|
14191
14228
|
|
|
14192
|
-
if (nextEffect.
|
|
14229
|
+
if (nextEffect.flags & Deletion) {
|
|
14193
14230
|
detachFiberAfterEffects(nextEffect);
|
|
14194
14231
|
}
|
|
14195
14232
|
|
|
@@ -14275,7 +14312,7 @@ function commitBeforeMutationEffects() {
|
|
|
14275
14312
|
var current = nextEffect.alternate;
|
|
14276
14313
|
|
|
14277
14314
|
if (!shouldFireAfterActiveInstanceBlur && focusedInstanceHandle !== null) {
|
|
14278
|
-
if ((nextEffect.
|
|
14315
|
+
if ((nextEffect.flags & Deletion) !== NoFlags) {
|
|
14279
14316
|
if (doesFiberContain(nextEffect, focusedInstanceHandle)) {
|
|
14280
14317
|
shouldFireAfterActiveInstanceBlur = true;
|
|
14281
14318
|
}
|
|
@@ -14287,15 +14324,15 @@ function commitBeforeMutationEffects() {
|
|
|
14287
14324
|
}
|
|
14288
14325
|
}
|
|
14289
14326
|
|
|
14290
|
-
var
|
|
14327
|
+
var flags = nextEffect.flags;
|
|
14291
14328
|
|
|
14292
|
-
if ((
|
|
14329
|
+
if ((flags & Snapshot) !== NoFlags) {
|
|
14293
14330
|
setCurrentFiber(nextEffect);
|
|
14294
14331
|
commitBeforeMutationLifeCycles(current, nextEffect);
|
|
14295
14332
|
resetCurrentFiber();
|
|
14296
14333
|
}
|
|
14297
14334
|
|
|
14298
|
-
if ((
|
|
14335
|
+
if ((flags & Passive) !== NoFlags) {
|
|
14299
14336
|
// If there are passive effects, schedule a callback to flush at
|
|
14300
14337
|
// the earliest opportunity.
|
|
14301
14338
|
if (!rootDoesHavePassiveEffects) {
|
|
@@ -14315,13 +14352,13 @@ function commitMutationEffects(root, renderPriorityLevel) {
|
|
|
14315
14352
|
// TODO: Should probably move the bulk of this function to commitWork.
|
|
14316
14353
|
while (nextEffect !== null) {
|
|
14317
14354
|
setCurrentFiber(nextEffect);
|
|
14318
|
-
var
|
|
14355
|
+
var flags = nextEffect.flags;
|
|
14319
14356
|
|
|
14320
|
-
if (
|
|
14357
|
+
if (flags & ContentReset) {
|
|
14321
14358
|
commitResetTextContent(nextEffect);
|
|
14322
14359
|
}
|
|
14323
14360
|
|
|
14324
|
-
if (
|
|
14361
|
+
if (flags & Ref) {
|
|
14325
14362
|
var current = nextEffect.alternate;
|
|
14326
14363
|
|
|
14327
14364
|
if (current !== null) {
|
|
@@ -14333,9 +14370,9 @@ function commitMutationEffects(root, renderPriorityLevel) {
|
|
|
14333
14370
|
// switch on that value.
|
|
14334
14371
|
|
|
14335
14372
|
|
|
14336
|
-
var
|
|
14373
|
+
var primaryFlags = flags & (Placement | Update | Deletion | Hydrating);
|
|
14337
14374
|
|
|
14338
|
-
switch (
|
|
14375
|
+
switch (primaryFlags) {
|
|
14339
14376
|
case Placement:
|
|
14340
14377
|
{
|
|
14341
14378
|
commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is
|
|
@@ -14343,7 +14380,7 @@ function commitMutationEffects(root, renderPriorityLevel) {
|
|
|
14343
14380
|
// TODO: findDOMNode doesn't rely on this any more but isMounted does
|
|
14344
14381
|
// and isMounted is deprecated anyway so we should be able to kill this.
|
|
14345
14382
|
|
|
14346
|
-
nextEffect.
|
|
14383
|
+
nextEffect.flags &= ~Placement;
|
|
14347
14384
|
break;
|
|
14348
14385
|
}
|
|
14349
14386
|
|
|
@@ -14353,7 +14390,7 @@ function commitMutationEffects(root, renderPriorityLevel) {
|
|
|
14353
14390
|
commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is
|
|
14354
14391
|
// inserted, before any life-cycles like componentDidMount gets called.
|
|
14355
14392
|
|
|
14356
|
-
nextEffect.
|
|
14393
|
+
nextEffect.flags &= ~Placement; // Update
|
|
14357
14394
|
|
|
14358
14395
|
var _current = nextEffect.alternate;
|
|
14359
14396
|
commitWork(_current, nextEffect);
|
|
@@ -14362,13 +14399,13 @@ function commitMutationEffects(root, renderPriorityLevel) {
|
|
|
14362
14399
|
|
|
14363
14400
|
case Hydrating:
|
|
14364
14401
|
{
|
|
14365
|
-
nextEffect.
|
|
14402
|
+
nextEffect.flags &= ~Hydrating;
|
|
14366
14403
|
break;
|
|
14367
14404
|
}
|
|
14368
14405
|
|
|
14369
14406
|
case HydratingAndUpdate:
|
|
14370
14407
|
{
|
|
14371
|
-
nextEffect.
|
|
14408
|
+
nextEffect.flags &= ~Hydrating; // Update
|
|
14372
14409
|
|
|
14373
14410
|
var _current2 = nextEffect.alternate;
|
|
14374
14411
|
commitWork(_current2, nextEffect);
|
|
@@ -14384,7 +14421,7 @@ function commitMutationEffects(root, renderPriorityLevel) {
|
|
|
14384
14421
|
|
|
14385
14422
|
case Deletion:
|
|
14386
14423
|
{
|
|
14387
|
-
commitDeletion(root, nextEffect
|
|
14424
|
+
commitDeletion(root, nextEffect);
|
|
14388
14425
|
break;
|
|
14389
14426
|
}
|
|
14390
14427
|
}
|
|
@@ -14399,15 +14436,15 @@ function commitLayoutEffects(root, committedLanes) {
|
|
|
14399
14436
|
|
|
14400
14437
|
while (nextEffect !== null) {
|
|
14401
14438
|
setCurrentFiber(nextEffect);
|
|
14402
|
-
var
|
|
14439
|
+
var flags = nextEffect.flags;
|
|
14403
14440
|
|
|
14404
|
-
if (
|
|
14441
|
+
if (flags & (Update | Callback)) {
|
|
14405
14442
|
var current = nextEffect.alternate;
|
|
14406
14443
|
commitLifeCycles(root, current, nextEffect);
|
|
14407
14444
|
}
|
|
14408
14445
|
|
|
14409
14446
|
{
|
|
14410
|
-
if (
|
|
14447
|
+
if (flags & Ref) {
|
|
14411
14448
|
commitAttachRef(nextEffect);
|
|
14412
14449
|
}
|
|
14413
14450
|
}
|
|
@@ -14445,11 +14482,11 @@ function enqueuePendingPassiveHookEffectUnmount(fiber, effect) {
|
|
|
14445
14482
|
pendingPassiveHookEffectsUnmount.push(effect, fiber);
|
|
14446
14483
|
|
|
14447
14484
|
{
|
|
14448
|
-
fiber.
|
|
14485
|
+
fiber.flags |= PassiveUnmountPendingDev;
|
|
14449
14486
|
var alternate = fiber.alternate;
|
|
14450
14487
|
|
|
14451
14488
|
if (alternate !== null) {
|
|
14452
|
-
alternate.
|
|
14489
|
+
alternate.flags |= PassiveUnmountPendingDev;
|
|
14453
14490
|
}
|
|
14454
14491
|
}
|
|
14455
14492
|
|
|
@@ -14507,11 +14544,11 @@ function flushPassiveEffectsImpl() {
|
|
|
14507
14544
|
_effect.destroy = undefined;
|
|
14508
14545
|
|
|
14509
14546
|
{
|
|
14510
|
-
fiber.
|
|
14547
|
+
fiber.flags &= ~PassiveUnmountPendingDev;
|
|
14511
14548
|
var alternate = fiber.alternate;
|
|
14512
14549
|
|
|
14513
14550
|
if (alternate !== null) {
|
|
14514
|
-
alternate.
|
|
14551
|
+
alternate.flags &= ~PassiveUnmountPendingDev;
|
|
14515
14552
|
}
|
|
14516
14553
|
}
|
|
14517
14554
|
|
|
@@ -14531,7 +14568,7 @@ function flushPassiveEffectsImpl() {
|
|
|
14531
14568
|
}
|
|
14532
14569
|
|
|
14533
14570
|
var error = clearCaughtError();
|
|
14534
|
-
captureCommitPhaseError(fiber,
|
|
14571
|
+
captureCommitPhaseError(fiber, error);
|
|
14535
14572
|
}
|
|
14536
14573
|
|
|
14537
14574
|
resetCurrentFiber();
|
|
@@ -14563,7 +14600,7 @@ function flushPassiveEffectsImpl() {
|
|
|
14563
14600
|
|
|
14564
14601
|
var _error4 = clearCaughtError();
|
|
14565
14602
|
|
|
14566
|
-
captureCommitPhaseError(_fiber,
|
|
14603
|
+
captureCommitPhaseError(_fiber, _error4);
|
|
14567
14604
|
}
|
|
14568
14605
|
|
|
14569
14606
|
resetCurrentFiber();
|
|
@@ -14580,7 +14617,7 @@ function flushPassiveEffectsImpl() {
|
|
|
14580
14617
|
|
|
14581
14618
|
effect.nextEffect = null;
|
|
14582
14619
|
|
|
14583
|
-
if (effect.
|
|
14620
|
+
if (effect.flags & Deletion) {
|
|
14584
14621
|
detachFiberAfterEffects(effect);
|
|
14585
14622
|
}
|
|
14586
14623
|
|
|
@@ -14638,7 +14675,7 @@ function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) {
|
|
|
14638
14675
|
}
|
|
14639
14676
|
}
|
|
14640
14677
|
|
|
14641
|
-
function captureCommitPhaseError(sourceFiber,
|
|
14678
|
+
function captureCommitPhaseError(sourceFiber, error) {
|
|
14642
14679
|
if (sourceFiber.tag === HostRoot) {
|
|
14643
14680
|
// Error was thrown at the root. There is no parent, so the root
|
|
14644
14681
|
// itself should capture it.
|
|
@@ -14646,11 +14683,7 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) {
|
|
|
14646
14683
|
return;
|
|
14647
14684
|
}
|
|
14648
14685
|
|
|
14649
|
-
var fiber =
|
|
14650
|
-
|
|
14651
|
-
{
|
|
14652
|
-
fiber = sourceFiber.return;
|
|
14653
|
-
}
|
|
14686
|
+
var fiber = sourceFiber.return;
|
|
14654
14687
|
|
|
14655
14688
|
while (fiber !== null) {
|
|
14656
14689
|
if (fiber.tag === HostRoot) {
|
|
@@ -14871,7 +14904,7 @@ function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
|
|
|
14871
14904
|
// we can assume that they would have prevented this update.
|
|
14872
14905
|
|
|
14873
14906
|
|
|
14874
|
-
if ((fiber.
|
|
14907
|
+
if ((fiber.flags & PassiveUnmountPendingDev) !== NoFlags) {
|
|
14875
14908
|
return;
|
|
14876
14909
|
} // We show the whole stack but dedupe on the top component's name because
|
|
14877
14910
|
// the problematic code almost always lies inside that component.
|
|
@@ -15169,26 +15202,10 @@ function finishPendingInteractions(root, committedLanes) {
|
|
|
15169
15202
|
});
|
|
15170
15203
|
}
|
|
15171
15204
|
} // `act` testing API
|
|
15172
|
-
//
|
|
15173
|
-
// TODO: This is mostly a copy-paste from the legacy `act`, which does not have
|
|
15174
|
-
// access to the same internals that we do here. Some trade offs in the
|
|
15175
|
-
// implementation no longer make sense.
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
var isFlushingAct = false;
|
|
15179
|
-
var isInsideThisAct = false; // TODO: Yes, this is confusing. See above comment. We'll refactor it.
|
|
15180
15205
|
|
|
15181
15206
|
function shouldForceFlushFallbacksInDEV() {
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
if (IsThisRendererActing.current) {
|
|
15185
|
-
// `isInsideAct` is only used by the reconciler implementation of `act`.
|
|
15186
|
-
// We don't want to flush suspense fallbacks until the end.
|
|
15187
|
-
return !isInsideThisAct;
|
|
15188
|
-
} // Flush callbacks at the end.
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
return isFlushingAct;
|
|
15207
|
+
// Never force flush in production. This function should get stripped out.
|
|
15208
|
+
return actingUpdatesScopeDepth > 0;
|
|
15192
15209
|
}
|
|
15193
15210
|
|
|
15194
15211
|
var flushMockScheduler = Scheduler$1.unstable_flushAllWithoutAsserting;
|
|
@@ -15197,19 +15214,12 @@ var isSchedulerMocked = typeof flushMockScheduler === 'function'; // Returns whe
|
|
|
15197
15214
|
|
|
15198
15215
|
function flushActWork() {
|
|
15199
15216
|
if (flushMockScheduler !== undefined) {
|
|
15200
|
-
var prevIsFlushing = isFlushingAct;
|
|
15201
|
-
isFlushingAct = true;
|
|
15202
15217
|
|
|
15203
15218
|
try {
|
|
15204
15219
|
return flushMockScheduler();
|
|
15205
15220
|
} finally {
|
|
15206
|
-
isFlushingAct = prevIsFlushing;
|
|
15207
15221
|
}
|
|
15208
15222
|
} else {
|
|
15209
|
-
// No mock scheduler available. However, the only type of pending work is
|
|
15210
|
-
// passive effects, which we control. So we can flush that.
|
|
15211
|
-
var _prevIsFlushing = isFlushingAct;
|
|
15212
|
-
isFlushingAct = true;
|
|
15213
15223
|
|
|
15214
15224
|
try {
|
|
15215
15225
|
var didFlushWork = false;
|
|
@@ -15220,7 +15230,6 @@ function flushActWork() {
|
|
|
15220
15230
|
|
|
15221
15231
|
return didFlushWork;
|
|
15222
15232
|
} finally {
|
|
15223
|
-
isFlushingAct = _prevIsFlushing;
|
|
15224
15233
|
}
|
|
15225
15234
|
}
|
|
15226
15235
|
}
|
|
@@ -15249,16 +15258,13 @@ function act(callback) {
|
|
|
15249
15258
|
actingUpdatesScopeDepth++;
|
|
15250
15259
|
var previousIsSomeRendererActing = IsSomeRendererActing.current;
|
|
15251
15260
|
var previousIsThisRendererActing = IsThisRendererActing.current;
|
|
15252
|
-
var previousIsInsideThisAct = isInsideThisAct;
|
|
15253
15261
|
IsSomeRendererActing.current = true;
|
|
15254
15262
|
IsThisRendererActing.current = true;
|
|
15255
|
-
isInsideThisAct = true;
|
|
15256
15263
|
|
|
15257
15264
|
function onDone() {
|
|
15258
15265
|
actingUpdatesScopeDepth--;
|
|
15259
15266
|
IsSomeRendererActing.current = previousIsSomeRendererActing;
|
|
15260
15267
|
IsThisRendererActing.current = previousIsThisRendererActing;
|
|
15261
|
-
isInsideThisAct = previousIsInsideThisAct;
|
|
15262
15268
|
|
|
15263
15269
|
{
|
|
15264
15270
|
if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
|
|
@@ -15799,7 +15805,7 @@ function FiberNode(tag, pendingProps, key, mode) {
|
|
|
15799
15805
|
this.dependencies = null;
|
|
15800
15806
|
this.mode = mode; // Effects
|
|
15801
15807
|
|
|
15802
|
-
this.
|
|
15808
|
+
this.flags = NoFlags;
|
|
15803
15809
|
this.nextEffect = null;
|
|
15804
15810
|
this.firstEffect = null;
|
|
15805
15811
|
this.lastEffect = null;
|
|
@@ -15921,7 +15927,7 @@ function createWorkInProgress(current, pendingProps) {
|
|
|
15921
15927
|
workInProgress.type = current.type; // We already have an alternate.
|
|
15922
15928
|
// Reset the effect tag.
|
|
15923
15929
|
|
|
15924
|
-
workInProgress.
|
|
15930
|
+
workInProgress.flags = NoFlags; // The effect list is no longer valid.
|
|
15925
15931
|
|
|
15926
15932
|
workInProgress.nextEffect = null;
|
|
15927
15933
|
workInProgress.firstEffect = null;
|
|
@@ -15992,7 +15998,7 @@ function resetWorkInProgress(workInProgress, renderLanes) {
|
|
|
15992
15998
|
// avoid doing another reconciliation.
|
|
15993
15999
|
// Reset the effect tag but keep any Placement tags, since that's something
|
|
15994
16000
|
// that child fiber is setting, not the reconciliation.
|
|
15995
|
-
workInProgress.
|
|
16001
|
+
workInProgress.flags &= Placement; // The effect list is no longer valid.
|
|
15996
16002
|
|
|
15997
16003
|
workInProgress.nextEffect = null;
|
|
15998
16004
|
workInProgress.firstEffect = null;
|
|
@@ -16408,8 +16414,7 @@ function updateContainer(element, container, parentComponent, callback) {
|
|
|
16408
16414
|
}
|
|
16409
16415
|
}
|
|
16410
16416
|
|
|
16411
|
-
var
|
|
16412
|
-
var lane = requestUpdateLane(current$1, suspenseConfig);
|
|
16417
|
+
var lane = requestUpdateLane(current$1);
|
|
16413
16418
|
|
|
16414
16419
|
var context = getContextForSubtree(parentComponent);
|
|
16415
16420
|
|
|
@@ -16473,29 +16478,96 @@ function shouldSuspend(fiber) {
|
|
|
16473
16478
|
return shouldSuspendImpl(fiber);
|
|
16474
16479
|
}
|
|
16475
16480
|
var overrideHookState = null;
|
|
16481
|
+
var overrideHookStateDeletePath = null;
|
|
16482
|
+
var overrideHookStateRenamePath = null;
|
|
16476
16483
|
var overrideProps = null;
|
|
16484
|
+
var overridePropsDeletePath = null;
|
|
16485
|
+
var overridePropsRenamePath = null;
|
|
16477
16486
|
var scheduleUpdate = null;
|
|
16478
16487
|
var setSuspenseHandler = null;
|
|
16479
16488
|
|
|
16480
16489
|
{
|
|
16481
|
-
var
|
|
16482
|
-
|
|
16490
|
+
var copyWithDeleteImpl = function (obj, path, index) {
|
|
16491
|
+
var key = path[index];
|
|
16492
|
+
var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
|
|
16493
|
+
|
|
16494
|
+
if (index + 1 === path.length) {
|
|
16495
|
+
if (Array.isArray(updated)) {
|
|
16496
|
+
updated.splice(key, 1);
|
|
16497
|
+
} else {
|
|
16498
|
+
delete updated[key];
|
|
16499
|
+
}
|
|
16500
|
+
|
|
16501
|
+
return updated;
|
|
16502
|
+
} // $FlowFixMe number or string is fine here
|
|
16503
|
+
|
|
16504
|
+
|
|
16505
|
+
updated[key] = copyWithDeleteImpl(obj[key], path, index + 1);
|
|
16506
|
+
return updated;
|
|
16507
|
+
};
|
|
16508
|
+
|
|
16509
|
+
var copyWithDelete = function (obj, path) {
|
|
16510
|
+
return copyWithDeleteImpl(obj, path, 0);
|
|
16511
|
+
};
|
|
16512
|
+
|
|
16513
|
+
var copyWithRenameImpl = function (obj, oldPath, newPath, index) {
|
|
16514
|
+
var oldKey = oldPath[index];
|
|
16515
|
+
var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
|
|
16516
|
+
|
|
16517
|
+
if (index + 1 === oldPath.length) {
|
|
16518
|
+
var newKey = newPath[index]; // $FlowFixMe number or string is fine here
|
|
16519
|
+
|
|
16520
|
+
updated[newKey] = updated[oldKey];
|
|
16521
|
+
|
|
16522
|
+
if (Array.isArray(updated)) {
|
|
16523
|
+
updated.splice(oldKey, 1);
|
|
16524
|
+
} else {
|
|
16525
|
+
delete updated[oldKey];
|
|
16526
|
+
}
|
|
16527
|
+
} else {
|
|
16528
|
+
// $FlowFixMe number or string is fine here
|
|
16529
|
+
updated[oldKey] = copyWithRenameImpl( // $FlowFixMe number or string is fine here
|
|
16530
|
+
obj[oldKey], oldPath, newPath, index + 1);
|
|
16531
|
+
}
|
|
16532
|
+
|
|
16533
|
+
return updated;
|
|
16534
|
+
};
|
|
16535
|
+
|
|
16536
|
+
var copyWithRename = function (obj, oldPath, newPath) {
|
|
16537
|
+
if (oldPath.length !== newPath.length) {
|
|
16538
|
+
warn('copyWithRename() expects paths of the same length');
|
|
16539
|
+
|
|
16540
|
+
return;
|
|
16541
|
+
} else {
|
|
16542
|
+
for (var i = 0; i < newPath.length - 1; i++) {
|
|
16543
|
+
if (oldPath[i] !== newPath[i]) {
|
|
16544
|
+
warn('copyWithRename() expects paths to be the same except for the deepest key');
|
|
16545
|
+
|
|
16546
|
+
return;
|
|
16547
|
+
}
|
|
16548
|
+
}
|
|
16549
|
+
}
|
|
16550
|
+
|
|
16551
|
+
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
16552
|
+
};
|
|
16553
|
+
|
|
16554
|
+
var copyWithSetImpl = function (obj, path, index, value) {
|
|
16555
|
+
if (index >= path.length) {
|
|
16483
16556
|
return value;
|
|
16484
16557
|
}
|
|
16485
16558
|
|
|
16486
|
-
var key = path[
|
|
16559
|
+
var key = path[index];
|
|
16487
16560
|
var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); // $FlowFixMe number or string is fine here
|
|
16488
16561
|
|
|
16489
|
-
updated[key] = copyWithSetImpl(obj[key], path,
|
|
16562
|
+
updated[key] = copyWithSetImpl(obj[key], path, index + 1, value);
|
|
16490
16563
|
return updated;
|
|
16491
16564
|
};
|
|
16492
16565
|
|
|
16493
16566
|
var copyWithSet = function (obj, path, value) {
|
|
16494
16567
|
return copyWithSetImpl(obj, path, 0, value);
|
|
16495
|
-
};
|
|
16496
|
-
|
|
16568
|
+
};
|
|
16497
16569
|
|
|
16498
|
-
|
|
16570
|
+
var findHook = function (fiber, id) {
|
|
16499
16571
|
// For now, the "id" of stateful hooks is just the stateful hook index.
|
|
16500
16572
|
// This may change in the future with e.g. nested hooks.
|
|
16501
16573
|
var currentHook = fiber.memoizedState;
|
|
@@ -16505,10 +16577,51 @@ var setSuspenseHandler = null;
|
|
|
16505
16577
|
id--;
|
|
16506
16578
|
}
|
|
16507
16579
|
|
|
16508
|
-
|
|
16509
|
-
|
|
16510
|
-
|
|
16511
|
-
|
|
16580
|
+
return currentHook;
|
|
16581
|
+
}; // Support DevTools editable values for useState and useReducer.
|
|
16582
|
+
|
|
16583
|
+
|
|
16584
|
+
overrideHookState = function (fiber, id, path, value) {
|
|
16585
|
+
var hook = findHook(fiber, id);
|
|
16586
|
+
|
|
16587
|
+
if (hook !== null) {
|
|
16588
|
+
var newState = copyWithSet(hook.memoizedState, path, value);
|
|
16589
|
+
hook.memoizedState = newState;
|
|
16590
|
+
hook.baseState = newState; // We aren't actually adding an update to the queue,
|
|
16591
|
+
// because there is no update we can add for useReducer hooks that won't trigger an error.
|
|
16592
|
+
// (There's no appropriate action type for DevTools overrides.)
|
|
16593
|
+
// As a result though, React will see the scheduled update as a noop and bailout.
|
|
16594
|
+
// Shallow cloning props works as a workaround for now to bypass the bailout check.
|
|
16595
|
+
|
|
16596
|
+
fiber.memoizedProps = _assign({}, fiber.memoizedProps);
|
|
16597
|
+
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
16598
|
+
}
|
|
16599
|
+
};
|
|
16600
|
+
|
|
16601
|
+
overrideHookStateDeletePath = function (fiber, id, path) {
|
|
16602
|
+
var hook = findHook(fiber, id);
|
|
16603
|
+
|
|
16604
|
+
if (hook !== null) {
|
|
16605
|
+
var newState = copyWithDelete(hook.memoizedState, path);
|
|
16606
|
+
hook.memoizedState = newState;
|
|
16607
|
+
hook.baseState = newState; // We aren't actually adding an update to the queue,
|
|
16608
|
+
// because there is no update we can add for useReducer hooks that won't trigger an error.
|
|
16609
|
+
// (There's no appropriate action type for DevTools overrides.)
|
|
16610
|
+
// As a result though, React will see the scheduled update as a noop and bailout.
|
|
16611
|
+
// Shallow cloning props works as a workaround for now to bypass the bailout check.
|
|
16612
|
+
|
|
16613
|
+
fiber.memoizedProps = _assign({}, fiber.memoizedProps);
|
|
16614
|
+
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
16615
|
+
}
|
|
16616
|
+
};
|
|
16617
|
+
|
|
16618
|
+
overrideHookStateRenamePath = function (fiber, id, oldPath, newPath) {
|
|
16619
|
+
var hook = findHook(fiber, id);
|
|
16620
|
+
|
|
16621
|
+
if (hook !== null) {
|
|
16622
|
+
var newState = copyWithRename(hook.memoizedState, oldPath, newPath);
|
|
16623
|
+
hook.memoizedState = newState;
|
|
16624
|
+
hook.baseState = newState; // We aren't actually adding an update to the queue,
|
|
16512
16625
|
// because there is no update we can add for useReducer hooks that won't trigger an error.
|
|
16513
16626
|
// (There's no appropriate action type for DevTools overrides.)
|
|
16514
16627
|
// As a result though, React will see the scheduled update as a noop and bailout.
|
|
@@ -16530,6 +16643,26 @@ var setSuspenseHandler = null;
|
|
|
16530
16643
|
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
16531
16644
|
};
|
|
16532
16645
|
|
|
16646
|
+
overridePropsDeletePath = function (fiber, path) {
|
|
16647
|
+
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path);
|
|
16648
|
+
|
|
16649
|
+
if (fiber.alternate) {
|
|
16650
|
+
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
16651
|
+
}
|
|
16652
|
+
|
|
16653
|
+
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
16654
|
+
};
|
|
16655
|
+
|
|
16656
|
+
overridePropsRenamePath = function (fiber, oldPath, newPath) {
|
|
16657
|
+
fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
|
|
16658
|
+
|
|
16659
|
+
if (fiber.alternate) {
|
|
16660
|
+
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
16661
|
+
}
|
|
16662
|
+
|
|
16663
|
+
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
16664
|
+
};
|
|
16665
|
+
|
|
16533
16666
|
scheduleUpdate = function (fiber) {
|
|
16534
16667
|
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
16535
16668
|
};
|
|
@@ -16566,7 +16699,11 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
16566
16699
|
rendererPackageName: devToolsConfig.rendererPackageName,
|
|
16567
16700
|
rendererConfig: devToolsConfig.rendererConfig,
|
|
16568
16701
|
overrideHookState: overrideHookState,
|
|
16702
|
+
overrideHookStateDeletePath: overrideHookStateDeletePath,
|
|
16703
|
+
overrideHookStateRenamePath: overrideHookStateRenamePath,
|
|
16569
16704
|
overrideProps: overrideProps,
|
|
16705
|
+
overridePropsDeletePath: overridePropsDeletePath,
|
|
16706
|
+
overridePropsRenamePath: overridePropsRenamePath,
|
|
16570
16707
|
setSuspenseHandler: setSuspenseHandler,
|
|
16571
16708
|
scheduleUpdate: scheduleUpdate,
|
|
16572
16709
|
currentDispatcherRef: ReactCurrentDispatcher,
|
|
@@ -16582,6 +16719,7 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
16582
16719
|
});
|
|
16583
16720
|
}
|
|
16584
16721
|
|
|
16722
|
+
var IsSomeRendererActing$1 = ReactSharedInternals.IsSomeRendererActing;
|
|
16585
16723
|
var defaultTestOptions = {
|
|
16586
16724
|
createNodeMock: function () {
|
|
16587
16725
|
return null;
|
|
@@ -17136,10 +17274,110 @@ injectIntoDevTools({
|
|
|
17136
17274
|
version: ReactVersion,
|
|
17137
17275
|
rendererPackageName: 'react-test-renderer'
|
|
17138
17276
|
});
|
|
17277
|
+
var actingUpdatesScopeDepth$1 = 0; // This version of `act` is only used by our tests. Unlike the public version
|
|
17278
|
+
// of `act`, it's designed to work identically in both production and
|
|
17279
|
+
// development. It may have slightly different behavior from the public
|
|
17280
|
+
// version, too, since our constraints in our test suite are not the same as
|
|
17281
|
+
// those of developers using React — we're testing React itself, as opposed to
|
|
17282
|
+
// building an app with React.
|
|
17283
|
+
// TODO: Migrate our tests to use ReactNoop. Although we would need to figure
|
|
17284
|
+
// out a solution for Relay, which has some Concurrent Mode tests.
|
|
17285
|
+
|
|
17286
|
+
function unstable_concurrentAct(scope) {
|
|
17287
|
+
if (Scheduler.unstable_flushAllWithoutAsserting === undefined) {
|
|
17288
|
+
throw Error('This version of `act` requires a special mock build of Scheduler.');
|
|
17289
|
+
}
|
|
17290
|
+
|
|
17291
|
+
if (setTimeout._isMockFunction !== true) {
|
|
17292
|
+
throw Error("This version of `act` requires Jest's timer mocks " + '(i.e. jest.useFakeTimers).');
|
|
17293
|
+
}
|
|
17294
|
+
|
|
17295
|
+
var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth$1;
|
|
17296
|
+
var previousIsSomeRendererActing = IsSomeRendererActing$1.current;
|
|
17297
|
+
var previousIsThisRendererActing = IsThisRendererActing.current;
|
|
17298
|
+
IsSomeRendererActing$1.current = true;
|
|
17299
|
+
IsThisRendererActing.current = true;
|
|
17300
|
+
actingUpdatesScopeDepth$1++;
|
|
17301
|
+
|
|
17302
|
+
var unwind = function () {
|
|
17303
|
+
actingUpdatesScopeDepth$1--;
|
|
17304
|
+
IsSomeRendererActing$1.current = previousIsSomeRendererActing;
|
|
17305
|
+
IsThisRendererActing.current = previousIsThisRendererActing;
|
|
17306
|
+
|
|
17307
|
+
{
|
|
17308
|
+
if (actingUpdatesScopeDepth$1 > previousActingUpdatesScopeDepth) {
|
|
17309
|
+
// if it's _less than_ previousActingUpdatesScopeDepth, then we can
|
|
17310
|
+
// assume the 'other' one has warned
|
|
17311
|
+
error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
|
17312
|
+
}
|
|
17313
|
+
}
|
|
17314
|
+
}; // TODO: This would be way simpler if 1) we required a promise to be
|
|
17315
|
+
// returned and 2) we could use async/await. Since it's only our used in
|
|
17316
|
+
// our test suite, we should be able to.
|
|
17317
|
+
|
|
17318
|
+
|
|
17319
|
+
try {
|
|
17320
|
+
var thenable = batchedUpdates(scope);
|
|
17321
|
+
|
|
17322
|
+
if (typeof thenable === 'object' && thenable !== null && typeof thenable.then === 'function') {
|
|
17323
|
+
return {
|
|
17324
|
+
then: function (resolve, reject) {
|
|
17325
|
+
thenable.then(function () {
|
|
17326
|
+
flushActWork$1(function () {
|
|
17327
|
+
unwind();
|
|
17328
|
+
resolve();
|
|
17329
|
+
}, function (error) {
|
|
17330
|
+
unwind();
|
|
17331
|
+
reject(error);
|
|
17332
|
+
});
|
|
17333
|
+
}, function (error) {
|
|
17334
|
+
unwind();
|
|
17335
|
+
reject(error);
|
|
17336
|
+
});
|
|
17337
|
+
}
|
|
17338
|
+
};
|
|
17339
|
+
} else {
|
|
17340
|
+
try {
|
|
17341
|
+
// TODO: Let's not support non-async scopes at all in our tests. Need to
|
|
17342
|
+
// migrate existing tests.
|
|
17343
|
+
var didFlushWork;
|
|
17344
|
+
|
|
17345
|
+
do {
|
|
17346
|
+
didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
|
|
17347
|
+
} while (didFlushWork);
|
|
17348
|
+
} finally {
|
|
17349
|
+
unwind();
|
|
17350
|
+
}
|
|
17351
|
+
}
|
|
17352
|
+
} catch (error) {
|
|
17353
|
+
unwind();
|
|
17354
|
+
throw error;
|
|
17355
|
+
}
|
|
17356
|
+
}
|
|
17357
|
+
|
|
17358
|
+
function flushActWork$1(resolve, reject) {
|
|
17359
|
+
// Flush suspended fallbacks
|
|
17360
|
+
// $FlowFixMe: Flow doesn't know about global Jest object
|
|
17361
|
+
jest.runOnlyPendingTimers();
|
|
17362
|
+
enqueueTask(function () {
|
|
17363
|
+
try {
|
|
17364
|
+
var didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
|
|
17365
|
+
|
|
17366
|
+
if (didFlushWork) {
|
|
17367
|
+
flushActWork$1(resolve, reject);
|
|
17368
|
+
} else {
|
|
17369
|
+
resolve();
|
|
17370
|
+
}
|
|
17371
|
+
} catch (error) {
|
|
17372
|
+
reject(error);
|
|
17373
|
+
}
|
|
17374
|
+
});
|
|
17375
|
+
}
|
|
17139
17376
|
|
|
17140
17377
|
exports._Scheduler = Scheduler;
|
|
17141
17378
|
exports.act = act;
|
|
17142
17379
|
exports.create = create;
|
|
17143
17380
|
exports.unstable_batchedUpdates = batchedUpdates;
|
|
17381
|
+
exports.unstable_concurrentAct = unstable_concurrentAct;
|
|
17144
17382
|
})();
|
|
17145
17383
|
}
|