react-dom 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.
- package/build-info.json +5 -5
- package/cjs/react-dom-server.browser.development.js +5 -5
- package/cjs/react-dom-server.browser.production.min.js +2 -2
- package/cjs/react-dom-server.node.development.js +5 -5
- package/cjs/react-dom-server.node.production.min.js +2 -2
- package/cjs/react-dom-test-utils.development.js +271 -138
- package/cjs/react-dom-test-utils.production.min.js +36 -33
- package/cjs/react-dom.development.js +747 -579
- package/cjs/react-dom.production.min.js +230 -231
- package/cjs/react-dom.profiling.min.js +258 -257
- package/package.json +3 -3
- package/umd/react-dom-server.browser.development.js +5 -5
- package/umd/react-dom-server.browser.production.min.js +3 -3
- package/umd/react-dom-test-utils.development.js +271 -138
- package/umd/react-dom-test-utils.production.min.js +27 -25
- package/umd/react-dom.development.js +747 -579
- package/umd/react-dom.production.min.js +232 -232
- package/umd/react-dom.profiling.min.js +241 -243
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React
|
|
1
|
+
/** @license React v17.0.1
|
|
2
2
|
* react-dom.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -116,6 +116,7 @@ var allNativeEvents = new Set();
|
|
|
116
116
|
* Mapping from registration name to event name
|
|
117
117
|
*/
|
|
118
118
|
|
|
119
|
+
|
|
119
120
|
var registrationNameDependencies = {};
|
|
120
121
|
/**
|
|
121
122
|
* Mapping from lowercase registration names to the properly cased version,
|
|
@@ -148,10 +149,8 @@ function registerDirectEvent(registrationName, dependencies) {
|
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
151
|
|
|
151
|
-
{
|
|
152
|
-
|
|
153
|
-
allNativeEvents.add(dependencies[i]);
|
|
154
|
-
}
|
|
152
|
+
for (var i = 0; i < dependencies.length; i++) {
|
|
153
|
+
allNativeEvents.add(dependencies[i]);
|
|
155
154
|
}
|
|
156
155
|
}
|
|
157
156
|
|
|
@@ -1183,7 +1182,7 @@ function getComponentName(type) {
|
|
|
1183
1182
|
return 'Portal';
|
|
1184
1183
|
|
|
1185
1184
|
case REACT_PROFILER_TYPE:
|
|
1186
|
-
return
|
|
1185
|
+
return 'Profiler';
|
|
1187
1186
|
|
|
1188
1187
|
case REACT_STRICT_MODE_TYPE:
|
|
1189
1188
|
return 'StrictMode';
|
|
@@ -4130,8 +4129,8 @@ function set(key, value) {
|
|
|
4130
4129
|
}
|
|
4131
4130
|
|
|
4132
4131
|
// Don't change these two values. They're used by React Dev Tools.
|
|
4133
|
-
var
|
|
4134
|
-
/*
|
|
4132
|
+
var NoFlags =
|
|
4133
|
+
/* */
|
|
4135
4134
|
0;
|
|
4136
4135
|
var PerformedWork =
|
|
4137
4136
|
/* */
|
|
@@ -4209,7 +4208,7 @@ function getNearestMountedFiber(fiber) {
|
|
|
4209
4208
|
do {
|
|
4210
4209
|
node = nextNode;
|
|
4211
4210
|
|
|
4212
|
-
if ((node.
|
|
4211
|
+
if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
4213
4212
|
// This is an insertion or in-progress hydration. The nearest possible
|
|
4214
4213
|
// mounted fiber is the parent but we need to continue to figure out
|
|
4215
4214
|
// if that one is still mounted.
|
|
@@ -5489,7 +5488,21 @@ function computeExpirationTime(lane, currentTime) {
|
|
|
5489
5488
|
|
|
5490
5489
|
if (priority >= InputContinuousLanePriority) {
|
|
5491
5490
|
// User interactions should expire slightly more quickly.
|
|
5492
|
-
|
|
5491
|
+
//
|
|
5492
|
+
// NOTE: This is set to the corresponding constant as in Scheduler.js. When
|
|
5493
|
+
// we made it larger, a product metric in www regressed, suggesting there's
|
|
5494
|
+
// a user interaction that's being starved by a series of synchronous
|
|
5495
|
+
// updates. If that theory is correct, the proper solution is to fix the
|
|
5496
|
+
// starvation. However, this scenario supports the idea that expiration
|
|
5497
|
+
// times are an important safeguard when starvation does happen.
|
|
5498
|
+
//
|
|
5499
|
+
// Also note that, in the case of user input specifically, this will soon no
|
|
5500
|
+
// longer be an issue because we plan to make user input synchronous by
|
|
5501
|
+
// default (until you enter `startTransition`, of course.)
|
|
5502
|
+
//
|
|
5503
|
+
// If weren't planning to make these updates synchronous soon anyway, I
|
|
5504
|
+
// would probably make this number a configurable parameter.
|
|
5505
|
+
return currentTime + 250;
|
|
5493
5506
|
} else if (priority >= TransitionPriority) {
|
|
5494
5507
|
return currentTime + 5000;
|
|
5495
5508
|
} else {
|
|
@@ -5724,7 +5737,15 @@ function higherPriorityLane(a, b) {
|
|
|
5724
5737
|
return a !== NoLane && a < b ? a : b;
|
|
5725
5738
|
}
|
|
5726
5739
|
function createLaneMap(initial) {
|
|
5727
|
-
|
|
5740
|
+
// Intentionally pushing one by one.
|
|
5741
|
+
// https://v8.dev/blog/elements-kinds#avoid-creating-holes
|
|
5742
|
+
var laneMap = [];
|
|
5743
|
+
|
|
5744
|
+
for (var i = 0; i < TotalLanes; i++) {
|
|
5745
|
+
laneMap.push(initial);
|
|
5746
|
+
}
|
|
5747
|
+
|
|
5748
|
+
return laneMap;
|
|
5728
5749
|
}
|
|
5729
5750
|
function markRootUpdated(root, updateLane, eventTime) {
|
|
5730
5751
|
root.pendingLanes |= updateLane; // TODO: Theoretically, any update to any lane can unblock any other lane. But
|
|
@@ -5838,8 +5859,8 @@ function setEnabled(enabled) {
|
|
|
5838
5859
|
function isEnabled() {
|
|
5839
5860
|
return _enabled;
|
|
5840
5861
|
}
|
|
5841
|
-
function createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags
|
|
5842
|
-
var eventPriority =
|
|
5862
|
+
function createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags) {
|
|
5863
|
+
var eventPriority = getEventPriorityForPluginSystem(domEventName);
|
|
5843
5864
|
var listenerWrapper;
|
|
5844
5865
|
|
|
5845
5866
|
switch (eventPriority) {
|
|
@@ -6007,9 +6028,6 @@ function addEventBubbleListenerWithPassiveFlag(target, eventType, listener, pass
|
|
|
6007
6028
|
});
|
|
6008
6029
|
return listener;
|
|
6009
6030
|
}
|
|
6010
|
-
function removeEventListener(target, eventType, listener, capture) {
|
|
6011
|
-
target.removeEventListener(eventType, listener, capture);
|
|
6012
|
-
}
|
|
6013
6031
|
|
|
6014
6032
|
/**
|
|
6015
6033
|
* These variables store information about text content of a target node,
|
|
@@ -6113,136 +6131,144 @@ function getEventCharCode(nativeEvent) {
|
|
|
6113
6131
|
return 0;
|
|
6114
6132
|
}
|
|
6115
6133
|
|
|
6116
|
-
/**
|
|
6117
|
-
* @interface Event
|
|
6118
|
-
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
6119
|
-
*/
|
|
6120
|
-
var EventInterface = {
|
|
6121
|
-
eventPhase: 0,
|
|
6122
|
-
bubbles: 0,
|
|
6123
|
-
cancelable: 0,
|
|
6124
|
-
timeStamp: function (event) {
|
|
6125
|
-
return event.timeStamp || Date.now();
|
|
6126
|
-
},
|
|
6127
|
-
defaultPrevented: 0,
|
|
6128
|
-
isTrusted: 0
|
|
6129
|
-
};
|
|
6130
|
-
|
|
6131
6134
|
function functionThatReturnsTrue() {
|
|
6132
6135
|
return true;
|
|
6133
6136
|
}
|
|
6134
6137
|
|
|
6135
6138
|
function functionThatReturnsFalse() {
|
|
6136
6139
|
return false;
|
|
6137
|
-
}
|
|
6138
|
-
|
|
6139
|
-
* Synthetic events are dispatched by event plugins, typically in response to a
|
|
6140
|
-
* top-level event delegation handler.
|
|
6141
|
-
*
|
|
6142
|
-
* These systems should generally use pooling to reduce the frequency of garbage
|
|
6143
|
-
* collection. The system should check `isPersistent` to determine whether the
|
|
6144
|
-
* event should be released into the pool after being dispatched. Users that
|
|
6145
|
-
* need a persisted event should invoke `persist`.
|
|
6146
|
-
*
|
|
6147
|
-
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by
|
|
6148
|
-
* normalizing browser quirks. Subclasses do not necessarily have to implement a
|
|
6149
|
-
* DOM interface; custom application-specific events can also subclass this.
|
|
6150
|
-
*/
|
|
6140
|
+
} // This is intentionally a factory so that we have different returned constructors.
|
|
6141
|
+
// If we had a single constructor, it would be megamorphic and engines would deopt.
|
|
6151
6142
|
|
|
6152
6143
|
|
|
6153
|
-
function
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6144
|
+
function createSyntheticEvent(Interface) {
|
|
6145
|
+
/**
|
|
6146
|
+
* Synthetic events are dispatched by event plugins, typically in response to a
|
|
6147
|
+
* top-level event delegation handler.
|
|
6148
|
+
*
|
|
6149
|
+
* These systems should generally use pooling to reduce the frequency of garbage
|
|
6150
|
+
* collection. The system should check `isPersistent` to determine whether the
|
|
6151
|
+
* event should be released into the pool after being dispatched. Users that
|
|
6152
|
+
* need a persisted event should invoke `persist`.
|
|
6153
|
+
*
|
|
6154
|
+
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by
|
|
6155
|
+
* normalizing browser quirks. Subclasses do not necessarily have to implement a
|
|
6156
|
+
* DOM interface; custom application-specific events can also subclass this.
|
|
6157
|
+
*/
|
|
6158
|
+
function SyntheticBaseEvent(reactName, reactEventType, targetInst, nativeEvent, nativeEventTarget) {
|
|
6159
|
+
this._reactName = reactName;
|
|
6160
|
+
this._targetInst = targetInst;
|
|
6161
|
+
this.type = reactEventType;
|
|
6162
|
+
this.nativeEvent = nativeEvent;
|
|
6163
|
+
this.target = nativeEventTarget;
|
|
6164
|
+
this.currentTarget = null;
|
|
6165
|
+
|
|
6166
|
+
for (var _propName in Interface) {
|
|
6167
|
+
if (!Interface.hasOwnProperty(_propName)) {
|
|
6168
|
+
continue;
|
|
6169
|
+
}
|
|
6161
6170
|
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6171
|
+
var normalize = Interface[_propName];
|
|
6172
|
+
|
|
6173
|
+
if (normalize) {
|
|
6174
|
+
this[_propName] = normalize(nativeEvent);
|
|
6175
|
+
} else {
|
|
6176
|
+
this[_propName] = nativeEvent[_propName];
|
|
6177
|
+
}
|
|
6165
6178
|
}
|
|
6166
6179
|
|
|
6167
|
-
var
|
|
6180
|
+
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
|
|
6168
6181
|
|
|
6169
|
-
if (
|
|
6170
|
-
this
|
|
6182
|
+
if (defaultPrevented) {
|
|
6183
|
+
this.isDefaultPrevented = functionThatReturnsTrue;
|
|
6171
6184
|
} else {
|
|
6172
|
-
this
|
|
6185
|
+
this.isDefaultPrevented = functionThatReturnsFalse;
|
|
6173
6186
|
}
|
|
6187
|
+
|
|
6188
|
+
this.isPropagationStopped = functionThatReturnsFalse;
|
|
6189
|
+
return this;
|
|
6174
6190
|
}
|
|
6175
6191
|
|
|
6176
|
-
|
|
6192
|
+
_assign(SyntheticBaseEvent.prototype, {
|
|
6193
|
+
preventDefault: function () {
|
|
6194
|
+
this.defaultPrevented = true;
|
|
6195
|
+
var event = this.nativeEvent;
|
|
6177
6196
|
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
this.isDefaultPrevented = functionThatReturnsFalse;
|
|
6182
|
-
}
|
|
6197
|
+
if (!event) {
|
|
6198
|
+
return;
|
|
6199
|
+
}
|
|
6183
6200
|
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
}
|
|
6201
|
+
if (event.preventDefault) {
|
|
6202
|
+
event.preventDefault(); // $FlowFixMe - flow is not aware of `unknown` in IE
|
|
6203
|
+
} else if (typeof event.returnValue !== 'unknown') {
|
|
6204
|
+
event.returnValue = false;
|
|
6205
|
+
}
|
|
6187
6206
|
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6207
|
+
this.isDefaultPrevented = functionThatReturnsTrue;
|
|
6208
|
+
},
|
|
6209
|
+
stopPropagation: function () {
|
|
6210
|
+
var event = this.nativeEvent;
|
|
6192
6211
|
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6212
|
+
if (!event) {
|
|
6213
|
+
return;
|
|
6214
|
+
}
|
|
6196
6215
|
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6216
|
+
if (event.stopPropagation) {
|
|
6217
|
+
event.stopPropagation(); // $FlowFixMe - flow is not aware of `unknown` in IE
|
|
6218
|
+
} else if (typeof event.cancelBubble !== 'unknown') {
|
|
6219
|
+
// The ChangeEventPlugin registers a "propertychange" event for
|
|
6220
|
+
// IE. This event does not support bubbling or cancelling, and
|
|
6221
|
+
// any references to cancelBubble throw "Member not found". A
|
|
6222
|
+
// typeof check of "unknown" circumvents this issue (and is also
|
|
6223
|
+
// IE specific).
|
|
6224
|
+
event.cancelBubble = true;
|
|
6225
|
+
}
|
|
6202
6226
|
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
stopPropagation: function () {
|
|
6206
|
-
var event = this.nativeEvent;
|
|
6227
|
+
this.isPropagationStopped = functionThatReturnsTrue;
|
|
6228
|
+
},
|
|
6207
6229
|
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6230
|
+
/**
|
|
6231
|
+
* We release all dispatched `SyntheticEvent`s after each event loop, adding
|
|
6232
|
+
* them back into the pool. This allows a way to hold onto a reference that
|
|
6233
|
+
* won't be added back into the pool.
|
|
6234
|
+
*/
|
|
6235
|
+
persist: function () {// Modern event system doesn't use pooling.
|
|
6236
|
+
},
|
|
6211
6237
|
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
// IE specific).
|
|
6220
|
-
event.cancelBubble = true;
|
|
6221
|
-
}
|
|
6238
|
+
/**
|
|
6239
|
+
* Checks if this event should be released back into the pool.
|
|
6240
|
+
*
|
|
6241
|
+
* @return {boolean} True if this should not be released, false otherwise.
|
|
6242
|
+
*/
|
|
6243
|
+
isPersistent: functionThatReturnsTrue
|
|
6244
|
+
});
|
|
6222
6245
|
|
|
6223
|
-
|
|
6224
|
-
|
|
6246
|
+
return SyntheticBaseEvent;
|
|
6247
|
+
}
|
|
6248
|
+
/**
|
|
6249
|
+
* @interface Event
|
|
6250
|
+
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
6251
|
+
*/
|
|
6225
6252
|
|
|
6226
|
-
/**
|
|
6227
|
-
* We release all dispatched `SyntheticEvent`s after each event loop, adding
|
|
6228
|
-
* them back into the pool. This allows a way to hold onto a reference that
|
|
6229
|
-
* won't be added back into the pool.
|
|
6230
|
-
*/
|
|
6231
|
-
persist: function () {// Modern event system doesn't use pooling.
|
|
6232
|
-
},
|
|
6233
6253
|
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
}
|
|
6254
|
+
var EventInterface = {
|
|
6255
|
+
eventPhase: 0,
|
|
6256
|
+
bubbles: 0,
|
|
6257
|
+
cancelable: 0,
|
|
6258
|
+
timeStamp: function (event) {
|
|
6259
|
+
return event.timeStamp || Date.now();
|
|
6260
|
+
},
|
|
6261
|
+
defaultPrevented: 0,
|
|
6262
|
+
isTrusted: 0
|
|
6263
|
+
};
|
|
6264
|
+
var SyntheticEvent = createSyntheticEvent(EventInterface);
|
|
6241
6265
|
|
|
6242
6266
|
var UIEventInterface = _assign({}, EventInterface, {
|
|
6243
6267
|
view: 0,
|
|
6244
6268
|
detail: 0
|
|
6245
6269
|
});
|
|
6270
|
+
|
|
6271
|
+
var SyntheticUIEvent = createSyntheticEvent(UIEventInterface);
|
|
6246
6272
|
var lastMovementX;
|
|
6247
6273
|
var lastMovementY;
|
|
6248
6274
|
var lastMouseEvent;
|
|
@@ -6303,6 +6329,8 @@ var MouseEventInterface = _assign({}, UIEventInterface, {
|
|
|
6303
6329
|
return lastMovementY;
|
|
6304
6330
|
}
|
|
6305
6331
|
});
|
|
6332
|
+
|
|
6333
|
+
var SyntheticMouseEvent = createSyntheticEvent(MouseEventInterface);
|
|
6306
6334
|
/**
|
|
6307
6335
|
* @interface DragEvent
|
|
6308
6336
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
@@ -6311,6 +6339,8 @@ var MouseEventInterface = _assign({}, UIEventInterface, {
|
|
|
6311
6339
|
var DragEventInterface = _assign({}, MouseEventInterface, {
|
|
6312
6340
|
dataTransfer: 0
|
|
6313
6341
|
});
|
|
6342
|
+
|
|
6343
|
+
var SyntheticDragEvent = createSyntheticEvent(DragEventInterface);
|
|
6314
6344
|
/**
|
|
6315
6345
|
* @interface FocusEvent
|
|
6316
6346
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
@@ -6319,6 +6349,8 @@ var DragEventInterface = _assign({}, MouseEventInterface, {
|
|
|
6319
6349
|
var FocusEventInterface = _assign({}, UIEventInterface, {
|
|
6320
6350
|
relatedTarget: 0
|
|
6321
6351
|
});
|
|
6352
|
+
|
|
6353
|
+
var SyntheticFocusEvent = createSyntheticEvent(FocusEventInterface);
|
|
6322
6354
|
/**
|
|
6323
6355
|
* @interface Event
|
|
6324
6356
|
* @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
|
|
@@ -6330,6 +6362,8 @@ var AnimationEventInterface = _assign({}, EventInterface, {
|
|
|
6330
6362
|
elapsedTime: 0,
|
|
6331
6363
|
pseudoElement: 0
|
|
6332
6364
|
});
|
|
6365
|
+
|
|
6366
|
+
var SyntheticAnimationEvent = createSyntheticEvent(AnimationEventInterface);
|
|
6333
6367
|
/**
|
|
6334
6368
|
* @interface Event
|
|
6335
6369
|
* @see http://www.w3.org/TR/clipboard-apis/
|
|
@@ -6340,6 +6374,8 @@ var ClipboardEventInterface = _assign({}, EventInterface, {
|
|
|
6340
6374
|
return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
|
|
6341
6375
|
}
|
|
6342
6376
|
});
|
|
6377
|
+
|
|
6378
|
+
var SyntheticClipboardEvent = createSyntheticEvent(ClipboardEventInterface);
|
|
6343
6379
|
/**
|
|
6344
6380
|
* @interface Event
|
|
6345
6381
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
|
|
@@ -6348,6 +6384,8 @@ var ClipboardEventInterface = _assign({}, EventInterface, {
|
|
|
6348
6384
|
var CompositionEventInterface = _assign({}, EventInterface, {
|
|
6349
6385
|
data: 0
|
|
6350
6386
|
});
|
|
6387
|
+
|
|
6388
|
+
var SyntheticCompositionEvent = createSyntheticEvent(CompositionEventInterface);
|
|
6351
6389
|
/**
|
|
6352
6390
|
* @interface Event
|
|
6353
6391
|
* @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
|
|
@@ -6355,7 +6393,7 @@ var CompositionEventInterface = _assign({}, EventInterface, {
|
|
|
6355
6393
|
*/
|
|
6356
6394
|
// Happens to share the same list for now.
|
|
6357
6395
|
|
|
6358
|
-
var
|
|
6396
|
+
var SyntheticInputEvent = SyntheticCompositionEvent;
|
|
6359
6397
|
/**
|
|
6360
6398
|
* Normalization of deprecated HTML5 `key` values
|
|
6361
6399
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
|
|
@@ -6539,6 +6577,8 @@ var KeyboardEventInterface = _assign({}, UIEventInterface, {
|
|
|
6539
6577
|
return 0;
|
|
6540
6578
|
}
|
|
6541
6579
|
});
|
|
6580
|
+
|
|
6581
|
+
var SyntheticKeyboardEvent = createSyntheticEvent(KeyboardEventInterface);
|
|
6542
6582
|
/**
|
|
6543
6583
|
* @interface PointerEvent
|
|
6544
6584
|
* @see http://www.w3.org/TR/pointerevents/
|
|
@@ -6556,6 +6596,8 @@ var PointerEventInterface = _assign({}, MouseEventInterface, {
|
|
|
6556
6596
|
pointerType: 0,
|
|
6557
6597
|
isPrimary: 0
|
|
6558
6598
|
});
|
|
6599
|
+
|
|
6600
|
+
var SyntheticPointerEvent = createSyntheticEvent(PointerEventInterface);
|
|
6559
6601
|
/**
|
|
6560
6602
|
* @interface TouchEvent
|
|
6561
6603
|
* @see http://www.w3.org/TR/touch-events/
|
|
@@ -6571,6 +6613,8 @@ var TouchEventInterface = _assign({}, UIEventInterface, {
|
|
|
6571
6613
|
shiftKey: 0,
|
|
6572
6614
|
getModifierState: getEventModifierState
|
|
6573
6615
|
});
|
|
6616
|
+
|
|
6617
|
+
var SyntheticTouchEvent = createSyntheticEvent(TouchEventInterface);
|
|
6574
6618
|
/**
|
|
6575
6619
|
* @interface Event
|
|
6576
6620
|
* @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
|
|
@@ -6582,6 +6626,8 @@ var TransitionEventInterface = _assign({}, EventInterface, {
|
|
|
6582
6626
|
elapsedTime: 0,
|
|
6583
6627
|
pseudoElement: 0
|
|
6584
6628
|
});
|
|
6629
|
+
|
|
6630
|
+
var SyntheticTransitionEvent = createSyntheticEvent(TransitionEventInterface);
|
|
6585
6631
|
/**
|
|
6586
6632
|
* @interface WheelEvent
|
|
6587
6633
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
@@ -6605,6 +6651,8 @@ var WheelEventInterface = _assign({}, MouseEventInterface, {
|
|
|
6605
6651
|
deltaMode: 0
|
|
6606
6652
|
});
|
|
6607
6653
|
|
|
6654
|
+
var SyntheticWheelEvent = createSyntheticEvent(WheelEventInterface);
|
|
6655
|
+
|
|
6608
6656
|
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
|
|
6609
6657
|
|
|
6610
6658
|
var START_KEYCODE = 229;
|
|
@@ -6769,18 +6817,25 @@ function extractCompositionEvent(dispatchQueue, domEventName, targetInst, native
|
|
|
6769
6817
|
}
|
|
6770
6818
|
}
|
|
6771
6819
|
|
|
6772
|
-
var
|
|
6773
|
-
accumulateTwoPhaseListeners(targetInst, dispatchQueue, event);
|
|
6820
|
+
var listeners = accumulateTwoPhaseListeners(targetInst, eventType);
|
|
6774
6821
|
|
|
6775
|
-
if (
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6822
|
+
if (listeners.length > 0) {
|
|
6823
|
+
var event = new SyntheticCompositionEvent(eventType, domEventName, null, nativeEvent, nativeEventTarget);
|
|
6824
|
+
dispatchQueue.push({
|
|
6825
|
+
event: event,
|
|
6826
|
+
listeners: listeners
|
|
6827
|
+
});
|
|
6781
6828
|
|
|
6782
|
-
if (
|
|
6783
|
-
|
|
6829
|
+
if (fallbackData) {
|
|
6830
|
+
// Inject data generated from fallback path into the synthetic event.
|
|
6831
|
+
// This matches the property of native CompositionEventInterface.
|
|
6832
|
+
event.data = fallbackData;
|
|
6833
|
+
} else {
|
|
6834
|
+
var customData = getDataFromCustomEvent(nativeEvent);
|
|
6835
|
+
|
|
6836
|
+
if (customData !== null) {
|
|
6837
|
+
event.data = customData;
|
|
6838
|
+
}
|
|
6784
6839
|
}
|
|
6785
6840
|
}
|
|
6786
6841
|
}
|
|
@@ -6922,9 +6977,16 @@ function extractBeforeInputEvent(dispatchQueue, domEventName, targetInst, native
|
|
|
6922
6977
|
return null;
|
|
6923
6978
|
}
|
|
6924
6979
|
|
|
6925
|
-
var
|
|
6926
|
-
|
|
6927
|
-
|
|
6980
|
+
var listeners = accumulateTwoPhaseListeners(targetInst, 'onBeforeInput');
|
|
6981
|
+
|
|
6982
|
+
if (listeners.length > 0) {
|
|
6983
|
+
var event = new SyntheticInputEvent('onBeforeInput', 'beforeinput', null, nativeEvent, nativeEventTarget);
|
|
6984
|
+
dispatchQueue.push({
|
|
6985
|
+
event: event,
|
|
6986
|
+
listeners: listeners
|
|
6987
|
+
});
|
|
6988
|
+
event.data = chars;
|
|
6989
|
+
}
|
|
6928
6990
|
}
|
|
6929
6991
|
/**
|
|
6930
6992
|
* Create an `onBeforeInput` event to match
|
|
@@ -7022,10 +7084,17 @@ function registerEvents$1() {
|
|
|
7022
7084
|
}
|
|
7023
7085
|
|
|
7024
7086
|
function createAndAccumulateChangeEvent(dispatchQueue, inst, nativeEvent, target) {
|
|
7025
|
-
|
|
7026
|
-
|
|
7087
|
+
// Flag this event loop as needing state restore.
|
|
7027
7088
|
enqueueStateRestore(target);
|
|
7028
|
-
accumulateTwoPhaseListeners(inst,
|
|
7089
|
+
var listeners = accumulateTwoPhaseListeners(inst, 'onChange');
|
|
7090
|
+
|
|
7091
|
+
if (listeners.length > 0) {
|
|
7092
|
+
var event = new SyntheticEvent('onChange', 'change', null, nativeEvent, target);
|
|
7093
|
+
dispatchQueue.push({
|
|
7094
|
+
event: event,
|
|
7095
|
+
listeners: listeners
|
|
7096
|
+
});
|
|
7097
|
+
}
|
|
7029
7098
|
}
|
|
7030
7099
|
/**
|
|
7031
7100
|
* For IE shims
|
|
@@ -7335,13 +7404,13 @@ function extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, n
|
|
|
7335
7404
|
return;
|
|
7336
7405
|
}
|
|
7337
7406
|
|
|
7338
|
-
var
|
|
7407
|
+
var SyntheticEventCtor = SyntheticMouseEvent;
|
|
7339
7408
|
var leaveEventType = 'onMouseLeave';
|
|
7340
7409
|
var enterEventType = 'onMouseEnter';
|
|
7341
7410
|
var eventTypePrefix = 'mouse';
|
|
7342
7411
|
|
|
7343
7412
|
if (domEventName === 'pointerout' || domEventName === 'pointerover') {
|
|
7344
|
-
|
|
7413
|
+
SyntheticEventCtor = SyntheticPointerEvent;
|
|
7345
7414
|
leaveEventType = 'onPointerLeave';
|
|
7346
7415
|
enterEventType = 'onPointerEnter';
|
|
7347
7416
|
eventTypePrefix = 'pointer';
|
|
@@ -7349,7 +7418,7 @@ function extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, n
|
|
|
7349
7418
|
|
|
7350
7419
|
var fromNode = from == null ? win : getNodeFromInstance(from);
|
|
7351
7420
|
var toNode = to == null ? win : getNodeFromInstance(to);
|
|
7352
|
-
var leave = new
|
|
7421
|
+
var leave = new SyntheticEventCtor(leaveEventType, eventTypePrefix + 'leave', from, nativeEvent, nativeEventTarget);
|
|
7353
7422
|
leave.target = fromNode;
|
|
7354
7423
|
leave.relatedTarget = toNode;
|
|
7355
7424
|
var enter = null; // We should only process this nativeEvent if we are processing
|
|
@@ -7358,7 +7427,7 @@ function extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, n
|
|
|
7358
7427
|
var nativeTargetInst = getClosestInstanceFromNode(nativeEventTarget);
|
|
7359
7428
|
|
|
7360
7429
|
if (nativeTargetInst === targetInst) {
|
|
7361
|
-
var enterEvent = new
|
|
7430
|
+
var enterEvent = new SyntheticEventCtor(enterEventType, eventTypePrefix + 'enter', to, nativeEvent, nativeEventTarget);
|
|
7362
7431
|
enterEvent.target = toNode;
|
|
7363
7432
|
enterEvent.relatedTarget = fromNode;
|
|
7364
7433
|
enter = enterEvent;
|
|
@@ -7891,9 +7960,16 @@ function constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget) {
|
|
|
7891
7960
|
|
|
7892
7961
|
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
|
|
7893
7962
|
lastSelection = currentSelection;
|
|
7894
|
-
var
|
|
7895
|
-
|
|
7896
|
-
|
|
7963
|
+
var listeners = accumulateTwoPhaseListeners(activeElementInst$1, 'onSelect');
|
|
7964
|
+
|
|
7965
|
+
if (listeners.length > 0) {
|
|
7966
|
+
var event = new SyntheticEvent('onSelect', 'select', null, nativeEvent, nativeEventTarget);
|
|
7967
|
+
dispatchQueue.push({
|
|
7968
|
+
event: event,
|
|
7969
|
+
listeners: listeners
|
|
7970
|
+
});
|
|
7971
|
+
event.target = activeElement$1;
|
|
7972
|
+
}
|
|
7897
7973
|
}
|
|
7898
7974
|
}
|
|
7899
7975
|
/**
|
|
@@ -7975,7 +8051,7 @@ function extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, n
|
|
|
7975
8051
|
return;
|
|
7976
8052
|
}
|
|
7977
8053
|
|
|
7978
|
-
var
|
|
8054
|
+
var SyntheticEventCtor = SyntheticEvent;
|
|
7979
8055
|
var reactEventType = domEventName;
|
|
7980
8056
|
|
|
7981
8057
|
switch (domEventName) {
|
|
@@ -7991,22 +8067,22 @@ function extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, n
|
|
|
7991
8067
|
|
|
7992
8068
|
case 'keydown':
|
|
7993
8069
|
case 'keyup':
|
|
7994
|
-
|
|
8070
|
+
SyntheticEventCtor = SyntheticKeyboardEvent;
|
|
7995
8071
|
break;
|
|
7996
8072
|
|
|
7997
8073
|
case 'focusin':
|
|
7998
8074
|
reactEventType = 'focus';
|
|
7999
|
-
|
|
8075
|
+
SyntheticEventCtor = SyntheticFocusEvent;
|
|
8000
8076
|
break;
|
|
8001
8077
|
|
|
8002
8078
|
case 'focusout':
|
|
8003
8079
|
reactEventType = 'blur';
|
|
8004
|
-
|
|
8080
|
+
SyntheticEventCtor = SyntheticFocusEvent;
|
|
8005
8081
|
break;
|
|
8006
8082
|
|
|
8007
8083
|
case 'beforeblur':
|
|
8008
8084
|
case 'afterblur':
|
|
8009
|
-
|
|
8085
|
+
SyntheticEventCtor = SyntheticFocusEvent;
|
|
8010
8086
|
break;
|
|
8011
8087
|
|
|
8012
8088
|
case 'click':
|
|
@@ -8029,7 +8105,7 @@ function extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, n
|
|
|
8029
8105
|
case 'mouseout':
|
|
8030
8106
|
case 'mouseover':
|
|
8031
8107
|
case 'contextmenu':
|
|
8032
|
-
|
|
8108
|
+
SyntheticEventCtor = SyntheticMouseEvent;
|
|
8033
8109
|
break;
|
|
8034
8110
|
|
|
8035
8111
|
case 'drag':
|
|
@@ -8040,38 +8116,38 @@ function extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, n
|
|
|
8040
8116
|
case 'dragover':
|
|
8041
8117
|
case 'dragstart':
|
|
8042
8118
|
case 'drop':
|
|
8043
|
-
|
|
8119
|
+
SyntheticEventCtor = SyntheticDragEvent;
|
|
8044
8120
|
break;
|
|
8045
8121
|
|
|
8046
8122
|
case 'touchcancel':
|
|
8047
8123
|
case 'touchend':
|
|
8048
8124
|
case 'touchmove':
|
|
8049
8125
|
case 'touchstart':
|
|
8050
|
-
|
|
8126
|
+
SyntheticEventCtor = SyntheticTouchEvent;
|
|
8051
8127
|
break;
|
|
8052
8128
|
|
|
8053
8129
|
case ANIMATION_END:
|
|
8054
8130
|
case ANIMATION_ITERATION:
|
|
8055
8131
|
case ANIMATION_START:
|
|
8056
|
-
|
|
8132
|
+
SyntheticEventCtor = SyntheticAnimationEvent;
|
|
8057
8133
|
break;
|
|
8058
8134
|
|
|
8059
8135
|
case TRANSITION_END:
|
|
8060
|
-
|
|
8136
|
+
SyntheticEventCtor = SyntheticTransitionEvent;
|
|
8061
8137
|
break;
|
|
8062
8138
|
|
|
8063
8139
|
case 'scroll':
|
|
8064
|
-
|
|
8140
|
+
SyntheticEventCtor = SyntheticUIEvent;
|
|
8065
8141
|
break;
|
|
8066
8142
|
|
|
8067
8143
|
case 'wheel':
|
|
8068
|
-
|
|
8144
|
+
SyntheticEventCtor = SyntheticWheelEvent;
|
|
8069
8145
|
break;
|
|
8070
8146
|
|
|
8071
8147
|
case 'copy':
|
|
8072
8148
|
case 'cut':
|
|
8073
8149
|
case 'paste':
|
|
8074
|
-
|
|
8150
|
+
SyntheticEventCtor = SyntheticClipboardEvent;
|
|
8075
8151
|
break;
|
|
8076
8152
|
|
|
8077
8153
|
case 'gotpointercapture':
|
|
@@ -8082,11 +8158,10 @@ function extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, n
|
|
|
8082
8158
|
case 'pointerout':
|
|
8083
8159
|
case 'pointerover':
|
|
8084
8160
|
case 'pointerup':
|
|
8085
|
-
|
|
8161
|
+
SyntheticEventCtor = SyntheticPointerEvent;
|
|
8086
8162
|
break;
|
|
8087
8163
|
}
|
|
8088
8164
|
|
|
8089
|
-
var event = new SyntheticEvent(reactName, reactEventType, null, nativeEvent, nativeEventTarget, EventInterface);
|
|
8090
8165
|
var inCapturePhase = (eventSystemFlags & IS_CAPTURE_PHASE) !== 0;
|
|
8091
8166
|
|
|
8092
8167
|
{
|
|
@@ -8094,16 +8169,23 @@ function extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, n
|
|
|
8094
8169
|
// In the past, React has always bubbled them, but this can be surprising.
|
|
8095
8170
|
// We're going to try aligning closer to the browser behavior by not bubbling
|
|
8096
8171
|
// them in React either. We'll start by not bubbling onScroll, and then expand.
|
|
8097
|
-
var accumulateTargetOnly =
|
|
8172
|
+
var accumulateTargetOnly = !inCapturePhase && // TODO: ideally, we'd eventually add all events from
|
|
8173
|
+
// nonDelegatedEvents list in DOMPluginEventSystem.
|
|
8174
|
+
// Then we can remove this special list.
|
|
8175
|
+
// This is a breaking change that can wait until React 18.
|
|
8176
|
+
domEventName === 'scroll';
|
|
8098
8177
|
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
//
|
|
8103
|
-
|
|
8104
|
-
}
|
|
8178
|
+
var _listeners = accumulateSinglePhaseListeners(targetInst, reactName, nativeEvent.type, inCapturePhase, accumulateTargetOnly);
|
|
8179
|
+
|
|
8180
|
+
if (_listeners.length > 0) {
|
|
8181
|
+
// Intentionally create event lazily.
|
|
8182
|
+
var _event = new SyntheticEventCtor(reactName, reactEventType, null, nativeEvent, nativeEventTarget);
|
|
8105
8183
|
|
|
8106
|
-
|
|
8184
|
+
dispatchQueue.push({
|
|
8185
|
+
event: _event,
|
|
8186
|
+
listeners: _listeners
|
|
8187
|
+
});
|
|
8188
|
+
}
|
|
8107
8189
|
}
|
|
8108
8190
|
}
|
|
8109
8191
|
|
|
@@ -8217,22 +8299,14 @@ function dispatchEventsForPlugins(domEventName, eventSystemFlags, nativeEvent, t
|
|
|
8217
8299
|
processDispatchQueue(dispatchQueue, eventSystemFlags);
|
|
8218
8300
|
}
|
|
8219
8301
|
|
|
8220
|
-
function shouldUpgradeListener(listenerEntry, passive) {
|
|
8221
|
-
return listenerEntry !== undefined && listenerEntry.passive === true && !passive;
|
|
8222
|
-
}
|
|
8223
|
-
|
|
8224
8302
|
function listenToNonDelegatedEvent(domEventName, targetElement) {
|
|
8225
8303
|
var isCapturePhaseListener = false;
|
|
8226
|
-
var
|
|
8227
|
-
var
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
listenerMap.set(listenerMapKey, {
|
|
8233
|
-
passive: false,
|
|
8234
|
-
listener: listener
|
|
8235
|
-
});
|
|
8304
|
+
var listenerSet = getEventListenerSet(targetElement);
|
|
8305
|
+
var listenerSetKey = getListenerSetKey(domEventName, isCapturePhaseListener);
|
|
8306
|
+
|
|
8307
|
+
if (!listenerSet.has(listenerSetKey)) {
|
|
8308
|
+
addTrappedEventListener(targetElement, domEventName, IS_NON_DELEGATED, isCapturePhaseListener);
|
|
8309
|
+
listenerSet.add(listenerSetKey);
|
|
8236
8310
|
}
|
|
8237
8311
|
}
|
|
8238
8312
|
var listeningMarker = '_reactListening' + Math.random().toString(36).slice(2);
|
|
@@ -8256,26 +8330,14 @@ function listenToAllSupportedEvents(rootContainerElement) {
|
|
|
8256
8330
|
});
|
|
8257
8331
|
}
|
|
8258
8332
|
}
|
|
8259
|
-
function listenToNativeEvent(domEventName, isCapturePhaseListener, rootContainerElement, targetElement
|
|
8260
|
-
var eventSystemFlags = arguments.length >
|
|
8333
|
+
function listenToNativeEvent(domEventName, isCapturePhaseListener, rootContainerElement, targetElement) {
|
|
8334
|
+
var eventSystemFlags = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
8261
8335
|
var target = rootContainerElement; // selectionchange needs to be attached to the document
|
|
8262
8336
|
// otherwise it won't capture incoming events that are only
|
|
8263
8337
|
// triggered on the document directly.
|
|
8264
8338
|
|
|
8265
8339
|
if (domEventName === 'selectionchange' && rootContainerElement.nodeType !== DOCUMENT_NODE) {
|
|
8266
8340
|
target = rootContainerElement.ownerDocument;
|
|
8267
|
-
}
|
|
8268
|
-
|
|
8269
|
-
if ( isPassiveListener === undefined) {
|
|
8270
|
-
// Browsers introduced an intervention, making these events
|
|
8271
|
-
// passive by default on document. React doesn't bind them
|
|
8272
|
-
// to document anymore, but changing this now would undo
|
|
8273
|
-
// the performance wins from the change. So we emulate
|
|
8274
|
-
// the existing behavior manually on the roots now.
|
|
8275
|
-
// https://github.com/facebook/react/issues/19651
|
|
8276
|
-
if (domEventName === 'touchstart' || domEventName === 'touchmove' || domEventName === 'wheel') {
|
|
8277
|
-
isPassiveListener = true;
|
|
8278
|
-
}
|
|
8279
8341
|
} // If the event can be delegated (or is capture phase), we can
|
|
8280
8342
|
// register it to the root container. Otherwise, we should
|
|
8281
8343
|
// register the event to the target element and mark it as
|
|
@@ -8300,42 +8362,42 @@ function listenToNativeEvent(domEventName, isCapturePhaseListener, rootContainer
|
|
|
8300
8362
|
target = targetElement;
|
|
8301
8363
|
}
|
|
8302
8364
|
|
|
8303
|
-
var
|
|
8304
|
-
var
|
|
8305
|
-
var listenerEntry = listenerMap.get(listenerMapKey);
|
|
8306
|
-
var shouldUpgrade = shouldUpgradeListener(listenerEntry, isPassiveListener); // If the listener entry is empty or we should upgrade, then
|
|
8365
|
+
var listenerSet = getEventListenerSet(target);
|
|
8366
|
+
var listenerSetKey = getListenerSetKey(domEventName, isCapturePhaseListener); // If the listener entry is empty or we should upgrade, then
|
|
8307
8367
|
// we need to trap an event listener onto the target.
|
|
8308
8368
|
|
|
8309
|
-
if (
|
|
8310
|
-
// If we should upgrade, then we need to remove the existing trapped
|
|
8311
|
-
// event listener for the target container.
|
|
8312
|
-
if (shouldUpgrade) {
|
|
8313
|
-
removeEventListener(target, domEventName, listenerEntry.listener, isCapturePhaseListener);
|
|
8314
|
-
}
|
|
8315
|
-
|
|
8369
|
+
if (!listenerSet.has(listenerSetKey)) {
|
|
8316
8370
|
if (isCapturePhaseListener) {
|
|
8317
8371
|
eventSystemFlags |= IS_CAPTURE_PHASE;
|
|
8318
8372
|
}
|
|
8319
8373
|
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
passive: isPassiveListener,
|
|
8323
|
-
listener: listener
|
|
8324
|
-
});
|
|
8374
|
+
addTrappedEventListener(target, domEventName, eventSystemFlags, isCapturePhaseListener);
|
|
8375
|
+
listenerSet.add(listenerSetKey);
|
|
8325
8376
|
}
|
|
8326
8377
|
}
|
|
8327
8378
|
|
|
8328
|
-
function addTrappedEventListener(targetContainer, domEventName, eventSystemFlags, isCapturePhaseListener, isDeferredListenerForLegacyFBSupport
|
|
8329
|
-
var listener = createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags
|
|
8379
|
+
function addTrappedEventListener(targetContainer, domEventName, eventSystemFlags, isCapturePhaseListener, isDeferredListenerForLegacyFBSupport) {
|
|
8380
|
+
var listener = createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags); // If passive option is not supported, then the event will be
|
|
8330
8381
|
// active and not passive.
|
|
8331
8382
|
|
|
8332
|
-
|
|
8333
|
-
|
|
8383
|
+
var isPassiveListener = undefined;
|
|
8384
|
+
|
|
8385
|
+
if (passiveBrowserEventsSupported) {
|
|
8386
|
+
// Browsers introduced an intervention, making these events
|
|
8387
|
+
// passive by default on document. React doesn't bind them
|
|
8388
|
+
// to document anymore, but changing this now would undo
|
|
8389
|
+
// the performance wins from the change. So we emulate
|
|
8390
|
+
// the existing behavior manually on the roots now.
|
|
8391
|
+
// https://github.com/facebook/react/issues/19651
|
|
8392
|
+
if (domEventName === 'touchstart' || domEventName === 'touchmove' || domEventName === 'wheel') {
|
|
8393
|
+
isPassiveListener = true;
|
|
8394
|
+
}
|
|
8334
8395
|
}
|
|
8335
8396
|
|
|
8336
8397
|
targetContainer = targetContainer;
|
|
8337
8398
|
var unsubscribeListener; // When legacyFBSupport is enabled, it's for when we
|
|
8338
8399
|
|
|
8400
|
+
|
|
8339
8401
|
if (isCapturePhaseListener) {
|
|
8340
8402
|
if (isPassiveListener !== undefined) {
|
|
8341
8403
|
unsubscribeListener = addEventCaptureListenerWithPassiveFlag(targetContainer, domEventName, listener, isPassiveListener);
|
|
@@ -8349,8 +8411,6 @@ function addTrappedEventListener(targetContainer, domEventName, eventSystemFlags
|
|
|
8349
8411
|
unsubscribeListener = addEventBubbleListener(targetContainer, domEventName, listener);
|
|
8350
8412
|
}
|
|
8351
8413
|
}
|
|
8352
|
-
|
|
8353
|
-
return unsubscribeListener;
|
|
8354
8414
|
}
|
|
8355
8415
|
|
|
8356
8416
|
function isMatchingRootContainer(grandContainer, targetContainer) {
|
|
@@ -8457,19 +8517,12 @@ function createDispatchListener(instance, listener, currentTarget) {
|
|
|
8457
8517
|
};
|
|
8458
8518
|
}
|
|
8459
8519
|
|
|
8460
|
-
function
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
listeners: listeners
|
|
8464
|
-
};
|
|
8465
|
-
}
|
|
8466
|
-
|
|
8467
|
-
function accumulateSinglePhaseListeners(targetFiber, dispatchQueue, event, inCapturePhase, accumulateTargetOnly) {
|
|
8468
|
-
var bubbled = event._reactName;
|
|
8469
|
-
var captured = bubbled !== null ? bubbled + 'Capture' : null;
|
|
8520
|
+
function accumulateSinglePhaseListeners(targetFiber, reactName, nativeEventType, inCapturePhase, accumulateTargetOnly) {
|
|
8521
|
+
var captureName = reactName !== null ? reactName + 'Capture' : null;
|
|
8522
|
+
var reactEventName = inCapturePhase ? captureName : reactName;
|
|
8470
8523
|
var listeners = [];
|
|
8471
8524
|
var instance = targetFiber;
|
|
8472
|
-
var
|
|
8525
|
+
var lastHostComponent = null; // Accumulate all instances and listeners via the target -> root path.
|
|
8473
8526
|
|
|
8474
8527
|
while (instance !== null) {
|
|
8475
8528
|
var _instance2 = instance,
|
|
@@ -8477,22 +8530,14 @@ function accumulateSinglePhaseListeners(targetFiber, dispatchQueue, event, inCap
|
|
|
8477
8530
|
tag = _instance2.tag; // Handle listeners that are on HostComponents (i.e. <div>)
|
|
8478
8531
|
|
|
8479
8532
|
if (tag === HostComponent && stateNode !== null) {
|
|
8480
|
-
|
|
8481
|
-
|
|
8533
|
+
lastHostComponent = stateNode; // createEventHandle listeners
|
|
8482
8534
|
|
|
8483
|
-
if (captured !== null && inCapturePhase) {
|
|
8484
|
-
var captureListener = getListener(instance, captured);
|
|
8485
8535
|
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
}
|
|
8489
|
-
}
|
|
8536
|
+
if (reactEventName !== null) {
|
|
8537
|
+
var listener = getListener(instance, reactEventName);
|
|
8490
8538
|
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
if (bubbleListener != null) {
|
|
8495
|
-
listeners.push(createDispatchListener(instance, bubbleListener, currentTarget));
|
|
8539
|
+
if (listener != null) {
|
|
8540
|
+
listeners.push(createDispatchListener(instance, listener, lastHostComponent));
|
|
8496
8541
|
}
|
|
8497
8542
|
}
|
|
8498
8543
|
} // If we are only accumulating events for the target, then we don't
|
|
@@ -8507,9 +8552,7 @@ function accumulateSinglePhaseListeners(targetFiber, dispatchQueue, event, inCap
|
|
|
8507
8552
|
instance = instance.return;
|
|
8508
8553
|
}
|
|
8509
8554
|
|
|
8510
|
-
|
|
8511
|
-
dispatchQueue.push(createDispatchEntry(event, listeners));
|
|
8512
|
-
}
|
|
8555
|
+
return listeners;
|
|
8513
8556
|
} // We should only use this function for:
|
|
8514
8557
|
// - BeforeInputEventPlugin
|
|
8515
8558
|
// - ChangeEventPlugin
|
|
@@ -8518,9 +8561,8 @@ function accumulateSinglePhaseListeners(targetFiber, dispatchQueue, event, inCap
|
|
|
8518
8561
|
// in the bubble phase, so we need to accumulate two
|
|
8519
8562
|
// phase event listeners (via emulation).
|
|
8520
8563
|
|
|
8521
|
-
function accumulateTwoPhaseListeners(targetFiber,
|
|
8522
|
-
var
|
|
8523
|
-
var captured = bubbled !== null ? bubbled + 'Capture' : null;
|
|
8564
|
+
function accumulateTwoPhaseListeners(targetFiber, reactName) {
|
|
8565
|
+
var captureName = reactName + 'Capture';
|
|
8524
8566
|
var listeners = [];
|
|
8525
8567
|
var instance = targetFiber; // Accumulate all instances and listeners via the target -> root path.
|
|
8526
8568
|
|
|
@@ -8530,31 +8572,24 @@ function accumulateTwoPhaseListeners(targetFiber, dispatchQueue, event) {
|
|
|
8530
8572
|
tag = _instance3.tag; // Handle listeners that are on HostComponents (i.e. <div>)
|
|
8531
8573
|
|
|
8532
8574
|
if (tag === HostComponent && stateNode !== null) {
|
|
8533
|
-
var currentTarget = stateNode;
|
|
8534
|
-
|
|
8535
|
-
if (captured !== null) {
|
|
8536
|
-
var captureListener = getListener(instance, captured);
|
|
8575
|
+
var currentTarget = stateNode;
|
|
8576
|
+
var captureListener = getListener(instance, captureName);
|
|
8537
8577
|
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
}
|
|
8578
|
+
if (captureListener != null) {
|
|
8579
|
+
listeners.unshift(createDispatchListener(instance, captureListener, currentTarget));
|
|
8541
8580
|
}
|
|
8542
8581
|
|
|
8543
|
-
|
|
8544
|
-
var bubbleListener = getListener(instance, bubbled);
|
|
8582
|
+
var bubbleListener = getListener(instance, reactName);
|
|
8545
8583
|
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
}
|
|
8584
|
+
if (bubbleListener != null) {
|
|
8585
|
+
listeners.push(createDispatchListener(instance, bubbleListener, currentTarget));
|
|
8549
8586
|
}
|
|
8550
8587
|
}
|
|
8551
8588
|
|
|
8552
8589
|
instance = instance.return;
|
|
8553
8590
|
}
|
|
8554
8591
|
|
|
8555
|
-
|
|
8556
|
-
dispatchQueue.push(createDispatchEntry(event, listeners));
|
|
8557
|
-
}
|
|
8592
|
+
return listeners;
|
|
8558
8593
|
}
|
|
8559
8594
|
|
|
8560
8595
|
function getParent(inst) {
|
|
@@ -8665,7 +8700,10 @@ function accumulateEnterLeaveListenersForEvent(dispatchQueue, event, target, com
|
|
|
8665
8700
|
}
|
|
8666
8701
|
|
|
8667
8702
|
if (listeners.length !== 0) {
|
|
8668
|
-
dispatchQueue.push(
|
|
8703
|
+
dispatchQueue.push({
|
|
8704
|
+
event: event,
|
|
8705
|
+
listeners: listeners
|
|
8706
|
+
});
|
|
8669
8707
|
}
|
|
8670
8708
|
} // We should only use this function for:
|
|
8671
8709
|
// - EnterLeaveEventPlugin
|
|
@@ -8685,7 +8723,7 @@ function accumulateEnterLeaveTwoPhaseListeners(dispatchQueue, leaveEvent, enterE
|
|
|
8685
8723
|
accumulateEnterLeaveListenersForEvent(dispatchQueue, enterEvent, to, common, true);
|
|
8686
8724
|
}
|
|
8687
8725
|
}
|
|
8688
|
-
function
|
|
8726
|
+
function getListenerSetKey(domEventName, capture) {
|
|
8689
8727
|
return domEventName + "__" + (capture ? 'capture' : 'bubble');
|
|
8690
8728
|
}
|
|
8691
8729
|
|
|
@@ -8711,11 +8749,6 @@ var normalizeHTML;
|
|
|
8711
8749
|
|
|
8712
8750
|
{
|
|
8713
8751
|
warnedUnknownTags = {
|
|
8714
|
-
// Chrome is the only major browser not shipping <time>. But as of July
|
|
8715
|
-
// 2017 it intends to ship it due to widespread usage. We intentionally
|
|
8716
|
-
// *don't* warn for <time> even if it's unrecognized by Chrome because
|
|
8717
|
-
// it soon will be, and many apps have been using it anyway.
|
|
8718
|
-
time: true,
|
|
8719
8752
|
// There are working polyfills for <dialog>. Let people use it.
|
|
8720
8753
|
dialog: true,
|
|
8721
8754
|
// Electron ships a custom <webview> tag to display external web content in
|
|
@@ -9526,6 +9559,10 @@ function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, root
|
|
|
9526
9559
|
if ( typeof nextProp !== 'function') {
|
|
9527
9560
|
warnForInvalidEventListener(propKey, nextProp);
|
|
9528
9561
|
}
|
|
9562
|
+
|
|
9563
|
+
if (propKey === 'onScroll') {
|
|
9564
|
+
listenToNonDelegatedEvent('scroll', domElement);
|
|
9565
|
+
}
|
|
9529
9566
|
}
|
|
9530
9567
|
} else if ( // Convince Flow we've calculated it (it's DEV-only in this method.)
|
|
9531
9568
|
typeof isCustomComponentTag === 'boolean') {
|
|
@@ -10659,14 +10696,14 @@ function getFiberCurrentPropsFromNode(node) {
|
|
|
10659
10696
|
function updateFiberProps(node, props) {
|
|
10660
10697
|
node[internalPropsKey] = props;
|
|
10661
10698
|
}
|
|
10662
|
-
function
|
|
10663
|
-
var
|
|
10699
|
+
function getEventListenerSet(node) {
|
|
10700
|
+
var elementListenerSet = node[internalEventHandlersKey];
|
|
10664
10701
|
|
|
10665
|
-
if (
|
|
10666
|
-
|
|
10702
|
+
if (elementListenerSet === undefined) {
|
|
10703
|
+
elementListenerSet = node[internalEventHandlersKey] = new Set();
|
|
10667
10704
|
}
|
|
10668
10705
|
|
|
10669
|
-
return
|
|
10706
|
+
return elementListenerSet;
|
|
10670
10707
|
}
|
|
10671
10708
|
|
|
10672
10709
|
var loggedTypeFailures = {};
|
|
@@ -11094,7 +11131,7 @@ function onScheduleRoot(root, children) {
|
|
|
11094
11131
|
function onCommitRoot(root, priorityLevel) {
|
|
11095
11132
|
if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') {
|
|
11096
11133
|
try {
|
|
11097
|
-
var didError = (root.current.
|
|
11134
|
+
var didError = (root.current.flags & DidCapture) === DidCapture;
|
|
11098
11135
|
|
|
11099
11136
|
if (enableProfilerTimer) {
|
|
11100
11137
|
injectedHook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
|
@@ -11309,7 +11346,7 @@ function flushSyncCallbackQueueImpl() {
|
|
|
11309
11346
|
}
|
|
11310
11347
|
|
|
11311
11348
|
// TODO: this is special because it gets imported during build.
|
|
11312
|
-
var ReactVersion = '17.0.
|
|
11349
|
+
var ReactVersion = '17.0.1';
|
|
11313
11350
|
|
|
11314
11351
|
var NoMode = 0;
|
|
11315
11352
|
var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root
|
|
@@ -11320,6 +11357,12 @@ var ConcurrentMode = 4;
|
|
|
11320
11357
|
var ProfileMode = 8;
|
|
11321
11358
|
var DebugTracingMode = 16;
|
|
11322
11359
|
|
|
11360
|
+
var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
11361
|
+
var NoTransition = 0;
|
|
11362
|
+
function requestCurrentTransition() {
|
|
11363
|
+
return ReactCurrentBatchConfig.transition;
|
|
11364
|
+
}
|
|
11365
|
+
|
|
11323
11366
|
var ReactStrictModeWarnings = {
|
|
11324
11367
|
recordUnsafeLifecycleWarnings: function (fiber, instance) {},
|
|
11325
11368
|
flushPendingUnsafeLifecycleWarnings: function () {},
|
|
@@ -12041,7 +12084,7 @@ function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps,
|
|
|
12041
12084
|
|
|
12042
12085
|
case CaptureUpdate:
|
|
12043
12086
|
{
|
|
12044
|
-
workInProgress.
|
|
12087
|
+
workInProgress.flags = workInProgress.flags & ~ShouldCapture | DidCapture;
|
|
12045
12088
|
}
|
|
12046
12089
|
// Intentional fallthrough
|
|
12047
12090
|
|
|
@@ -12208,7 +12251,7 @@ function processUpdateQueue(workInProgress, props, instance, renderLanes) {
|
|
|
12208
12251
|
var callback = update.callback;
|
|
12209
12252
|
|
|
12210
12253
|
if (callback !== null) {
|
|
12211
|
-
workInProgress.
|
|
12254
|
+
workInProgress.flags |= Callback;
|
|
12212
12255
|
var effects = queue.effects;
|
|
12213
12256
|
|
|
12214
12257
|
if (effects === null) {
|
|
@@ -12299,11 +12342,6 @@ function commitUpdateQueue(finishedWork, finishedQueue, instance) {
|
|
|
12299
12342
|
}
|
|
12300
12343
|
}
|
|
12301
12344
|
|
|
12302
|
-
var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
12303
|
-
function requestCurrentSuspenseConfig() {
|
|
12304
|
-
return ReactCurrentBatchConfig.suspense;
|
|
12305
|
-
}
|
|
12306
|
-
|
|
12307
12345
|
var fakeInternalInstance = {};
|
|
12308
12346
|
var isArray = Array.isArray; // React.Component uses a shared frozen object by default.
|
|
12309
12347
|
// We'll use it to determine whether we need to initialize legacy refs.
|
|
@@ -12413,8 +12451,7 @@ var classComponentUpdater = {
|
|
|
12413
12451
|
enqueueSetState: function (inst, payload, callback) {
|
|
12414
12452
|
var fiber = get(inst);
|
|
12415
12453
|
var eventTime = requestEventTime();
|
|
12416
|
-
var
|
|
12417
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
12454
|
+
var lane = requestUpdateLane(fiber);
|
|
12418
12455
|
var update = createUpdate(eventTime, lane);
|
|
12419
12456
|
update.payload = payload;
|
|
12420
12457
|
|
|
@@ -12432,8 +12469,7 @@ var classComponentUpdater = {
|
|
|
12432
12469
|
enqueueReplaceState: function (inst, payload, callback) {
|
|
12433
12470
|
var fiber = get(inst);
|
|
12434
12471
|
var eventTime = requestEventTime();
|
|
12435
|
-
var
|
|
12436
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
12472
|
+
var lane = requestUpdateLane(fiber);
|
|
12437
12473
|
var update = createUpdate(eventTime, lane);
|
|
12438
12474
|
update.tag = ReplaceState;
|
|
12439
12475
|
update.payload = payload;
|
|
@@ -12452,8 +12488,7 @@ var classComponentUpdater = {
|
|
|
12452
12488
|
enqueueForceUpdate: function (inst, callback) {
|
|
12453
12489
|
var fiber = get(inst);
|
|
12454
12490
|
var eventTime = requestEventTime();
|
|
12455
|
-
var
|
|
12456
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
12491
|
+
var lane = requestUpdateLane(fiber);
|
|
12457
12492
|
var update = createUpdate(eventTime, lane);
|
|
12458
12493
|
update.tag = ForceUpdate;
|
|
12459
12494
|
|
|
@@ -12848,7 +12883,7 @@ function mountClassInstance(workInProgress, ctor, newProps, renderLanes) {
|
|
|
12848
12883
|
}
|
|
12849
12884
|
|
|
12850
12885
|
if (typeof instance.componentDidMount === 'function') {
|
|
12851
|
-
workInProgress.
|
|
12886
|
+
workInProgress.flags |= Update;
|
|
12852
12887
|
}
|
|
12853
12888
|
}
|
|
12854
12889
|
|
|
@@ -12890,7 +12925,7 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) {
|
|
|
12890
12925
|
// If an update was already in progress, we should schedule an Update
|
|
12891
12926
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
12892
12927
|
if (typeof instance.componentDidMount === 'function') {
|
|
12893
|
-
workInProgress.
|
|
12928
|
+
workInProgress.flags |= Update;
|
|
12894
12929
|
}
|
|
12895
12930
|
|
|
12896
12931
|
return false;
|
|
@@ -12917,13 +12952,13 @@ function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) {
|
|
|
12917
12952
|
}
|
|
12918
12953
|
|
|
12919
12954
|
if (typeof instance.componentDidMount === 'function') {
|
|
12920
|
-
workInProgress.
|
|
12955
|
+
workInProgress.flags |= Update;
|
|
12921
12956
|
}
|
|
12922
12957
|
} else {
|
|
12923
12958
|
// If an update was already in progress, we should schedule an Update
|
|
12924
12959
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
12925
12960
|
if (typeof instance.componentDidMount === 'function') {
|
|
12926
|
-
workInProgress.
|
|
12961
|
+
workInProgress.flags |= Update;
|
|
12927
12962
|
} // If shouldComponentUpdate returned false, we should still update the
|
|
12928
12963
|
// memoized state to indicate that this work can be reused.
|
|
12929
12964
|
|
|
@@ -12983,13 +13018,13 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderLane
|
|
|
12983
13018
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
12984
13019
|
if (typeof instance.componentDidUpdate === 'function') {
|
|
12985
13020
|
if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
12986
|
-
workInProgress.
|
|
13021
|
+
workInProgress.flags |= Update;
|
|
12987
13022
|
}
|
|
12988
13023
|
}
|
|
12989
13024
|
|
|
12990
13025
|
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
12991
13026
|
if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
12992
|
-
workInProgress.
|
|
13027
|
+
workInProgress.flags |= Snapshot;
|
|
12993
13028
|
}
|
|
12994
13029
|
}
|
|
12995
13030
|
|
|
@@ -13017,24 +13052,24 @@ function updateClassInstance(current, workInProgress, ctor, newProps, renderLane
|
|
|
13017
13052
|
}
|
|
13018
13053
|
|
|
13019
13054
|
if (typeof instance.componentDidUpdate === 'function') {
|
|
13020
|
-
workInProgress.
|
|
13055
|
+
workInProgress.flags |= Update;
|
|
13021
13056
|
}
|
|
13022
13057
|
|
|
13023
13058
|
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
13024
|
-
workInProgress.
|
|
13059
|
+
workInProgress.flags |= Snapshot;
|
|
13025
13060
|
}
|
|
13026
13061
|
} else {
|
|
13027
13062
|
// If an update was already in progress, we should schedule an Update
|
|
13028
13063
|
// effect even though we're bailing out, so that cWU/cDU are called.
|
|
13029
13064
|
if (typeof instance.componentDidUpdate === 'function') {
|
|
13030
13065
|
if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
13031
|
-
workInProgress.
|
|
13066
|
+
workInProgress.flags |= Update;
|
|
13032
13067
|
}
|
|
13033
13068
|
}
|
|
13034
13069
|
|
|
13035
13070
|
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
|
13036
13071
|
if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
|
13037
|
-
workInProgress.
|
|
13072
|
+
workInProgress.flags |= Snapshot;
|
|
13038
13073
|
}
|
|
13039
13074
|
} // If shouldComponentUpdate returned false, we should still update the
|
|
13040
13075
|
// memoized props/state to indicate that this work can be reused.
|
|
@@ -13239,7 +13274,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
13239
13274
|
}
|
|
13240
13275
|
|
|
13241
13276
|
childToDelete.nextEffect = null;
|
|
13242
|
-
childToDelete.
|
|
13277
|
+
childToDelete.flags = Deletion;
|
|
13243
13278
|
}
|
|
13244
13279
|
|
|
13245
13280
|
function deleteRemainingChildren(returnFiber, currentFirstChild) {
|
|
@@ -13304,7 +13339,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
13304
13339
|
|
|
13305
13340
|
if (oldIndex < lastPlacedIndex) {
|
|
13306
13341
|
// This is a move.
|
|
13307
|
-
newFiber.
|
|
13342
|
+
newFiber.flags = Placement;
|
|
13308
13343
|
return lastPlacedIndex;
|
|
13309
13344
|
} else {
|
|
13310
13345
|
// This item can stay in place.
|
|
@@ -13312,7 +13347,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
13312
13347
|
}
|
|
13313
13348
|
} else {
|
|
13314
13349
|
// This is an insertion.
|
|
13315
|
-
newFiber.
|
|
13350
|
+
newFiber.flags = Placement;
|
|
13316
13351
|
return lastPlacedIndex;
|
|
13317
13352
|
}
|
|
13318
13353
|
}
|
|
@@ -13321,7 +13356,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
|
|
13321
13356
|
// This is simpler for the single child case. We only need to do a
|
|
13322
13357
|
// placement for inserting new children.
|
|
13323
13358
|
if (shouldTrackSideEffects && newFiber.alternate === null) {
|
|
13324
|
-
newFiber.
|
|
13359
|
+
newFiber.flags = Placement;
|
|
13325
13360
|
}
|
|
13326
13361
|
|
|
13327
13362
|
return newFiber;
|
|
@@ -14295,13 +14330,6 @@ function popSuspenseContext(fiber) {
|
|
|
14295
14330
|
pop(suspenseStackCursor, fiber);
|
|
14296
14331
|
}
|
|
14297
14332
|
|
|
14298
|
-
// A non-null SuspenseState means that it is blocked for one reason or another.
|
|
14299
|
-
// - A non-null dehydrated field means it's blocked pending hydration.
|
|
14300
|
-
// - A non-null dehydrated field can use isSuspenseInstancePending or
|
|
14301
|
-
// isSuspenseInstanceFallback to query the reason for being dehydrated.
|
|
14302
|
-
// - A null dehydrated field means it's blocked by something suspending and
|
|
14303
|
-
// we're currently showing a fallback instead.
|
|
14304
|
-
|
|
14305
14333
|
function shouldCaptureSuspense(workInProgress, hasInvisibleParent) {
|
|
14306
14334
|
// If it was the primary children that just suspended, capture and render the
|
|
14307
14335
|
// fallback. Otherwise, don't capture and bubble to the next boundary.
|
|
@@ -14353,7 +14381,7 @@ function findFirstSuspended(row) {
|
|
|
14353
14381
|
} else if (node.tag === SuspenseListComponent && // revealOrder undefined can't be trusted because it don't
|
|
14354
14382
|
// keep track of whether it suspended or not.
|
|
14355
14383
|
node.memoizedProps.revealOrder !== undefined) {
|
|
14356
|
-
var didSuspend = (node.
|
|
14384
|
+
var didSuspend = (node.flags & DidCapture) !== NoFlags;
|
|
14357
14385
|
|
|
14358
14386
|
if (didSuspend) {
|
|
14359
14387
|
return node;
|
|
@@ -14383,7 +14411,7 @@ function findFirstSuspended(row) {
|
|
|
14383
14411
|
return null;
|
|
14384
14412
|
}
|
|
14385
14413
|
|
|
14386
|
-
var
|
|
14414
|
+
var NoFlags$1 =
|
|
14387
14415
|
/* */
|
|
14388
14416
|
0; // Represents whether effect should fire.
|
|
14389
14417
|
|
|
@@ -14429,7 +14457,7 @@ function deleteHydratableInstance(returnFiber, instance) {
|
|
|
14429
14457
|
var childToDelete = createFiberFromHostInstanceForDeletion();
|
|
14430
14458
|
childToDelete.stateNode = instance;
|
|
14431
14459
|
childToDelete.return = returnFiber;
|
|
14432
|
-
childToDelete.
|
|
14460
|
+
childToDelete.flags = Deletion; // This might seem like it belongs on progressedFirstDeletion. However,
|
|
14433
14461
|
// these children are not part of the reconciliation list of children.
|
|
14434
14462
|
// Even if we abort and rereconcile the children, that will try to hydrate
|
|
14435
14463
|
// again and the nodes are still in the host tree so these will be
|
|
@@ -14444,7 +14472,7 @@ function deleteHydratableInstance(returnFiber, instance) {
|
|
|
14444
14472
|
}
|
|
14445
14473
|
|
|
14446
14474
|
function insertNonHydratedInstance(returnFiber, fiber) {
|
|
14447
|
-
fiber.
|
|
14475
|
+
fiber.flags = fiber.flags & ~Hydrating | Placement;
|
|
14448
14476
|
|
|
14449
14477
|
{
|
|
14450
14478
|
switch (returnFiber.tag) {
|
|
@@ -15027,7 +15055,7 @@ function renderWithHooks(current, workInProgress, Component, props, secondArg, n
|
|
|
15027
15055
|
}
|
|
15028
15056
|
function bailoutHooks(current, workInProgress, lanes) {
|
|
15029
15057
|
workInProgress.updateQueue = current.updateQueue;
|
|
15030
|
-
workInProgress.
|
|
15058
|
+
workInProgress.flags &= ~(Passive | Update);
|
|
15031
15059
|
current.lanes = removeLanes(current.lanes, lanes);
|
|
15032
15060
|
}
|
|
15033
15061
|
function resetHooksAfterThrow() {
|
|
@@ -15498,8 +15526,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) {
|
|
|
15498
15526
|
|
|
15499
15527
|
if (!objectIs(snapshot, maybeNewSnapshot)) {
|
|
15500
15528
|
setSnapshot(maybeNewSnapshot);
|
|
15501
|
-
var
|
|
15502
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
15529
|
+
var lane = requestUpdateLane(fiber);
|
|
15503
15530
|
markRootMutableRead(root, lane);
|
|
15504
15531
|
} // If the source mutated between render and now,
|
|
15505
15532
|
// there may be state updates already scheduled from the old source.
|
|
@@ -15518,8 +15545,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) {
|
|
|
15518
15545
|
try {
|
|
15519
15546
|
latestSetSnapshot(latestGetSnapshot(source._source)); // Record a pending mutable source update with the same expiration time.
|
|
15520
15547
|
|
|
15521
|
-
var
|
|
15522
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
15548
|
+
var lane = requestUpdateLane(fiber);
|
|
15523
15549
|
markRootMutableRead(root, lane);
|
|
15524
15550
|
} catch (error) {
|
|
15525
15551
|
// A selector might throw after a source mutation.
|
|
@@ -15669,14 +15695,14 @@ function updateRef(initialValue) {
|
|
|
15669
15695
|
return hook.memoizedState;
|
|
15670
15696
|
}
|
|
15671
15697
|
|
|
15672
|
-
function mountEffectImpl(
|
|
15698
|
+
function mountEffectImpl(fiberFlags, hookFlags, create, deps) {
|
|
15673
15699
|
var hook = mountWorkInProgressHook();
|
|
15674
15700
|
var nextDeps = deps === undefined ? null : deps;
|
|
15675
|
-
currentlyRenderingFiber$1.
|
|
15676
|
-
hook.memoizedState = pushEffect(HasEffect |
|
|
15701
|
+
currentlyRenderingFiber$1.flags |= fiberFlags;
|
|
15702
|
+
hook.memoizedState = pushEffect(HasEffect | hookFlags, create, undefined, nextDeps);
|
|
15677
15703
|
}
|
|
15678
15704
|
|
|
15679
|
-
function updateEffectImpl(
|
|
15705
|
+
function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
|
15680
15706
|
var hook = updateWorkInProgressHook();
|
|
15681
15707
|
var nextDeps = deps === undefined ? null : deps;
|
|
15682
15708
|
var destroy = undefined;
|
|
@@ -15689,14 +15715,14 @@ function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
|
|
|
15689
15715
|
var prevDeps = prevEffect.deps;
|
|
15690
15716
|
|
|
15691
15717
|
if (areHookInputsEqual(nextDeps, prevDeps)) {
|
|
15692
|
-
pushEffect(
|
|
15718
|
+
pushEffect(hookFlags, create, destroy, nextDeps);
|
|
15693
15719
|
return;
|
|
15694
15720
|
}
|
|
15695
15721
|
}
|
|
15696
15722
|
}
|
|
15697
15723
|
|
|
15698
|
-
currentlyRenderingFiber$1.
|
|
15699
|
-
hook.memoizedState = pushEffect(HasEffect |
|
|
15724
|
+
currentlyRenderingFiber$1.flags |= fiberFlags;
|
|
15725
|
+
hook.memoizedState = pushEffect(HasEffect | hookFlags, create, destroy, nextDeps);
|
|
15700
15726
|
}
|
|
15701
15727
|
|
|
15702
15728
|
function mountEffect(create, deps) {
|
|
@@ -15843,61 +15869,61 @@ function updateMemo(nextCreate, deps) {
|
|
|
15843
15869
|
return nextValue;
|
|
15844
15870
|
}
|
|
15845
15871
|
|
|
15846
|
-
function mountDeferredValue(value
|
|
15872
|
+
function mountDeferredValue(value) {
|
|
15847
15873
|
var _mountState = mountState(value),
|
|
15848
15874
|
prevValue = _mountState[0],
|
|
15849
15875
|
setValue = _mountState[1];
|
|
15850
15876
|
|
|
15851
15877
|
mountEffect(function () {
|
|
15852
|
-
var
|
|
15853
|
-
ReactCurrentBatchConfig$1.
|
|
15878
|
+
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
15879
|
+
ReactCurrentBatchConfig$1.transition = 1;
|
|
15854
15880
|
|
|
15855
15881
|
try {
|
|
15856
15882
|
setValue(value);
|
|
15857
15883
|
} finally {
|
|
15858
|
-
ReactCurrentBatchConfig$1.
|
|
15884
|
+
ReactCurrentBatchConfig$1.transition = prevTransition;
|
|
15859
15885
|
}
|
|
15860
|
-
}, [value
|
|
15886
|
+
}, [value]);
|
|
15861
15887
|
return prevValue;
|
|
15862
15888
|
}
|
|
15863
15889
|
|
|
15864
|
-
function updateDeferredValue(value
|
|
15890
|
+
function updateDeferredValue(value) {
|
|
15865
15891
|
var _updateState = updateState(),
|
|
15866
15892
|
prevValue = _updateState[0],
|
|
15867
15893
|
setValue = _updateState[1];
|
|
15868
15894
|
|
|
15869
15895
|
updateEffect(function () {
|
|
15870
|
-
var
|
|
15871
|
-
ReactCurrentBatchConfig$1.
|
|
15896
|
+
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
15897
|
+
ReactCurrentBatchConfig$1.transition = 1;
|
|
15872
15898
|
|
|
15873
15899
|
try {
|
|
15874
15900
|
setValue(value);
|
|
15875
15901
|
} finally {
|
|
15876
|
-
ReactCurrentBatchConfig$1.
|
|
15902
|
+
ReactCurrentBatchConfig$1.transition = prevTransition;
|
|
15877
15903
|
}
|
|
15878
|
-
}, [value
|
|
15904
|
+
}, [value]);
|
|
15879
15905
|
return prevValue;
|
|
15880
15906
|
}
|
|
15881
15907
|
|
|
15882
|
-
function rerenderDeferredValue(value
|
|
15908
|
+
function rerenderDeferredValue(value) {
|
|
15883
15909
|
var _rerenderState = rerenderState(),
|
|
15884
15910
|
prevValue = _rerenderState[0],
|
|
15885
15911
|
setValue = _rerenderState[1];
|
|
15886
15912
|
|
|
15887
15913
|
updateEffect(function () {
|
|
15888
|
-
var
|
|
15889
|
-
ReactCurrentBatchConfig$1.
|
|
15914
|
+
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
15915
|
+
ReactCurrentBatchConfig$1.transition = 1;
|
|
15890
15916
|
|
|
15891
15917
|
try {
|
|
15892
15918
|
setValue(value);
|
|
15893
15919
|
} finally {
|
|
15894
|
-
ReactCurrentBatchConfig$1.
|
|
15920
|
+
ReactCurrentBatchConfig$1.transition = prevTransition;
|
|
15895
15921
|
}
|
|
15896
|
-
}, [value
|
|
15922
|
+
}, [value]);
|
|
15897
15923
|
return prevValue;
|
|
15898
15924
|
}
|
|
15899
15925
|
|
|
15900
|
-
function startTransition(setPending,
|
|
15926
|
+
function startTransition(setPending, callback) {
|
|
15901
15927
|
var priorityLevel = getCurrentPriorityLevel();
|
|
15902
15928
|
|
|
15903
15929
|
{
|
|
@@ -15905,43 +15931,46 @@ function startTransition(setPending, config, callback) {
|
|
|
15905
15931
|
setPending(true);
|
|
15906
15932
|
});
|
|
15907
15933
|
runWithPriority$1(priorityLevel > NormalPriority$1 ? NormalPriority$1 : priorityLevel, function () {
|
|
15908
|
-
var
|
|
15909
|
-
ReactCurrentBatchConfig$1.
|
|
15934
|
+
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
15935
|
+
ReactCurrentBatchConfig$1.transition = 1;
|
|
15910
15936
|
|
|
15911
15937
|
try {
|
|
15912
15938
|
setPending(false);
|
|
15913
15939
|
callback();
|
|
15914
15940
|
} finally {
|
|
15915
|
-
ReactCurrentBatchConfig$1.
|
|
15941
|
+
ReactCurrentBatchConfig$1.transition = prevTransition;
|
|
15916
15942
|
}
|
|
15917
15943
|
});
|
|
15918
15944
|
}
|
|
15919
15945
|
}
|
|
15920
15946
|
|
|
15921
|
-
function mountTransition(
|
|
15947
|
+
function mountTransition() {
|
|
15922
15948
|
var _mountState2 = mountState(false),
|
|
15923
15949
|
isPending = _mountState2[0],
|
|
15924
|
-
setPending = _mountState2[1];
|
|
15950
|
+
setPending = _mountState2[1]; // The `start` method can be stored on a ref, since `setPending`
|
|
15951
|
+
// never changes.
|
|
15925
15952
|
|
|
15926
|
-
|
|
15953
|
+
|
|
15954
|
+
var start = startTransition.bind(null, setPending);
|
|
15955
|
+
mountRef(start);
|
|
15927
15956
|
return [start, isPending];
|
|
15928
15957
|
}
|
|
15929
15958
|
|
|
15930
|
-
function updateTransition(
|
|
15959
|
+
function updateTransition() {
|
|
15931
15960
|
var _updateState2 = updateState(),
|
|
15932
|
-
isPending = _updateState2[0]
|
|
15933
|
-
setPending = _updateState2[1];
|
|
15961
|
+
isPending = _updateState2[0];
|
|
15934
15962
|
|
|
15935
|
-
var
|
|
15963
|
+
var startRef = updateRef();
|
|
15964
|
+
var start = startRef.current;
|
|
15936
15965
|
return [start, isPending];
|
|
15937
15966
|
}
|
|
15938
15967
|
|
|
15939
|
-
function rerenderTransition(
|
|
15968
|
+
function rerenderTransition() {
|
|
15940
15969
|
var _rerenderState2 = rerenderState(),
|
|
15941
|
-
isPending = _rerenderState2[0]
|
|
15942
|
-
setPending = _rerenderState2[1];
|
|
15970
|
+
isPending = _rerenderState2[0];
|
|
15943
15971
|
|
|
15944
|
-
var
|
|
15972
|
+
var startRef = updateRef();
|
|
15973
|
+
var start = startRef.current;
|
|
15945
15974
|
return [start, isPending];
|
|
15946
15975
|
}
|
|
15947
15976
|
|
|
@@ -15998,7 +16027,7 @@ function mountOpaqueIdentifier() {
|
|
|
15998
16027
|
var setId = mountState(id)[1];
|
|
15999
16028
|
|
|
16000
16029
|
if ((currentlyRenderingFiber$1.mode & BlockingMode) === NoMode) {
|
|
16001
|
-
currentlyRenderingFiber$1.
|
|
16030
|
+
currentlyRenderingFiber$1.flags |= Update | Passive;
|
|
16002
16031
|
pushEffect(HasEffect | Passive$1, function () {
|
|
16003
16032
|
setId(makeId());
|
|
16004
16033
|
}, undefined, null);
|
|
@@ -16031,8 +16060,7 @@ function dispatchAction(fiber, queue, action) {
|
|
|
16031
16060
|
}
|
|
16032
16061
|
|
|
16033
16062
|
var eventTime = requestEventTime();
|
|
16034
|
-
var
|
|
16035
|
-
var lane = requestUpdateLane(fiber, suspenseConfig);
|
|
16063
|
+
var lane = requestUpdateLane(fiber);
|
|
16036
16064
|
var update = {
|
|
16037
16065
|
lane: lane,
|
|
16038
16066
|
action: action,
|
|
@@ -16227,15 +16255,15 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
16227
16255
|
mountHookTypesDev();
|
|
16228
16256
|
return mountDebugValue();
|
|
16229
16257
|
},
|
|
16230
|
-
useDeferredValue: function (value
|
|
16258
|
+
useDeferredValue: function (value) {
|
|
16231
16259
|
currentHookNameInDev = 'useDeferredValue';
|
|
16232
16260
|
mountHookTypesDev();
|
|
16233
|
-
return mountDeferredValue(value
|
|
16261
|
+
return mountDeferredValue(value);
|
|
16234
16262
|
},
|
|
16235
|
-
useTransition: function (
|
|
16263
|
+
useTransition: function () {
|
|
16236
16264
|
currentHookNameInDev = 'useTransition';
|
|
16237
16265
|
mountHookTypesDev();
|
|
16238
|
-
return mountTransition(
|
|
16266
|
+
return mountTransition();
|
|
16239
16267
|
},
|
|
16240
16268
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
16241
16269
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -16324,15 +16352,15 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
16324
16352
|
updateHookTypesDev();
|
|
16325
16353
|
return mountDebugValue();
|
|
16326
16354
|
},
|
|
16327
|
-
useDeferredValue: function (value
|
|
16355
|
+
useDeferredValue: function (value) {
|
|
16328
16356
|
currentHookNameInDev = 'useDeferredValue';
|
|
16329
16357
|
updateHookTypesDev();
|
|
16330
|
-
return mountDeferredValue(value
|
|
16358
|
+
return mountDeferredValue(value);
|
|
16331
16359
|
},
|
|
16332
|
-
useTransition: function (
|
|
16360
|
+
useTransition: function () {
|
|
16333
16361
|
currentHookNameInDev = 'useTransition';
|
|
16334
16362
|
updateHookTypesDev();
|
|
16335
|
-
return mountTransition(
|
|
16363
|
+
return mountTransition();
|
|
16336
16364
|
},
|
|
16337
16365
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
16338
16366
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -16421,15 +16449,15 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
16421
16449
|
updateHookTypesDev();
|
|
16422
16450
|
return updateDebugValue();
|
|
16423
16451
|
},
|
|
16424
|
-
useDeferredValue: function (value
|
|
16452
|
+
useDeferredValue: function (value) {
|
|
16425
16453
|
currentHookNameInDev = 'useDeferredValue';
|
|
16426
16454
|
updateHookTypesDev();
|
|
16427
|
-
return updateDeferredValue(value
|
|
16455
|
+
return updateDeferredValue(value);
|
|
16428
16456
|
},
|
|
16429
|
-
useTransition: function (
|
|
16457
|
+
useTransition: function () {
|
|
16430
16458
|
currentHookNameInDev = 'useTransition';
|
|
16431
16459
|
updateHookTypesDev();
|
|
16432
|
-
return updateTransition(
|
|
16460
|
+
return updateTransition();
|
|
16433
16461
|
},
|
|
16434
16462
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
16435
16463
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -16518,15 +16546,15 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
16518
16546
|
updateHookTypesDev();
|
|
16519
16547
|
return updateDebugValue();
|
|
16520
16548
|
},
|
|
16521
|
-
useDeferredValue: function (value
|
|
16549
|
+
useDeferredValue: function (value) {
|
|
16522
16550
|
currentHookNameInDev = 'useDeferredValue';
|
|
16523
16551
|
updateHookTypesDev();
|
|
16524
|
-
return rerenderDeferredValue(value
|
|
16552
|
+
return rerenderDeferredValue(value);
|
|
16525
16553
|
},
|
|
16526
|
-
useTransition: function (
|
|
16554
|
+
useTransition: function () {
|
|
16527
16555
|
currentHookNameInDev = 'useTransition';
|
|
16528
16556
|
updateHookTypesDev();
|
|
16529
|
-
return rerenderTransition(
|
|
16557
|
+
return rerenderTransition();
|
|
16530
16558
|
},
|
|
16531
16559
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
16532
16560
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -16626,17 +16654,17 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
16626
16654
|
mountHookTypesDev();
|
|
16627
16655
|
return mountDebugValue();
|
|
16628
16656
|
},
|
|
16629
|
-
useDeferredValue: function (value
|
|
16657
|
+
useDeferredValue: function (value) {
|
|
16630
16658
|
currentHookNameInDev = 'useDeferredValue';
|
|
16631
16659
|
warnInvalidHookAccess();
|
|
16632
16660
|
mountHookTypesDev();
|
|
16633
|
-
return mountDeferredValue(value
|
|
16661
|
+
return mountDeferredValue(value);
|
|
16634
16662
|
},
|
|
16635
|
-
useTransition: function (
|
|
16663
|
+
useTransition: function () {
|
|
16636
16664
|
currentHookNameInDev = 'useTransition';
|
|
16637
16665
|
warnInvalidHookAccess();
|
|
16638
16666
|
mountHookTypesDev();
|
|
16639
|
-
return mountTransition(
|
|
16667
|
+
return mountTransition();
|
|
16640
16668
|
},
|
|
16641
16669
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
16642
16670
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -16738,17 +16766,17 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
16738
16766
|
updateHookTypesDev();
|
|
16739
16767
|
return updateDebugValue();
|
|
16740
16768
|
},
|
|
16741
|
-
useDeferredValue: function (value
|
|
16769
|
+
useDeferredValue: function (value) {
|
|
16742
16770
|
currentHookNameInDev = 'useDeferredValue';
|
|
16743
16771
|
warnInvalidHookAccess();
|
|
16744
16772
|
updateHookTypesDev();
|
|
16745
|
-
return updateDeferredValue(value
|
|
16773
|
+
return updateDeferredValue(value);
|
|
16746
16774
|
},
|
|
16747
|
-
useTransition: function (
|
|
16775
|
+
useTransition: function () {
|
|
16748
16776
|
currentHookNameInDev = 'useTransition';
|
|
16749
16777
|
warnInvalidHookAccess();
|
|
16750
16778
|
updateHookTypesDev();
|
|
16751
|
-
return updateTransition(
|
|
16779
|
+
return updateTransition();
|
|
16752
16780
|
},
|
|
16753
16781
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
16754
16782
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -16850,17 +16878,17 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
|
16850
16878
|
updateHookTypesDev();
|
|
16851
16879
|
return updateDebugValue();
|
|
16852
16880
|
},
|
|
16853
|
-
useDeferredValue: function (value
|
|
16881
|
+
useDeferredValue: function (value) {
|
|
16854
16882
|
currentHookNameInDev = 'useDeferredValue';
|
|
16855
16883
|
warnInvalidHookAccess();
|
|
16856
16884
|
updateHookTypesDev();
|
|
16857
|
-
return rerenderDeferredValue(value
|
|
16885
|
+
return rerenderDeferredValue(value);
|
|
16858
16886
|
},
|
|
16859
|
-
useTransition: function (
|
|
16887
|
+
useTransition: function () {
|
|
16860
16888
|
currentHookNameInDev = 'useTransition';
|
|
16861
16889
|
warnInvalidHookAccess();
|
|
16862
16890
|
updateHookTypesDev();
|
|
16863
|
-
return rerenderTransition(
|
|
16891
|
+
return rerenderTransition();
|
|
16864
16892
|
},
|
|
16865
16893
|
useMutableSource: function (source, getSnapshot, subscribe) {
|
|
16866
16894
|
currentHookNameInDev = 'useMutableSource';
|
|
@@ -17034,7 +17062,7 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL
|
|
|
17034
17062
|
} // React DevTools reads this flag.
|
|
17035
17063
|
|
|
17036
17064
|
|
|
17037
|
-
workInProgress.
|
|
17065
|
+
workInProgress.flags |= PerformedWork;
|
|
17038
17066
|
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
|
17039
17067
|
return workInProgress.child;
|
|
17040
17068
|
}
|
|
@@ -17110,7 +17138,7 @@ function updateMemoComponent(current, workInProgress, Component, nextProps, upda
|
|
|
17110
17138
|
} // React DevTools reads this flag.
|
|
17111
17139
|
|
|
17112
17140
|
|
|
17113
|
-
workInProgress.
|
|
17141
|
+
workInProgress.flags |= PerformedWork;
|
|
17114
17142
|
var newChild = createWorkInProgress(currentChild, nextProps);
|
|
17115
17143
|
newChild.ref = workInProgress.ref;
|
|
17116
17144
|
newChild.return = workInProgress;
|
|
@@ -17176,7 +17204,7 @@ function updateSimpleMemoComponent(current, workInProgress, Component, nextProps
|
|
|
17176
17204
|
// this is no longer necessary.
|
|
17177
17205
|
workInProgress.lanes = current.lanes;
|
|
17178
17206
|
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
|
17179
|
-
} else if ((current.
|
|
17207
|
+
} else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
|
|
17180
17208
|
// This is a special case that only exists for legacy mode.
|
|
17181
17209
|
// See https://github.com/facebook/react/pull/19216.
|
|
17182
17210
|
didReceiveUpdate = true;
|
|
@@ -17275,7 +17303,7 @@ function updateMode(current, workInProgress, renderLanes) {
|
|
|
17275
17303
|
|
|
17276
17304
|
function updateProfiler(current, workInProgress, renderLanes) {
|
|
17277
17305
|
{
|
|
17278
|
-
workInProgress.
|
|
17306
|
+
workInProgress.flags |= Update; // Reset effect durations for the next eventual effect phase.
|
|
17279
17307
|
// These are reset during render to allow the DevTools commit hook a chance to read them,
|
|
17280
17308
|
|
|
17281
17309
|
var stateNode = workInProgress.stateNode;
|
|
@@ -17294,7 +17322,7 @@ function markRef(current, workInProgress) {
|
|
|
17294
17322
|
|
|
17295
17323
|
if (current === null && ref !== null || current !== null && current.ref !== ref) {
|
|
17296
17324
|
// Schedule a Ref effect
|
|
17297
|
-
workInProgress.
|
|
17325
|
+
workInProgress.flags |= Ref;
|
|
17298
17326
|
}
|
|
17299
17327
|
}
|
|
17300
17328
|
|
|
@@ -17346,7 +17374,7 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps,
|
|
|
17346
17374
|
} // React DevTools reads this flag.
|
|
17347
17375
|
|
|
17348
17376
|
|
|
17349
|
-
workInProgress.
|
|
17377
|
+
workInProgress.flags |= PerformedWork;
|
|
17350
17378
|
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
|
17351
17379
|
return workInProgress.child;
|
|
17352
17380
|
}
|
|
@@ -17390,7 +17418,7 @@ function updateClassComponent(current, workInProgress, Component, nextProps, ren
|
|
|
17390
17418
|
current.alternate = null;
|
|
17391
17419
|
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
17392
17420
|
|
|
17393
|
-
workInProgress.
|
|
17421
|
+
workInProgress.flags |= Placement;
|
|
17394
17422
|
} // In the initial pass we might need to construct the instance.
|
|
17395
17423
|
|
|
17396
17424
|
|
|
@@ -17424,7 +17452,7 @@ function updateClassComponent(current, workInProgress, Component, nextProps, ren
|
|
|
17424
17452
|
function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes) {
|
|
17425
17453
|
// Refs should update even if shouldComponentUpdate returns false
|
|
17426
17454
|
markRef(current, workInProgress);
|
|
17427
|
-
var didCaptureError = (workInProgress.
|
|
17455
|
+
var didCaptureError = (workInProgress.flags & DidCapture) !== NoFlags;
|
|
17428
17456
|
|
|
17429
17457
|
if (!shouldUpdate && !didCaptureError) {
|
|
17430
17458
|
// Context providers should defer to sCU for rendering
|
|
@@ -17471,7 +17499,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate,
|
|
|
17471
17499
|
} // React DevTools reads this flag.
|
|
17472
17500
|
|
|
17473
17501
|
|
|
17474
|
-
workInProgress.
|
|
17502
|
+
workInProgress.flags |= PerformedWork;
|
|
17475
17503
|
|
|
17476
17504
|
if (current !== null && didCaptureError) {
|
|
17477
17505
|
// If we're recovering from an error, reconcile without reusing any of
|
|
@@ -17562,7 +17590,7 @@ function updateHostRoot(current, workInProgress, renderLanes) {
|
|
|
17562
17590
|
// Conceptually this is similar to Placement in that a new subtree is
|
|
17563
17591
|
// inserted into the React tree here. It just happens to not need DOM
|
|
17564
17592
|
// mutations because it already exists.
|
|
17565
|
-
node.
|
|
17593
|
+
node.flags = node.flags & ~Placement | Hydrating;
|
|
17566
17594
|
node = node.sibling;
|
|
17567
17595
|
}
|
|
17568
17596
|
} else {
|
|
@@ -17597,7 +17625,7 @@ function updateHostComponent(current, workInProgress, renderLanes) {
|
|
|
17597
17625
|
} else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
|
|
17598
17626
|
// If we're switching from a direct text child to a normal child, or to
|
|
17599
17627
|
// empty, we need to schedule the text content to be reset.
|
|
17600
|
-
workInProgress.
|
|
17628
|
+
workInProgress.flags |= ContentReset;
|
|
17601
17629
|
}
|
|
17602
17630
|
|
|
17603
17631
|
markRef(current, workInProgress);
|
|
@@ -17624,7 +17652,7 @@ function mountLazyComponent(_current, workInProgress, elementType, updateLanes,
|
|
|
17624
17652
|
_current.alternate = null;
|
|
17625
17653
|
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
17626
17654
|
|
|
17627
|
-
workInProgress.
|
|
17655
|
+
workInProgress.flags |= Placement;
|
|
17628
17656
|
}
|
|
17629
17657
|
|
|
17630
17658
|
var props = workInProgress.pendingProps;
|
|
@@ -17716,7 +17744,7 @@ function mountIncompleteClassComponent(_current, workInProgress, Component, next
|
|
|
17716
17744
|
_current.alternate = null;
|
|
17717
17745
|
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
17718
17746
|
|
|
17719
|
-
workInProgress.
|
|
17747
|
+
workInProgress.flags |= Placement;
|
|
17720
17748
|
} // Promote the fiber to a class and try rendering again.
|
|
17721
17749
|
|
|
17722
17750
|
|
|
@@ -17749,7 +17777,7 @@ function mountIndeterminateComponent(_current, workInProgress, Component, render
|
|
|
17749
17777
|
_current.alternate = null;
|
|
17750
17778
|
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
17751
17779
|
|
|
17752
|
-
workInProgress.
|
|
17780
|
+
workInProgress.flags |= Placement;
|
|
17753
17781
|
}
|
|
17754
17782
|
|
|
17755
17783
|
var props = workInProgress.pendingProps;
|
|
@@ -17785,7 +17813,7 @@ function mountIndeterminateComponent(_current, workInProgress, Component, render
|
|
|
17785
17813
|
} // React DevTools reads this flag.
|
|
17786
17814
|
|
|
17787
17815
|
|
|
17788
|
-
workInProgress.
|
|
17816
|
+
workInProgress.flags |= PerformedWork;
|
|
17789
17817
|
|
|
17790
17818
|
{
|
|
17791
17819
|
// Support for module components is deprecated and is removed behind a flag.
|
|
@@ -17936,7 +17964,8 @@ function updateSuspenseOffscreenState(prevOffscreenState, renderLanes) {
|
|
|
17936
17964
|
return {
|
|
17937
17965
|
baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes)
|
|
17938
17966
|
};
|
|
17939
|
-
}
|
|
17967
|
+
} // TODO: Probably should inline this back
|
|
17968
|
+
|
|
17940
17969
|
|
|
17941
17970
|
function shouldRemainOnFallback(suspenseContext, current, workInProgress, renderLanes) {
|
|
17942
17971
|
// If we're already showing a fallback, there are cases where we need to
|
|
@@ -17968,19 +17997,19 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
|
|
|
17968
17997
|
|
|
17969
17998
|
{
|
|
17970
17999
|
if (shouldSuspend(workInProgress)) {
|
|
17971
|
-
workInProgress.
|
|
18000
|
+
workInProgress.flags |= DidCapture;
|
|
17972
18001
|
}
|
|
17973
18002
|
}
|
|
17974
18003
|
|
|
17975
18004
|
var suspenseContext = suspenseStackCursor.current;
|
|
17976
18005
|
var showFallback = false;
|
|
17977
|
-
var didSuspend = (workInProgress.
|
|
18006
|
+
var didSuspend = (workInProgress.flags & DidCapture) !== NoFlags;
|
|
17978
18007
|
|
|
17979
18008
|
if (didSuspend || shouldRemainOnFallback(suspenseContext, current)) {
|
|
17980
18009
|
// Something in this boundary's subtree already suspended. Switch to
|
|
17981
18010
|
// rendering the fallback children.
|
|
17982
18011
|
showFallback = true;
|
|
17983
|
-
workInProgress.
|
|
18012
|
+
workInProgress.flags &= ~DidCapture;
|
|
17984
18013
|
} else {
|
|
17985
18014
|
// Attempting the main content
|
|
17986
18015
|
if (current === null || current.memoizedState !== null) {
|
|
@@ -18027,17 +18056,41 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
|
|
|
18027
18056
|
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
|
18028
18057
|
}
|
|
18029
18058
|
|
|
18059
|
+
var nextPrimaryChildren = nextProps.children;
|
|
18060
|
+
var nextFallbackChildren = nextProps.fallback;
|
|
18061
|
+
|
|
18030
18062
|
if (showFallback) {
|
|
18031
|
-
var nextPrimaryChildren = nextProps.children;
|
|
18032
|
-
var nextFallbackChildren = nextProps.fallback;
|
|
18033
18063
|
var fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes);
|
|
18034
18064
|
var primaryChildFragment = workInProgress.child;
|
|
18035
18065
|
primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes);
|
|
18036
18066
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
18037
18067
|
return fallbackFragment;
|
|
18068
|
+
} else if (typeof nextProps.unstable_expectedLoadTime === 'number') {
|
|
18069
|
+
// This is a CPU-bound tree. Skip this tree and show a placeholder to
|
|
18070
|
+
// unblock the surrounding content. Then immediately retry after the
|
|
18071
|
+
// initial commit.
|
|
18072
|
+
var _fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes);
|
|
18073
|
+
|
|
18074
|
+
var _primaryChildFragment = workInProgress.child;
|
|
18075
|
+
_primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes);
|
|
18076
|
+
workInProgress.memoizedState = SUSPENDED_MARKER; // Since nothing actually suspended, there will nothing to ping this to
|
|
18077
|
+
// get it started back up to attempt the next item. While in terms of
|
|
18078
|
+
// priority this work has the same priority as this current render, it's
|
|
18079
|
+
// not part of the same transition once the transition has committed. If
|
|
18080
|
+
// it's sync, we still want to yield so that it can be painted.
|
|
18081
|
+
// Conceptually, this is really the same as pinging. We can use any
|
|
18082
|
+
// RetryLane even if it's the one currently rendering since we're leaving
|
|
18083
|
+
// it behind on this node.
|
|
18084
|
+
|
|
18085
|
+
workInProgress.lanes = SomeRetryLane;
|
|
18086
|
+
|
|
18087
|
+
{
|
|
18088
|
+
markSpawnedWork(SomeRetryLane);
|
|
18089
|
+
}
|
|
18090
|
+
|
|
18091
|
+
return _fallbackFragment;
|
|
18038
18092
|
} else {
|
|
18039
|
-
|
|
18040
|
-
return mountSuspensePrimaryChildren(workInProgress, _nextPrimaryChildren, renderLanes);
|
|
18093
|
+
return mountSuspensePrimaryChildren(workInProgress, nextPrimaryChildren, renderLanes);
|
|
18041
18094
|
}
|
|
18042
18095
|
} else {
|
|
18043
18096
|
// This is an update.
|
|
@@ -18049,37 +18102,37 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
|
|
|
18049
18102
|
|
|
18050
18103
|
if (showFallback) {
|
|
18051
18104
|
var _nextFallbackChildren2 = nextProps.fallback;
|
|
18052
|
-
var
|
|
18105
|
+
var _nextPrimaryChildren2 = nextProps.children;
|
|
18053
18106
|
|
|
18054
|
-
var _fallbackChildFragment = updateSuspenseFallbackChildren(current, workInProgress,
|
|
18107
|
+
var _fallbackChildFragment = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren2, _nextFallbackChildren2, renderLanes);
|
|
18055
18108
|
|
|
18056
|
-
var
|
|
18109
|
+
var _primaryChildFragment3 = workInProgress.child;
|
|
18057
18110
|
var prevOffscreenState = current.child.memoizedState;
|
|
18058
|
-
|
|
18059
|
-
|
|
18111
|
+
_primaryChildFragment3.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes);
|
|
18112
|
+
_primaryChildFragment3.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes);
|
|
18060
18113
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
18061
18114
|
return _fallbackChildFragment;
|
|
18062
18115
|
} else {
|
|
18063
|
-
var
|
|
18116
|
+
var _nextPrimaryChildren3 = nextProps.children;
|
|
18064
18117
|
|
|
18065
|
-
var
|
|
18118
|
+
var _primaryChildFragment4 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren3, renderLanes);
|
|
18066
18119
|
|
|
18067
18120
|
workInProgress.memoizedState = null;
|
|
18068
|
-
return
|
|
18121
|
+
return _primaryChildFragment4;
|
|
18069
18122
|
}
|
|
18070
18123
|
} else {
|
|
18071
18124
|
// The current tree is not already showing a fallback.
|
|
18072
18125
|
if (showFallback) {
|
|
18073
18126
|
// Timed out.
|
|
18074
18127
|
var _nextFallbackChildren3 = nextProps.fallback;
|
|
18075
|
-
var
|
|
18128
|
+
var _nextPrimaryChildren4 = nextProps.children;
|
|
18076
18129
|
|
|
18077
|
-
var _fallbackChildFragment2 = updateSuspenseFallbackChildren(current, workInProgress,
|
|
18130
|
+
var _fallbackChildFragment2 = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren4, _nextFallbackChildren3, renderLanes);
|
|
18078
18131
|
|
|
18079
|
-
var
|
|
18132
|
+
var _primaryChildFragment5 = workInProgress.child;
|
|
18080
18133
|
var _prevOffscreenState = current.child.memoizedState;
|
|
18081
|
-
|
|
18082
|
-
|
|
18134
|
+
_primaryChildFragment5.memoizedState = _prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(_prevOffscreenState, renderLanes);
|
|
18135
|
+
_primaryChildFragment5.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); // Skip the primary children, and continue working on the
|
|
18083
18136
|
// fallback children.
|
|
18084
18137
|
|
|
18085
18138
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
@@ -18087,12 +18140,12 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
|
|
|
18087
18140
|
} else {
|
|
18088
18141
|
// Still haven't timed out. Continue rendering the children, like we
|
|
18089
18142
|
// normally do.
|
|
18090
|
-
var
|
|
18143
|
+
var _nextPrimaryChildren5 = nextProps.children;
|
|
18091
18144
|
|
|
18092
|
-
var
|
|
18145
|
+
var _primaryChildFragment6 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren5, renderLanes);
|
|
18093
18146
|
|
|
18094
18147
|
workInProgress.memoizedState = null;
|
|
18095
|
-
return
|
|
18148
|
+
return _primaryChildFragment6;
|
|
18096
18149
|
}
|
|
18097
18150
|
}
|
|
18098
18151
|
}
|
|
@@ -18175,7 +18228,7 @@ function updateSuspensePrimaryChildren(current, workInProgress, primaryChildren,
|
|
|
18175
18228
|
if (currentFallbackChildFragment !== null) {
|
|
18176
18229
|
// Delete the fallback child fragment
|
|
18177
18230
|
currentFallbackChildFragment.nextEffect = null;
|
|
18178
|
-
currentFallbackChildFragment.
|
|
18231
|
+
currentFallbackChildFragment.flags = Deletion;
|
|
18179
18232
|
workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment;
|
|
18180
18233
|
}
|
|
18181
18234
|
|
|
@@ -18246,7 +18299,7 @@ function updateSuspenseFallbackChildren(current, workInProgress, primaryChildren
|
|
|
18246
18299
|
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); // Needs a placement effect because the parent (the Suspense boundary) already
|
|
18247
18300
|
// mounted but this is a new fiber.
|
|
18248
18301
|
|
|
18249
|
-
fallbackChildFragment.
|
|
18302
|
+
fallbackChildFragment.flags |= Placement;
|
|
18250
18303
|
}
|
|
18251
18304
|
|
|
18252
18305
|
fallbackChildFragment.return = workInProgress;
|
|
@@ -18484,9 +18537,9 @@ function updateSuspenseListComponent(current, workInProgress, renderLanes) {
|
|
|
18484
18537
|
|
|
18485
18538
|
if (shouldForceFallback) {
|
|
18486
18539
|
suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
|
18487
|
-
workInProgress.
|
|
18540
|
+
workInProgress.flags |= DidCapture;
|
|
18488
18541
|
} else {
|
|
18489
|
-
var didSuspendBefore = current !== null && (current.
|
|
18542
|
+
var didSuspendBefore = current !== null && (current.flags & DidCapture) !== NoFlags;
|
|
18490
18543
|
|
|
18491
18544
|
if (didSuspendBefore) {
|
|
18492
18545
|
// If we previously forced a fallback, we need to schedule work
|
|
@@ -18696,7 +18749,7 @@ function updateContextConsumer(current, workInProgress, renderLanes) {
|
|
|
18696
18749
|
} // React DevTools reads this flag.
|
|
18697
18750
|
|
|
18698
18751
|
|
|
18699
|
-
workInProgress.
|
|
18752
|
+
workInProgress.flags |= PerformedWork;
|
|
18700
18753
|
reconcileChildren(current, workInProgress, newChildren, renderLanes);
|
|
18701
18754
|
return workInProgress.child;
|
|
18702
18755
|
}
|
|
@@ -18781,8 +18834,8 @@ function remountFiber(current, oldWorkInProgress, newWorkInProgress) {
|
|
|
18781
18834
|
}
|
|
18782
18835
|
|
|
18783
18836
|
current.nextEffect = null;
|
|
18784
|
-
current.
|
|
18785
|
-
newWorkInProgress.
|
|
18837
|
+
current.flags = Deletion;
|
|
18838
|
+
newWorkInProgress.flags |= Placement; // Restart work from the new fiber.
|
|
18786
18839
|
|
|
18787
18840
|
return newWorkInProgress;
|
|
18788
18841
|
}
|
|
@@ -18850,7 +18903,7 @@ function beginWork(current, workInProgress, renderLanes) {
|
|
|
18850
18903
|
var hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes);
|
|
18851
18904
|
|
|
18852
18905
|
if (hasChildWork) {
|
|
18853
|
-
workInProgress.
|
|
18906
|
+
workInProgress.flags |= Update;
|
|
18854
18907
|
} // Reset effect durations for the next eventual effect phase.
|
|
18855
18908
|
// These are reset during render to allow the DevTools commit hook a chance to read them,
|
|
18856
18909
|
|
|
@@ -18904,7 +18957,7 @@ function beginWork(current, workInProgress, renderLanes) {
|
|
|
18904
18957
|
|
|
18905
18958
|
case SuspenseListComponent:
|
|
18906
18959
|
{
|
|
18907
|
-
var didSuspendBefore = (current.
|
|
18960
|
+
var didSuspendBefore = (current.flags & DidCapture) !== NoFlags;
|
|
18908
18961
|
|
|
18909
18962
|
var _hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes);
|
|
18910
18963
|
|
|
@@ -18921,7 +18974,7 @@ function beginWork(current, workInProgress, renderLanes) {
|
|
|
18921
18974
|
// as before. We can fast bail out.
|
|
18922
18975
|
|
|
18923
18976
|
|
|
18924
|
-
workInProgress.
|
|
18977
|
+
workInProgress.flags |= DidCapture;
|
|
18925
18978
|
} // If nothing suspended before and we're rendering the same children,
|
|
18926
18979
|
// then the tail doesn't matter. Anything new that suspends will work
|
|
18927
18980
|
// in the "together" mode, so we can continue from the state we had.
|
|
@@ -18967,7 +19020,7 @@ function beginWork(current, workInProgress, renderLanes) {
|
|
|
18967
19020
|
|
|
18968
19021
|
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
|
18969
19022
|
} else {
|
|
18970
|
-
if ((current.
|
|
19023
|
+
if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
|
|
18971
19024
|
// This is a special case that only exists for legacy mode.
|
|
18972
19025
|
// See https://github.com/facebook/react/pull/19216.
|
|
18973
19026
|
didReceiveUpdate = true;
|
|
@@ -19141,11 +19194,11 @@ function beginWork(current, workInProgress, renderLanes) {
|
|
|
19141
19194
|
function markUpdate(workInProgress) {
|
|
19142
19195
|
// Tag the fiber with an update effect. This turns a Placement into
|
|
19143
19196
|
// a PlacementAndUpdate.
|
|
19144
|
-
workInProgress.
|
|
19197
|
+
workInProgress.flags |= Update;
|
|
19145
19198
|
}
|
|
19146
19199
|
|
|
19147
19200
|
function markRef$1(workInProgress) {
|
|
19148
|
-
workInProgress.
|
|
19201
|
+
workInProgress.flags |= Ref;
|
|
19149
19202
|
}
|
|
19150
19203
|
|
|
19151
19204
|
var appendAllChildren;
|
|
@@ -19360,7 +19413,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
19360
19413
|
// This handles the case of React rendering into a container with previous children.
|
|
19361
19414
|
// It's also safe to do for updates too, because current.child would only be null
|
|
19362
19415
|
// if the previous render was null (so the the container would already be empty).
|
|
19363
|
-
workInProgress.
|
|
19416
|
+
workInProgress.flags |= Snapshot;
|
|
19364
19417
|
}
|
|
19365
19418
|
}
|
|
19366
19419
|
|
|
@@ -19470,7 +19523,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
19470
19523
|
popSuspenseContext(workInProgress);
|
|
19471
19524
|
var nextState = workInProgress.memoizedState;
|
|
19472
19525
|
|
|
19473
|
-
if ((workInProgress.
|
|
19526
|
+
if ((workInProgress.flags & DidCapture) !== NoFlags) {
|
|
19474
19527
|
// Something suspended. Re-render with the fallback children.
|
|
19475
19528
|
workInProgress.lanes = renderLanes; // Do not reset the effect list.
|
|
19476
19529
|
|
|
@@ -19529,7 +19582,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
19529
19582
|
// primary children. In mutation mode, we also need the flag to
|
|
19530
19583
|
// *unhide* children that were previously hidden, so check if this
|
|
19531
19584
|
// is currently timed out, too.
|
|
19532
|
-
workInProgress.
|
|
19585
|
+
workInProgress.flags |= Update;
|
|
19533
19586
|
}
|
|
19534
19587
|
}
|
|
19535
19588
|
|
|
@@ -19575,7 +19628,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
19575
19628
|
return null;
|
|
19576
19629
|
}
|
|
19577
19630
|
|
|
19578
|
-
var didSuspendAlready = (workInProgress.
|
|
19631
|
+
var didSuspendAlready = (workInProgress.flags & DidCapture) !== NoFlags;
|
|
19579
19632
|
var renderedTail = renderState.rendering;
|
|
19580
19633
|
|
|
19581
19634
|
if (renderedTail === null) {
|
|
@@ -19590,7 +19643,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
19590
19643
|
// something in the previous committed pass suspended. Otherwise,
|
|
19591
19644
|
// there's no chance so we can skip the expensive call to
|
|
19592
19645
|
// findFirstSuspended.
|
|
19593
|
-
var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.
|
|
19646
|
+
var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.flags & DidCapture) === NoFlags);
|
|
19594
19647
|
|
|
19595
19648
|
if (!cannotBeSuspended) {
|
|
19596
19649
|
var row = workInProgress.child;
|
|
@@ -19600,7 +19653,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
19600
19653
|
|
|
19601
19654
|
if (suspended !== null) {
|
|
19602
19655
|
didSuspendAlready = true;
|
|
19603
|
-
workInProgress.
|
|
19656
|
+
workInProgress.flags |= DidCapture;
|
|
19604
19657
|
cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as
|
|
19605
19658
|
// part of the second pass. In that case nothing will subscribe to
|
|
19606
19659
|
// its thennables. Instead, we'll transfer its thennables to the
|
|
@@ -19618,7 +19671,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
19618
19671
|
|
|
19619
19672
|
if (newThennables !== null) {
|
|
19620
19673
|
workInProgress.updateQueue = newThennables;
|
|
19621
|
-
workInProgress.
|
|
19674
|
+
workInProgress.flags |= Update;
|
|
19622
19675
|
} // Rerender the whole list, but this time, we'll force fallbacks
|
|
19623
19676
|
// to stay in place.
|
|
19624
19677
|
// Reset the effect list before doing the second pass since that's now invalid.
|
|
@@ -19645,7 +19698,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
19645
19698
|
// We have already passed our CPU deadline but we still have rows
|
|
19646
19699
|
// left in the tail. We'll just give up further attempts to render
|
|
19647
19700
|
// the main content and only render fallbacks.
|
|
19648
|
-
workInProgress.
|
|
19701
|
+
workInProgress.flags |= DidCapture;
|
|
19649
19702
|
didSuspendAlready = true;
|
|
19650
19703
|
cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this
|
|
19651
19704
|
// to get it started back up to attempt the next item. While in terms
|
|
@@ -19672,7 +19725,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
19672
19725
|
var _suspended = findFirstSuspended(renderedTail);
|
|
19673
19726
|
|
|
19674
19727
|
if (_suspended !== null) {
|
|
19675
|
-
workInProgress.
|
|
19728
|
+
workInProgress.flags |= DidCapture;
|
|
19676
19729
|
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
|
|
19677
19730
|
// get lost if this row ends up dropped during a second pass.
|
|
19678
19731
|
|
|
@@ -19680,7 +19733,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
19680
19733
|
|
|
19681
19734
|
if (_newThennables !== null) {
|
|
19682
19735
|
workInProgress.updateQueue = _newThennables;
|
|
19683
|
-
workInProgress.
|
|
19736
|
+
workInProgress.flags |= Update;
|
|
19684
19737
|
}
|
|
19685
19738
|
|
|
19686
19739
|
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
|
@@ -19706,7 +19759,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
19706
19759
|
// We have now passed our CPU deadline and we'll just give up further
|
|
19707
19760
|
// attempts to render the main content and only render fallbacks.
|
|
19708
19761
|
// The assumption is that this is usually faster.
|
|
19709
|
-
workInProgress.
|
|
19762
|
+
workInProgress.flags |= DidCapture;
|
|
19710
19763
|
didSuspendAlready = true;
|
|
19711
19764
|
cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this
|
|
19712
19765
|
// to get it started back up to attempt the next item. While in terms
|
|
@@ -19802,7 +19855,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
|
|
19802
19855
|
var nextIsHidden = _nextState !== null;
|
|
19803
19856
|
|
|
19804
19857
|
if (prevIsHidden !== nextIsHidden && newProps.mode !== 'unstable-defer-without-hiding') {
|
|
19805
|
-
workInProgress.
|
|
19858
|
+
workInProgress.flags |= Update;
|
|
19806
19859
|
}
|
|
19807
19860
|
}
|
|
19808
19861
|
|
|
@@ -19827,10 +19880,10 @@ function unwindWork(workInProgress, renderLanes) {
|
|
|
19827
19880
|
popContext(workInProgress);
|
|
19828
19881
|
}
|
|
19829
19882
|
|
|
19830
|
-
var
|
|
19883
|
+
var flags = workInProgress.flags;
|
|
19831
19884
|
|
|
19832
|
-
if (
|
|
19833
|
-
workInProgress.
|
|
19885
|
+
if (flags & ShouldCapture) {
|
|
19886
|
+
workInProgress.flags = flags & ~ShouldCapture | DidCapture;
|
|
19834
19887
|
|
|
19835
19888
|
if ( (workInProgress.mode & ProfileMode) !== NoMode) {
|
|
19836
19889
|
transferActualDuration(workInProgress);
|
|
@@ -19847,15 +19900,15 @@ function unwindWork(workInProgress, renderLanes) {
|
|
|
19847
19900
|
popHostContainer(workInProgress);
|
|
19848
19901
|
popTopLevelContextObject(workInProgress);
|
|
19849
19902
|
resetWorkInProgressVersions();
|
|
19850
|
-
var
|
|
19903
|
+
var _flags = workInProgress.flags;
|
|
19851
19904
|
|
|
19852
|
-
if (!((
|
|
19905
|
+
if (!((_flags & DidCapture) === NoFlags)) {
|
|
19853
19906
|
{
|
|
19854
19907
|
throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." );
|
|
19855
19908
|
}
|
|
19856
19909
|
}
|
|
19857
19910
|
|
|
19858
|
-
workInProgress.
|
|
19911
|
+
workInProgress.flags = _flags & ~ShouldCapture | DidCapture;
|
|
19859
19912
|
return workInProgress;
|
|
19860
19913
|
}
|
|
19861
19914
|
|
|
@@ -19870,10 +19923,10 @@ function unwindWork(workInProgress, renderLanes) {
|
|
|
19870
19923
|
{
|
|
19871
19924
|
popSuspenseContext(workInProgress);
|
|
19872
19925
|
|
|
19873
|
-
var
|
|
19926
|
+
var _flags2 = workInProgress.flags;
|
|
19874
19927
|
|
|
19875
|
-
if (
|
|
19876
|
-
workInProgress.
|
|
19928
|
+
if (_flags2 & ShouldCapture) {
|
|
19929
|
+
workInProgress.flags = _flags2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary.
|
|
19877
19930
|
|
|
19878
19931
|
if ( (workInProgress.mode & ProfileMode) !== NoMode) {
|
|
19879
19932
|
transferActualDuration(workInProgress);
|
|
@@ -20157,7 +20210,7 @@ function attachPingListener(root, wakeable, lanes) {
|
|
|
20157
20210
|
|
|
20158
20211
|
function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes) {
|
|
20159
20212
|
// The source fiber did not complete.
|
|
20160
|
-
sourceFiber.
|
|
20213
|
+
sourceFiber.flags |= Incomplete; // Its effect list is no longer valid.
|
|
20161
20214
|
|
|
20162
20215
|
sourceFiber.firstEffect = sourceFiber.lastEffect = null;
|
|
20163
20216
|
|
|
@@ -20208,12 +20261,12 @@ function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes)
|
|
|
20208
20261
|
|
|
20209
20262
|
|
|
20210
20263
|
if ((_workInProgress.mode & BlockingMode) === NoMode) {
|
|
20211
|
-
_workInProgress.
|
|
20212
|
-
sourceFiber.
|
|
20264
|
+
_workInProgress.flags |= DidCapture;
|
|
20265
|
+
sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete.
|
|
20213
20266
|
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
|
20214
20267
|
// all lifecycle effect tags.
|
|
20215
20268
|
|
|
20216
|
-
sourceFiber.
|
|
20269
|
+
sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete);
|
|
20217
20270
|
|
|
20218
20271
|
if (sourceFiber.tag === ClassComponent) {
|
|
20219
20272
|
var currentSourceFiber = sourceFiber.alternate;
|
|
@@ -20263,8 +20316,8 @@ function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes)
|
|
|
20263
20316
|
// that we can show the initial loading state as quickly as possible.
|
|
20264
20317
|
//
|
|
20265
20318
|
// If we hit a "Delayed" case, such as when we'd switch from content back into
|
|
20266
|
-
// a fallback, then we should always suspend/restart.
|
|
20267
|
-
// this case. If none is defined, JND is used instead.
|
|
20319
|
+
// a fallback, then we should always suspend/restart. Transitions apply
|
|
20320
|
+
// to this case. If none is defined, JND is used instead.
|
|
20268
20321
|
//
|
|
20269
20322
|
// If we're already showing a fallback and it gets "retried", allowing us to show
|
|
20270
20323
|
// another level, but there's still an inner boundary that would show a fallback,
|
|
@@ -20281,7 +20334,7 @@ function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes)
|
|
|
20281
20334
|
|
|
20282
20335
|
|
|
20283
20336
|
attachPingListener(root, wakeable, rootRenderLanes);
|
|
20284
|
-
_workInProgress.
|
|
20337
|
+
_workInProgress.flags |= ShouldCapture;
|
|
20285
20338
|
_workInProgress.lanes = rootRenderLanes;
|
|
20286
20339
|
return;
|
|
20287
20340
|
} // This boundary already captured during this render. Continue to the next
|
|
@@ -20308,7 +20361,7 @@ function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes)
|
|
|
20308
20361
|
case HostRoot:
|
|
20309
20362
|
{
|
|
20310
20363
|
var _errorInfo = value;
|
|
20311
|
-
workInProgress.
|
|
20364
|
+
workInProgress.flags |= ShouldCapture;
|
|
20312
20365
|
var lane = pickArbitraryLane(rootRenderLanes);
|
|
20313
20366
|
workInProgress.lanes = mergeLanes(workInProgress.lanes, lane);
|
|
20314
20367
|
|
|
@@ -20324,8 +20377,8 @@ function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes)
|
|
|
20324
20377
|
var ctor = workInProgress.type;
|
|
20325
20378
|
var instance = workInProgress.stateNode;
|
|
20326
20379
|
|
|
20327
|
-
if ((workInProgress.
|
|
20328
|
-
workInProgress.
|
|
20380
|
+
if ((workInProgress.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
|
|
20381
|
+
workInProgress.flags |= ShouldCapture;
|
|
20329
20382
|
|
|
20330
20383
|
var _lane = pickArbitraryLane(rootRenderLanes);
|
|
20331
20384
|
|
|
@@ -20362,18 +20415,18 @@ var callComponentWillUnmountWithTimer = function (current, instance) {
|
|
|
20362
20415
|
}; // Capture errors so they don't interrupt unmounting.
|
|
20363
20416
|
|
|
20364
20417
|
|
|
20365
|
-
function safelyCallComponentWillUnmount(current, instance
|
|
20418
|
+
function safelyCallComponentWillUnmount(current, instance) {
|
|
20366
20419
|
{
|
|
20367
20420
|
invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current, instance);
|
|
20368
20421
|
|
|
20369
20422
|
if (hasCaughtError()) {
|
|
20370
20423
|
var unmountError = clearCaughtError();
|
|
20371
|
-
captureCommitPhaseError(current,
|
|
20424
|
+
captureCommitPhaseError(current, unmountError);
|
|
20372
20425
|
}
|
|
20373
20426
|
}
|
|
20374
20427
|
}
|
|
20375
20428
|
|
|
20376
|
-
function safelyDetachRef(current
|
|
20429
|
+
function safelyDetachRef(current) {
|
|
20377
20430
|
var ref = current.ref;
|
|
20378
20431
|
|
|
20379
20432
|
if (ref !== null) {
|
|
@@ -20383,7 +20436,7 @@ function safelyDetachRef(current, nearestMountedAncestor) {
|
|
|
20383
20436
|
|
|
20384
20437
|
if (hasCaughtError()) {
|
|
20385
20438
|
var refError = clearCaughtError();
|
|
20386
|
-
captureCommitPhaseError(current,
|
|
20439
|
+
captureCommitPhaseError(current, refError);
|
|
20387
20440
|
}
|
|
20388
20441
|
}
|
|
20389
20442
|
} else {
|
|
@@ -20392,13 +20445,13 @@ function safelyDetachRef(current, nearestMountedAncestor) {
|
|
|
20392
20445
|
}
|
|
20393
20446
|
}
|
|
20394
20447
|
|
|
20395
|
-
function safelyCallDestroy(current,
|
|
20448
|
+
function safelyCallDestroy(current, destroy) {
|
|
20396
20449
|
{
|
|
20397
20450
|
invokeGuardedCallback(null, destroy, null);
|
|
20398
20451
|
|
|
20399
20452
|
if (hasCaughtError()) {
|
|
20400
20453
|
var error = clearCaughtError();
|
|
20401
|
-
captureCommitPhaseError(current,
|
|
20454
|
+
captureCommitPhaseError(current, error);
|
|
20402
20455
|
}
|
|
20403
20456
|
}
|
|
20404
20457
|
}
|
|
@@ -20415,7 +20468,7 @@ function commitBeforeMutationLifeCycles(current, finishedWork) {
|
|
|
20415
20468
|
|
|
20416
20469
|
case ClassComponent:
|
|
20417
20470
|
{
|
|
20418
|
-
if (finishedWork.
|
|
20471
|
+
if (finishedWork.flags & Snapshot) {
|
|
20419
20472
|
if (current !== null) {
|
|
20420
20473
|
var prevProps = current.memoizedProps;
|
|
20421
20474
|
var prevState = current.memoizedState;
|
|
@@ -20457,7 +20510,7 @@ function commitBeforeMutationLifeCycles(current, finishedWork) {
|
|
|
20457
20510
|
case HostRoot:
|
|
20458
20511
|
{
|
|
20459
20512
|
{
|
|
20460
|
-
if (finishedWork.
|
|
20513
|
+
if (finishedWork.flags & Snapshot) {
|
|
20461
20514
|
var root = finishedWork.stateNode;
|
|
20462
20515
|
clearContainer(root.containerInfo);
|
|
20463
20516
|
}
|
|
@@ -20556,7 +20609,7 @@ function schedulePassiveEffects(finishedWork) {
|
|
|
20556
20609
|
next = _effect.next,
|
|
20557
20610
|
tag = _effect.tag;
|
|
20558
20611
|
|
|
20559
|
-
if ((tag & Passive$1) !==
|
|
20612
|
+
if ((tag & Passive$1) !== NoFlags$1 && (tag & HasEffect) !== NoFlags$1) {
|
|
20560
20613
|
enqueuePendingPassiveHookEffectUnmount(finishedWork, effect);
|
|
20561
20614
|
enqueuePendingPassiveHookEffectMount(finishedWork, effect);
|
|
20562
20615
|
}
|
|
@@ -20589,7 +20642,7 @@ function commitLifeCycles(finishedRoot, current, finishedWork, committedLanes) {
|
|
|
20589
20642
|
{
|
|
20590
20643
|
var instance = finishedWork.stateNode;
|
|
20591
20644
|
|
|
20592
|
-
if (finishedWork.
|
|
20645
|
+
if (finishedWork.flags & Update) {
|
|
20593
20646
|
if (current === null) {
|
|
20594
20647
|
// We could update instance props and state here,
|
|
20595
20648
|
// but instead we rely on them being set during last render.
|
|
@@ -20693,7 +20746,7 @@ function commitLifeCycles(finishedRoot, current, finishedWork, committedLanes) {
|
|
|
20693
20746
|
// These effects should only be committed when components are first mounted,
|
|
20694
20747
|
// aka when there is no current/alternate.
|
|
20695
20748
|
|
|
20696
|
-
if (current === null && finishedWork.
|
|
20749
|
+
if (current === null && finishedWork.flags & Update) {
|
|
20697
20750
|
var type = finishedWork.type;
|
|
20698
20751
|
var props = finishedWork.memoizedProps;
|
|
20699
20752
|
commitMount(_instance2, type, props);
|
|
@@ -20847,7 +20900,7 @@ function commitDetachRef(current) {
|
|
|
20847
20900
|
// interrupt deletion, so it's okay
|
|
20848
20901
|
|
|
20849
20902
|
|
|
20850
|
-
function commitUnmount(finishedRoot, current,
|
|
20903
|
+
function commitUnmount(finishedRoot, current, renderPriorityLevel) {
|
|
20851
20904
|
onCommitUnmount(current);
|
|
20852
20905
|
|
|
20853
20906
|
switch (current.tag) {
|
|
@@ -20872,11 +20925,11 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor, renderPrio
|
|
|
20872
20925
|
tag = _effect2.tag;
|
|
20873
20926
|
|
|
20874
20927
|
if (destroy !== undefined) {
|
|
20875
|
-
if ((tag & Passive$1) !==
|
|
20928
|
+
if ((tag & Passive$1) !== NoFlags$1) {
|
|
20876
20929
|
enqueuePendingPassiveHookEffectUnmount(current, effect);
|
|
20877
20930
|
} else {
|
|
20878
20931
|
{
|
|
20879
|
-
safelyCallDestroy(current,
|
|
20932
|
+
safelyCallDestroy(current, destroy);
|
|
20880
20933
|
}
|
|
20881
20934
|
}
|
|
20882
20935
|
}
|
|
@@ -20891,11 +20944,11 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor, renderPrio
|
|
|
20891
20944
|
|
|
20892
20945
|
case ClassComponent:
|
|
20893
20946
|
{
|
|
20894
|
-
safelyDetachRef(current
|
|
20947
|
+
safelyDetachRef(current);
|
|
20895
20948
|
var instance = current.stateNode;
|
|
20896
20949
|
|
|
20897
20950
|
if (typeof instance.componentWillUnmount === 'function') {
|
|
20898
|
-
safelyCallComponentWillUnmount(current, instance
|
|
20951
|
+
safelyCallComponentWillUnmount(current, instance);
|
|
20899
20952
|
}
|
|
20900
20953
|
|
|
20901
20954
|
return;
|
|
@@ -20903,7 +20956,7 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor, renderPrio
|
|
|
20903
20956
|
|
|
20904
20957
|
case HostComponent:
|
|
20905
20958
|
{
|
|
20906
|
-
safelyDetachRef(current
|
|
20959
|
+
safelyDetachRef(current);
|
|
20907
20960
|
return;
|
|
20908
20961
|
}
|
|
20909
20962
|
|
|
@@ -20913,7 +20966,7 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor, renderPrio
|
|
|
20913
20966
|
// We are also not using this parent because
|
|
20914
20967
|
// the portal will get pushed immediately.
|
|
20915
20968
|
{
|
|
20916
|
-
unmountHostComponents(finishedRoot, current
|
|
20969
|
+
unmountHostComponents(finishedRoot, current);
|
|
20917
20970
|
}
|
|
20918
20971
|
|
|
20919
20972
|
return;
|
|
@@ -20939,7 +20992,7 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor, renderPrio
|
|
|
20939
20992
|
}
|
|
20940
20993
|
}
|
|
20941
20994
|
|
|
20942
|
-
function commitNestedUnmounts(finishedRoot, root,
|
|
20995
|
+
function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) {
|
|
20943
20996
|
// While we're inside a removed host node we don't want to call
|
|
20944
20997
|
// removeChild on the inner nodes because they're removed by the top
|
|
20945
20998
|
// call anyway. We also want to call componentWillUnmount on all
|
|
@@ -20948,7 +21001,7 @@ function commitNestedUnmounts(finishedRoot, root, nearestMountedAncestor, render
|
|
|
20948
21001
|
var node = root;
|
|
20949
21002
|
|
|
20950
21003
|
while (true) {
|
|
20951
|
-
commitUnmount(finishedRoot, node
|
|
21004
|
+
commitUnmount(finishedRoot, node); // Visit children because they may contain more composite or host nodes.
|
|
20952
21005
|
// Skip portals because commitUnmount() currently visits them recursively.
|
|
20953
21006
|
|
|
20954
21007
|
if (node.child !== null && ( // If we use mutation we drill down into portals using commitUnmount above.
|
|
@@ -21053,7 +21106,7 @@ function getHostSibling(fiber) {
|
|
|
21053
21106
|
while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) {
|
|
21054
21107
|
// If it is not host node and, we might have a host node inside it.
|
|
21055
21108
|
// Try to search down until we find one.
|
|
21056
|
-
if (node.
|
|
21109
|
+
if (node.flags & Placement) {
|
|
21057
21110
|
// If we don't have a child, try the siblings instead.
|
|
21058
21111
|
continue siblings;
|
|
21059
21112
|
} // If we don't have a child, try the siblings instead.
|
|
@@ -21069,7 +21122,7 @@ function getHostSibling(fiber) {
|
|
|
21069
21122
|
} // Check if this host node is stable or about to be placed.
|
|
21070
21123
|
|
|
21071
21124
|
|
|
21072
|
-
if (!(node.
|
|
21125
|
+
if (!(node.flags & Placement)) {
|
|
21073
21126
|
// Found it!
|
|
21074
21127
|
return node.stateNode;
|
|
21075
21128
|
}
|
|
@@ -21114,11 +21167,11 @@ function commitPlacement(finishedWork) {
|
|
|
21114
21167
|
|
|
21115
21168
|
}
|
|
21116
21169
|
|
|
21117
|
-
if (parentFiber.
|
|
21170
|
+
if (parentFiber.flags & ContentReset) {
|
|
21118
21171
|
// Reset the text content of the parent before doing any insertions
|
|
21119
21172
|
resetTextContent(parent); // Clear ContentReset from the effect tag
|
|
21120
21173
|
|
|
21121
|
-
parentFiber.
|
|
21174
|
+
parentFiber.flags &= ~ContentReset;
|
|
21122
21175
|
}
|
|
21123
21176
|
|
|
21124
21177
|
var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its
|
|
@@ -21185,7 +21238,7 @@ function insertOrAppendPlacementNode(node, before, parent) {
|
|
|
21185
21238
|
}
|
|
21186
21239
|
}
|
|
21187
21240
|
|
|
21188
|
-
function unmountHostComponents(finishedRoot, current,
|
|
21241
|
+
function unmountHostComponents(finishedRoot, current, renderPriorityLevel) {
|
|
21189
21242
|
// We only have the top Fiber that was deleted but we need to recurse down its
|
|
21190
21243
|
// children to find all the terminal nodes.
|
|
21191
21244
|
var node = current; // Each iteration, currentParent is populated with node's host parent if not
|
|
@@ -21234,7 +21287,7 @@ function unmountHostComponents(finishedRoot, current, nearestMountedAncestor, re
|
|
|
21234
21287
|
}
|
|
21235
21288
|
|
|
21236
21289
|
if (node.tag === HostComponent || node.tag === HostText) {
|
|
21237
|
-
commitNestedUnmounts(finishedRoot, node
|
|
21290
|
+
commitNestedUnmounts(finishedRoot, node); // After all the children have unmounted, it is now safe to remove the
|
|
21238
21291
|
// node from the tree.
|
|
21239
21292
|
|
|
21240
21293
|
if (currentParentIsContainer) {
|
|
@@ -21255,7 +21308,7 @@ function unmountHostComponents(finishedRoot, current, nearestMountedAncestor, re
|
|
|
21255
21308
|
continue;
|
|
21256
21309
|
}
|
|
21257
21310
|
} else {
|
|
21258
|
-
commitUnmount(finishedRoot, node
|
|
21311
|
+
commitUnmount(finishedRoot, node); // Visit children because we may find more host components below.
|
|
21259
21312
|
|
|
21260
21313
|
if (node.child !== null) {
|
|
21261
21314
|
node.child.return = node;
|
|
@@ -21287,11 +21340,11 @@ function unmountHostComponents(finishedRoot, current, nearestMountedAncestor, re
|
|
|
21287
21340
|
}
|
|
21288
21341
|
}
|
|
21289
21342
|
|
|
21290
|
-
function commitDeletion(finishedRoot, current,
|
|
21343
|
+
function commitDeletion(finishedRoot, current, renderPriorityLevel) {
|
|
21291
21344
|
{
|
|
21292
21345
|
// Recursively delete all host nodes from the parent.
|
|
21293
21346
|
// Detach refs and call componentWillUnmount() on the whole subtree.
|
|
21294
|
-
unmountHostComponents(finishedRoot, current
|
|
21347
|
+
unmountHostComponents(finishedRoot, current);
|
|
21295
21348
|
}
|
|
21296
21349
|
|
|
21297
21350
|
var alternate = current.alternate;
|
|
@@ -21696,7 +21749,7 @@ function requestEventTime() {
|
|
|
21696
21749
|
currentEventTime = now();
|
|
21697
21750
|
return currentEventTime;
|
|
21698
21751
|
}
|
|
21699
|
-
function requestUpdateLane(fiber
|
|
21752
|
+
function requestUpdateLane(fiber) {
|
|
21700
21753
|
// Special cases
|
|
21701
21754
|
var mode = fiber.mode;
|
|
21702
21755
|
|
|
@@ -21724,10 +21777,9 @@ function requestUpdateLane(fiber, suspenseConfig) {
|
|
|
21724
21777
|
currentEventWipLanes = workInProgressRootIncludedLanes;
|
|
21725
21778
|
}
|
|
21726
21779
|
|
|
21727
|
-
|
|
21728
|
-
|
|
21729
|
-
|
|
21730
|
-
// TODO: This will coerce numbers larger than 31 bits to 0.
|
|
21780
|
+
var isTransition = requestCurrentTransition() !== NoTransition;
|
|
21781
|
+
|
|
21782
|
+
if (isTransition) {
|
|
21731
21783
|
if (currentEventPendingLanes !== NoLanes) {
|
|
21732
21784
|
currentEventPendingLanes = mostRecentlyUpdatedRoot !== null ? mostRecentlyUpdatedRoot.pendingLanes : NoLanes;
|
|
21733
21785
|
}
|
|
@@ -21881,7 +21933,7 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
|
|
21881
21933
|
}
|
|
21882
21934
|
|
|
21883
21935
|
{
|
|
21884
|
-
if (alternate === null && (sourceFiber.
|
|
21936
|
+
if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
21885
21937
|
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
|
|
21886
21938
|
}
|
|
21887
21939
|
} // Walk the parent path to the root and update the child expiration time.
|
|
@@ -21898,7 +21950,7 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
|
|
21898
21950
|
alternate.childLanes = mergeLanes(alternate.childLanes, lane);
|
|
21899
21951
|
} else {
|
|
21900
21952
|
{
|
|
21901
|
-
if ((parent.
|
|
21953
|
+
if ((parent.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
21902
21954
|
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
|
|
21903
21955
|
}
|
|
21904
21956
|
}
|
|
@@ -22153,7 +22205,7 @@ function finishConcurrentRender(root, exitStatus, lanes) {
|
|
|
22153
22205
|
if (!shouldForceFlushFallbacksInDEV()) {
|
|
22154
22206
|
// This is not a transition, but we did trigger an avoided state.
|
|
22155
22207
|
// Schedule a placeholder to display after a short delay, using the Just
|
|
22156
|
-
//
|
|
22208
|
+
// Noticeable Difference.
|
|
22157
22209
|
// TODO: Is the JND optimization worth the added complexity? If this is
|
|
22158
22210
|
// the only reason we track the event time, then probably not.
|
|
22159
22211
|
// Consider removing.
|
|
@@ -22752,7 +22804,7 @@ function completeUnitOfWork(unitOfWork) {
|
|
|
22752
22804
|
var current = completedWork.alternate;
|
|
22753
22805
|
var returnFiber = completedWork.return; // Check if the work completed or if something threw.
|
|
22754
22806
|
|
|
22755
|
-
if ((completedWork.
|
|
22807
|
+
if ((completedWork.flags & Incomplete) === NoFlags) {
|
|
22756
22808
|
setCurrentFiber(completedWork);
|
|
22757
22809
|
var next = void 0;
|
|
22758
22810
|
|
|
@@ -22776,7 +22828,7 @@ function completeUnitOfWork(unitOfWork) {
|
|
|
22776
22828
|
resetChildLanes(completedWork);
|
|
22777
22829
|
|
|
22778
22830
|
if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete
|
|
22779
|
-
(returnFiber.
|
|
22831
|
+
(returnFiber.flags & Incomplete) === NoFlags) {
|
|
22780
22832
|
// Append all the effects of the subtree and this fiber onto the effect
|
|
22781
22833
|
// list of the parent. The completion order of the children affects the
|
|
22782
22834
|
// side-effect order.
|
|
@@ -22798,11 +22850,11 @@ function completeUnitOfWork(unitOfWork) {
|
|
|
22798
22850
|
// at the end.
|
|
22799
22851
|
|
|
22800
22852
|
|
|
22801
|
-
var
|
|
22853
|
+
var flags = completedWork.flags; // Skip both NoWork and PerformedWork tags when creating the effect
|
|
22802
22854
|
// list. PerformedWork effect is read by React DevTools but shouldn't be
|
|
22803
22855
|
// committed.
|
|
22804
22856
|
|
|
22805
|
-
if (
|
|
22857
|
+
if (flags > PerformedWork) {
|
|
22806
22858
|
if (returnFiber.lastEffect !== null) {
|
|
22807
22859
|
returnFiber.lastEffect.nextEffect = completedWork;
|
|
22808
22860
|
} else {
|
|
@@ -22824,7 +22876,7 @@ function completeUnitOfWork(unitOfWork) {
|
|
|
22824
22876
|
// back here again.
|
|
22825
22877
|
// Since we're restarting, remove anything that is not a host effect
|
|
22826
22878
|
// from the effect tag.
|
|
22827
|
-
_next.
|
|
22879
|
+
_next.flags &= HostEffectMask;
|
|
22828
22880
|
workInProgress = _next;
|
|
22829
22881
|
return;
|
|
22830
22882
|
}
|
|
@@ -22847,7 +22899,7 @@ function completeUnitOfWork(unitOfWork) {
|
|
|
22847
22899
|
if (returnFiber !== null) {
|
|
22848
22900
|
// Mark the parent fiber as incomplete and clear its effect list.
|
|
22849
22901
|
returnFiber.firstEffect = returnFiber.lastEffect = null;
|
|
22850
|
-
returnFiber.
|
|
22902
|
+
returnFiber.flags |= Incomplete;
|
|
22851
22903
|
}
|
|
22852
22904
|
}
|
|
22853
22905
|
|
|
@@ -23001,7 +23053,7 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
23001
23053
|
|
|
23002
23054
|
var firstEffect;
|
|
23003
23055
|
|
|
23004
|
-
if (finishedWork.
|
|
23056
|
+
if (finishedWork.flags > PerformedWork) {
|
|
23005
23057
|
// A fiber's effect list consists only of its children, not itself. So if
|
|
23006
23058
|
// the root has an effect, we need to add it to the end of the list. The
|
|
23007
23059
|
// resulting list is the set that would belong to the root's parent, if it
|
|
@@ -23046,7 +23098,7 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
23046
23098
|
}
|
|
23047
23099
|
|
|
23048
23100
|
var error = clearCaughtError();
|
|
23049
|
-
captureCommitPhaseError(nextEffect,
|
|
23101
|
+
captureCommitPhaseError(nextEffect, error);
|
|
23050
23102
|
nextEffect = nextEffect.nextEffect;
|
|
23051
23103
|
}
|
|
23052
23104
|
}
|
|
@@ -23077,7 +23129,7 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
23077
23129
|
|
|
23078
23130
|
var _error = clearCaughtError();
|
|
23079
23131
|
|
|
23080
|
-
captureCommitPhaseError(nextEffect,
|
|
23132
|
+
captureCommitPhaseError(nextEffect, _error);
|
|
23081
23133
|
nextEffect = nextEffect.nextEffect;
|
|
23082
23134
|
}
|
|
23083
23135
|
}
|
|
@@ -23107,7 +23159,7 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
23107
23159
|
|
|
23108
23160
|
var _error2 = clearCaughtError();
|
|
23109
23161
|
|
|
23110
|
-
captureCommitPhaseError(nextEffect,
|
|
23162
|
+
captureCommitPhaseError(nextEffect, _error2);
|
|
23111
23163
|
nextEffect = nextEffect.nextEffect;
|
|
23112
23164
|
}
|
|
23113
23165
|
}
|
|
@@ -23153,7 +23205,7 @@ function commitRootImpl(root, renderPriorityLevel) {
|
|
|
23153
23205
|
var nextNextEffect = nextEffect.nextEffect;
|
|
23154
23206
|
nextEffect.nextEffect = null;
|
|
23155
23207
|
|
|
23156
|
-
if (nextEffect.
|
|
23208
|
+
if (nextEffect.flags & Deletion) {
|
|
23157
23209
|
detachFiberAfterEffects(nextEffect);
|
|
23158
23210
|
}
|
|
23159
23211
|
|
|
@@ -23243,7 +23295,7 @@ function commitBeforeMutationEffects() {
|
|
|
23243
23295
|
var current = nextEffect.alternate;
|
|
23244
23296
|
|
|
23245
23297
|
if (!shouldFireAfterActiveInstanceBlur && focusedInstanceHandle !== null) {
|
|
23246
|
-
if ((nextEffect.
|
|
23298
|
+
if ((nextEffect.flags & Deletion) !== NoFlags) {
|
|
23247
23299
|
if (doesFiberContain(nextEffect, focusedInstanceHandle)) {
|
|
23248
23300
|
shouldFireAfterActiveInstanceBlur = true;
|
|
23249
23301
|
}
|
|
@@ -23255,15 +23307,15 @@ function commitBeforeMutationEffects() {
|
|
|
23255
23307
|
}
|
|
23256
23308
|
}
|
|
23257
23309
|
|
|
23258
|
-
var
|
|
23310
|
+
var flags = nextEffect.flags;
|
|
23259
23311
|
|
|
23260
|
-
if ((
|
|
23312
|
+
if ((flags & Snapshot) !== NoFlags) {
|
|
23261
23313
|
setCurrentFiber(nextEffect);
|
|
23262
23314
|
commitBeforeMutationLifeCycles(current, nextEffect);
|
|
23263
23315
|
resetCurrentFiber();
|
|
23264
23316
|
}
|
|
23265
23317
|
|
|
23266
|
-
if ((
|
|
23318
|
+
if ((flags & Passive) !== NoFlags) {
|
|
23267
23319
|
// If there are passive effects, schedule a callback to flush at
|
|
23268
23320
|
// the earliest opportunity.
|
|
23269
23321
|
if (!rootDoesHavePassiveEffects) {
|
|
@@ -23283,13 +23335,13 @@ function commitMutationEffects(root, renderPriorityLevel) {
|
|
|
23283
23335
|
// TODO: Should probably move the bulk of this function to commitWork.
|
|
23284
23336
|
while (nextEffect !== null) {
|
|
23285
23337
|
setCurrentFiber(nextEffect);
|
|
23286
|
-
var
|
|
23338
|
+
var flags = nextEffect.flags;
|
|
23287
23339
|
|
|
23288
|
-
if (
|
|
23340
|
+
if (flags & ContentReset) {
|
|
23289
23341
|
commitResetTextContent(nextEffect);
|
|
23290
23342
|
}
|
|
23291
23343
|
|
|
23292
|
-
if (
|
|
23344
|
+
if (flags & Ref) {
|
|
23293
23345
|
var current = nextEffect.alternate;
|
|
23294
23346
|
|
|
23295
23347
|
if (current !== null) {
|
|
@@ -23301,9 +23353,9 @@ function commitMutationEffects(root, renderPriorityLevel) {
|
|
|
23301
23353
|
// switch on that value.
|
|
23302
23354
|
|
|
23303
23355
|
|
|
23304
|
-
var
|
|
23356
|
+
var primaryFlags = flags & (Placement | Update | Deletion | Hydrating);
|
|
23305
23357
|
|
|
23306
|
-
switch (
|
|
23358
|
+
switch (primaryFlags) {
|
|
23307
23359
|
case Placement:
|
|
23308
23360
|
{
|
|
23309
23361
|
commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is
|
|
@@ -23311,7 +23363,7 @@ function commitMutationEffects(root, renderPriorityLevel) {
|
|
|
23311
23363
|
// TODO: findDOMNode doesn't rely on this any more but isMounted does
|
|
23312
23364
|
// and isMounted is deprecated anyway so we should be able to kill this.
|
|
23313
23365
|
|
|
23314
|
-
nextEffect.
|
|
23366
|
+
nextEffect.flags &= ~Placement;
|
|
23315
23367
|
break;
|
|
23316
23368
|
}
|
|
23317
23369
|
|
|
@@ -23321,7 +23373,7 @@ function commitMutationEffects(root, renderPriorityLevel) {
|
|
|
23321
23373
|
commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is
|
|
23322
23374
|
// inserted, before any life-cycles like componentDidMount gets called.
|
|
23323
23375
|
|
|
23324
|
-
nextEffect.
|
|
23376
|
+
nextEffect.flags &= ~Placement; // Update
|
|
23325
23377
|
|
|
23326
23378
|
var _current = nextEffect.alternate;
|
|
23327
23379
|
commitWork(_current, nextEffect);
|
|
@@ -23330,13 +23382,13 @@ function commitMutationEffects(root, renderPriorityLevel) {
|
|
|
23330
23382
|
|
|
23331
23383
|
case Hydrating:
|
|
23332
23384
|
{
|
|
23333
|
-
nextEffect.
|
|
23385
|
+
nextEffect.flags &= ~Hydrating;
|
|
23334
23386
|
break;
|
|
23335
23387
|
}
|
|
23336
23388
|
|
|
23337
23389
|
case HydratingAndUpdate:
|
|
23338
23390
|
{
|
|
23339
|
-
nextEffect.
|
|
23391
|
+
nextEffect.flags &= ~Hydrating; // Update
|
|
23340
23392
|
|
|
23341
23393
|
var _current2 = nextEffect.alternate;
|
|
23342
23394
|
commitWork(_current2, nextEffect);
|
|
@@ -23352,7 +23404,7 @@ function commitMutationEffects(root, renderPriorityLevel) {
|
|
|
23352
23404
|
|
|
23353
23405
|
case Deletion:
|
|
23354
23406
|
{
|
|
23355
|
-
commitDeletion(root, nextEffect
|
|
23407
|
+
commitDeletion(root, nextEffect);
|
|
23356
23408
|
break;
|
|
23357
23409
|
}
|
|
23358
23410
|
}
|
|
@@ -23367,15 +23419,15 @@ function commitLayoutEffects(root, committedLanes) {
|
|
|
23367
23419
|
|
|
23368
23420
|
while (nextEffect !== null) {
|
|
23369
23421
|
setCurrentFiber(nextEffect);
|
|
23370
|
-
var
|
|
23422
|
+
var flags = nextEffect.flags;
|
|
23371
23423
|
|
|
23372
|
-
if (
|
|
23424
|
+
if (flags & (Update | Callback)) {
|
|
23373
23425
|
var current = nextEffect.alternate;
|
|
23374
23426
|
commitLifeCycles(root, current, nextEffect);
|
|
23375
23427
|
}
|
|
23376
23428
|
|
|
23377
23429
|
{
|
|
23378
|
-
if (
|
|
23430
|
+
if (flags & Ref) {
|
|
23379
23431
|
commitAttachRef(nextEffect);
|
|
23380
23432
|
}
|
|
23381
23433
|
}
|
|
@@ -23413,11 +23465,11 @@ function enqueuePendingPassiveHookEffectUnmount(fiber, effect) {
|
|
|
23413
23465
|
pendingPassiveHookEffectsUnmount.push(effect, fiber);
|
|
23414
23466
|
|
|
23415
23467
|
{
|
|
23416
|
-
fiber.
|
|
23468
|
+
fiber.flags |= PassiveUnmountPendingDev;
|
|
23417
23469
|
var alternate = fiber.alternate;
|
|
23418
23470
|
|
|
23419
23471
|
if (alternate !== null) {
|
|
23420
|
-
alternate.
|
|
23472
|
+
alternate.flags |= PassiveUnmountPendingDev;
|
|
23421
23473
|
}
|
|
23422
23474
|
}
|
|
23423
23475
|
|
|
@@ -23475,11 +23527,11 @@ function flushPassiveEffectsImpl() {
|
|
|
23475
23527
|
_effect.destroy = undefined;
|
|
23476
23528
|
|
|
23477
23529
|
{
|
|
23478
|
-
fiber.
|
|
23530
|
+
fiber.flags &= ~PassiveUnmountPendingDev;
|
|
23479
23531
|
var alternate = fiber.alternate;
|
|
23480
23532
|
|
|
23481
23533
|
if (alternate !== null) {
|
|
23482
|
-
alternate.
|
|
23534
|
+
alternate.flags &= ~PassiveUnmountPendingDev;
|
|
23483
23535
|
}
|
|
23484
23536
|
}
|
|
23485
23537
|
|
|
@@ -23499,7 +23551,7 @@ function flushPassiveEffectsImpl() {
|
|
|
23499
23551
|
}
|
|
23500
23552
|
|
|
23501
23553
|
var error = clearCaughtError();
|
|
23502
|
-
captureCommitPhaseError(fiber,
|
|
23554
|
+
captureCommitPhaseError(fiber, error);
|
|
23503
23555
|
}
|
|
23504
23556
|
|
|
23505
23557
|
resetCurrentFiber();
|
|
@@ -23531,7 +23583,7 @@ function flushPassiveEffectsImpl() {
|
|
|
23531
23583
|
|
|
23532
23584
|
var _error4 = clearCaughtError();
|
|
23533
23585
|
|
|
23534
|
-
captureCommitPhaseError(_fiber,
|
|
23586
|
+
captureCommitPhaseError(_fiber, _error4);
|
|
23535
23587
|
}
|
|
23536
23588
|
|
|
23537
23589
|
resetCurrentFiber();
|
|
@@ -23548,7 +23600,7 @@ function flushPassiveEffectsImpl() {
|
|
|
23548
23600
|
|
|
23549
23601
|
effect.nextEffect = null;
|
|
23550
23602
|
|
|
23551
|
-
if (effect.
|
|
23603
|
+
if (effect.flags & Deletion) {
|
|
23552
23604
|
detachFiberAfterEffects(effect);
|
|
23553
23605
|
}
|
|
23554
23606
|
|
|
@@ -23606,7 +23658,7 @@ function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) {
|
|
|
23606
23658
|
}
|
|
23607
23659
|
}
|
|
23608
23660
|
|
|
23609
|
-
function captureCommitPhaseError(sourceFiber,
|
|
23661
|
+
function captureCommitPhaseError(sourceFiber, error) {
|
|
23610
23662
|
if (sourceFiber.tag === HostRoot) {
|
|
23611
23663
|
// Error was thrown at the root. There is no parent, so the root
|
|
23612
23664
|
// itself should capture it.
|
|
@@ -23614,11 +23666,7 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) {
|
|
|
23614
23666
|
return;
|
|
23615
23667
|
}
|
|
23616
23668
|
|
|
23617
|
-
var fiber =
|
|
23618
|
-
|
|
23619
|
-
{
|
|
23620
|
-
fiber = sourceFiber.return;
|
|
23621
|
-
}
|
|
23669
|
+
var fiber = sourceFiber.return;
|
|
23622
23670
|
|
|
23623
23671
|
while (fiber !== null) {
|
|
23624
23672
|
if (fiber.tag === HostRoot) {
|
|
@@ -23839,7 +23887,7 @@ function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
|
|
|
23839
23887
|
// we can assume that they would have prevented this update.
|
|
23840
23888
|
|
|
23841
23889
|
|
|
23842
|
-
if ((fiber.
|
|
23890
|
+
if ((fiber.flags & PassiveUnmountPendingDev) !== NoFlags) {
|
|
23843
23891
|
return;
|
|
23844
23892
|
} // We show the whole stack but dedupe on the top component's name because
|
|
23845
23893
|
// the problematic code almost always lies inside that component.
|
|
@@ -24184,27 +24232,15 @@ function finishPendingInteractions(root, committedLanes) {
|
|
|
24184
24232
|
});
|
|
24185
24233
|
}
|
|
24186
24234
|
} // `act` testing API
|
|
24187
|
-
//
|
|
24188
|
-
// TODO: This is mostly a copy-paste from the legacy `act`, which does not have
|
|
24189
|
-
// access to the same internals that we do here. Some trade offs in the
|
|
24190
|
-
// implementation no longer make sense.
|
|
24191
|
-
|
|
24192
|
-
|
|
24193
|
-
var isFlushingAct = false;
|
|
24194
|
-
var isInsideThisAct = false; // TODO: Yes, this is confusing. See above comment. We'll refactor it.
|
|
24195
24235
|
|
|
24196
24236
|
function shouldForceFlushFallbacksInDEV() {
|
|
24237
|
+
// Never force flush in production. This function should get stripped out.
|
|
24238
|
+
return actingUpdatesScopeDepth > 0;
|
|
24239
|
+
}
|
|
24240
|
+
// so we can tell if any async act() calls try to run in parallel.
|
|
24197
24241
|
|
|
24198
24242
|
|
|
24199
|
-
|
|
24200
|
-
// `isInsideAct` is only used by the reconciler implementation of `act`.
|
|
24201
|
-
// We don't want to flush suspense fallbacks until the end.
|
|
24202
|
-
return !isInsideThisAct;
|
|
24203
|
-
} // Flush callbacks at the end.
|
|
24204
|
-
|
|
24205
|
-
|
|
24206
|
-
return isFlushingAct;
|
|
24207
|
-
}
|
|
24243
|
+
var actingUpdatesScopeDepth = 0;
|
|
24208
24244
|
|
|
24209
24245
|
function detachFiberAfterEffects(fiber) {
|
|
24210
24246
|
fiber.sibling = null;
|
|
@@ -24647,7 +24683,7 @@ function FiberNode(tag, pendingProps, key, mode) {
|
|
|
24647
24683
|
this.dependencies = null;
|
|
24648
24684
|
this.mode = mode; // Effects
|
|
24649
24685
|
|
|
24650
|
-
this.
|
|
24686
|
+
this.flags = NoFlags;
|
|
24651
24687
|
this.nextEffect = null;
|
|
24652
24688
|
this.firstEffect = null;
|
|
24653
24689
|
this.lastEffect = null;
|
|
@@ -24769,7 +24805,7 @@ function createWorkInProgress(current, pendingProps) {
|
|
|
24769
24805
|
workInProgress.type = current.type; // We already have an alternate.
|
|
24770
24806
|
// Reset the effect tag.
|
|
24771
24807
|
|
|
24772
|
-
workInProgress.
|
|
24808
|
+
workInProgress.flags = NoFlags; // The effect list is no longer valid.
|
|
24773
24809
|
|
|
24774
24810
|
workInProgress.nextEffect = null;
|
|
24775
24811
|
workInProgress.firstEffect = null;
|
|
@@ -24840,7 +24876,7 @@ function resetWorkInProgress(workInProgress, renderLanes) {
|
|
|
24840
24876
|
// avoid doing another reconciliation.
|
|
24841
24877
|
// Reset the effect tag but keep any Placement tags, since that's something
|
|
24842
24878
|
// that child fiber is setting, not the reconciliation.
|
|
24843
|
-
workInProgress.
|
|
24879
|
+
workInProgress.flags &= Placement; // The effect list is no longer valid.
|
|
24844
24880
|
|
|
24845
24881
|
workInProgress.nextEffect = null;
|
|
24846
24882
|
workInProgress.firstEffect = null;
|
|
@@ -25188,7 +25224,7 @@ function assignFiberPropertiesInDEV(target, source) {
|
|
|
25188
25224
|
target.memoizedState = source.memoizedState;
|
|
25189
25225
|
target.dependencies = source.dependencies;
|
|
25190
25226
|
target.mode = source.mode;
|
|
25191
|
-
target.
|
|
25227
|
+
target.flags = source.flags;
|
|
25192
25228
|
target.nextEffect = source.nextEffect;
|
|
25193
25229
|
target.firstEffect = source.firstEffect;
|
|
25194
25230
|
target.lastEffect = source.lastEffect;
|
|
@@ -25406,8 +25442,7 @@ function updateContainer(element, container, parentComponent, callback) {
|
|
|
25406
25442
|
}
|
|
25407
25443
|
}
|
|
25408
25444
|
|
|
25409
|
-
var
|
|
25410
|
-
var lane = requestUpdateLane(current$1, suspenseConfig);
|
|
25445
|
+
var lane = requestUpdateLane(current$1);
|
|
25411
25446
|
|
|
25412
25447
|
var context = getContextForSubtree(parentComponent);
|
|
25413
25448
|
|
|
@@ -25517,7 +25552,7 @@ function attemptHydrationAtCurrentPriority$1(fiber) {
|
|
|
25517
25552
|
}
|
|
25518
25553
|
|
|
25519
25554
|
var eventTime = requestEventTime();
|
|
25520
|
-
var lane = requestUpdateLane(fiber
|
|
25555
|
+
var lane = requestUpdateLane(fiber);
|
|
25521
25556
|
scheduleUpdateOnFiber(fiber, lane, eventTime);
|
|
25522
25557
|
markRetryLaneIfNotHydrated(fiber, lane);
|
|
25523
25558
|
}
|
|
@@ -25551,29 +25586,96 @@ function shouldSuspend(fiber) {
|
|
|
25551
25586
|
return shouldSuspendImpl(fiber);
|
|
25552
25587
|
}
|
|
25553
25588
|
var overrideHookState = null;
|
|
25589
|
+
var overrideHookStateDeletePath = null;
|
|
25590
|
+
var overrideHookStateRenamePath = null;
|
|
25554
25591
|
var overrideProps = null;
|
|
25592
|
+
var overridePropsDeletePath = null;
|
|
25593
|
+
var overridePropsRenamePath = null;
|
|
25555
25594
|
var scheduleUpdate = null;
|
|
25556
25595
|
var setSuspenseHandler = null;
|
|
25557
25596
|
|
|
25558
25597
|
{
|
|
25559
|
-
var
|
|
25560
|
-
|
|
25598
|
+
var copyWithDeleteImpl = function (obj, path, index) {
|
|
25599
|
+
var key = path[index];
|
|
25600
|
+
var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
|
|
25601
|
+
|
|
25602
|
+
if (index + 1 === path.length) {
|
|
25603
|
+
if (Array.isArray(updated)) {
|
|
25604
|
+
updated.splice(key, 1);
|
|
25605
|
+
} else {
|
|
25606
|
+
delete updated[key];
|
|
25607
|
+
}
|
|
25608
|
+
|
|
25609
|
+
return updated;
|
|
25610
|
+
} // $FlowFixMe number or string is fine here
|
|
25611
|
+
|
|
25612
|
+
|
|
25613
|
+
updated[key] = copyWithDeleteImpl(obj[key], path, index + 1);
|
|
25614
|
+
return updated;
|
|
25615
|
+
};
|
|
25616
|
+
|
|
25617
|
+
var copyWithDelete = function (obj, path) {
|
|
25618
|
+
return copyWithDeleteImpl(obj, path, 0);
|
|
25619
|
+
};
|
|
25620
|
+
|
|
25621
|
+
var copyWithRenameImpl = function (obj, oldPath, newPath, index) {
|
|
25622
|
+
var oldKey = oldPath[index];
|
|
25623
|
+
var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
|
|
25624
|
+
|
|
25625
|
+
if (index + 1 === oldPath.length) {
|
|
25626
|
+
var newKey = newPath[index]; // $FlowFixMe number or string is fine here
|
|
25627
|
+
|
|
25628
|
+
updated[newKey] = updated[oldKey];
|
|
25629
|
+
|
|
25630
|
+
if (Array.isArray(updated)) {
|
|
25631
|
+
updated.splice(oldKey, 1);
|
|
25632
|
+
} else {
|
|
25633
|
+
delete updated[oldKey];
|
|
25634
|
+
}
|
|
25635
|
+
} else {
|
|
25636
|
+
// $FlowFixMe number or string is fine here
|
|
25637
|
+
updated[oldKey] = copyWithRenameImpl( // $FlowFixMe number or string is fine here
|
|
25638
|
+
obj[oldKey], oldPath, newPath, index + 1);
|
|
25639
|
+
}
|
|
25640
|
+
|
|
25641
|
+
return updated;
|
|
25642
|
+
};
|
|
25643
|
+
|
|
25644
|
+
var copyWithRename = function (obj, oldPath, newPath) {
|
|
25645
|
+
if (oldPath.length !== newPath.length) {
|
|
25646
|
+
warn('copyWithRename() expects paths of the same length');
|
|
25647
|
+
|
|
25648
|
+
return;
|
|
25649
|
+
} else {
|
|
25650
|
+
for (var i = 0; i < newPath.length - 1; i++) {
|
|
25651
|
+
if (oldPath[i] !== newPath[i]) {
|
|
25652
|
+
warn('copyWithRename() expects paths to be the same except for the deepest key');
|
|
25653
|
+
|
|
25654
|
+
return;
|
|
25655
|
+
}
|
|
25656
|
+
}
|
|
25657
|
+
}
|
|
25658
|
+
|
|
25659
|
+
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
25660
|
+
};
|
|
25661
|
+
|
|
25662
|
+
var copyWithSetImpl = function (obj, path, index, value) {
|
|
25663
|
+
if (index >= path.length) {
|
|
25561
25664
|
return value;
|
|
25562
25665
|
}
|
|
25563
25666
|
|
|
25564
|
-
var key = path[
|
|
25667
|
+
var key = path[index];
|
|
25565
25668
|
var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); // $FlowFixMe number or string is fine here
|
|
25566
25669
|
|
|
25567
|
-
updated[key] = copyWithSetImpl(obj[key], path,
|
|
25670
|
+
updated[key] = copyWithSetImpl(obj[key], path, index + 1, value);
|
|
25568
25671
|
return updated;
|
|
25569
25672
|
};
|
|
25570
25673
|
|
|
25571
25674
|
var copyWithSet = function (obj, path, value) {
|
|
25572
25675
|
return copyWithSetImpl(obj, path, 0, value);
|
|
25573
|
-
};
|
|
25574
|
-
|
|
25676
|
+
};
|
|
25575
25677
|
|
|
25576
|
-
|
|
25678
|
+
var findHook = function (fiber, id) {
|
|
25577
25679
|
// For now, the "id" of stateful hooks is just the stateful hook index.
|
|
25578
25680
|
// This may change in the future with e.g. nested hooks.
|
|
25579
25681
|
var currentHook = fiber.memoizedState;
|
|
@@ -25583,10 +25685,51 @@ var setSuspenseHandler = null;
|
|
|
25583
25685
|
id--;
|
|
25584
25686
|
}
|
|
25585
25687
|
|
|
25586
|
-
|
|
25587
|
-
|
|
25588
|
-
|
|
25589
|
-
|
|
25688
|
+
return currentHook;
|
|
25689
|
+
}; // Support DevTools editable values for useState and useReducer.
|
|
25690
|
+
|
|
25691
|
+
|
|
25692
|
+
overrideHookState = function (fiber, id, path, value) {
|
|
25693
|
+
var hook = findHook(fiber, id);
|
|
25694
|
+
|
|
25695
|
+
if (hook !== null) {
|
|
25696
|
+
var newState = copyWithSet(hook.memoizedState, path, value);
|
|
25697
|
+
hook.memoizedState = newState;
|
|
25698
|
+
hook.baseState = newState; // We aren't actually adding an update to the queue,
|
|
25699
|
+
// because there is no update we can add for useReducer hooks that won't trigger an error.
|
|
25700
|
+
// (There's no appropriate action type for DevTools overrides.)
|
|
25701
|
+
// As a result though, React will see the scheduled update as a noop and bailout.
|
|
25702
|
+
// Shallow cloning props works as a workaround for now to bypass the bailout check.
|
|
25703
|
+
|
|
25704
|
+
fiber.memoizedProps = _assign({}, fiber.memoizedProps);
|
|
25705
|
+
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
25706
|
+
}
|
|
25707
|
+
};
|
|
25708
|
+
|
|
25709
|
+
overrideHookStateDeletePath = function (fiber, id, path) {
|
|
25710
|
+
var hook = findHook(fiber, id);
|
|
25711
|
+
|
|
25712
|
+
if (hook !== null) {
|
|
25713
|
+
var newState = copyWithDelete(hook.memoizedState, path);
|
|
25714
|
+
hook.memoizedState = newState;
|
|
25715
|
+
hook.baseState = newState; // We aren't actually adding an update to the queue,
|
|
25716
|
+
// because there is no update we can add for useReducer hooks that won't trigger an error.
|
|
25717
|
+
// (There's no appropriate action type for DevTools overrides.)
|
|
25718
|
+
// As a result though, React will see the scheduled update as a noop and bailout.
|
|
25719
|
+
// Shallow cloning props works as a workaround for now to bypass the bailout check.
|
|
25720
|
+
|
|
25721
|
+
fiber.memoizedProps = _assign({}, fiber.memoizedProps);
|
|
25722
|
+
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
25723
|
+
}
|
|
25724
|
+
};
|
|
25725
|
+
|
|
25726
|
+
overrideHookStateRenamePath = function (fiber, id, oldPath, newPath) {
|
|
25727
|
+
var hook = findHook(fiber, id);
|
|
25728
|
+
|
|
25729
|
+
if (hook !== null) {
|
|
25730
|
+
var newState = copyWithRename(hook.memoizedState, oldPath, newPath);
|
|
25731
|
+
hook.memoizedState = newState;
|
|
25732
|
+
hook.baseState = newState; // We aren't actually adding an update to the queue,
|
|
25590
25733
|
// because there is no update we can add for useReducer hooks that won't trigger an error.
|
|
25591
25734
|
// (There's no appropriate action type for DevTools overrides.)
|
|
25592
25735
|
// As a result though, React will see the scheduled update as a noop and bailout.
|
|
@@ -25608,6 +25751,26 @@ var setSuspenseHandler = null;
|
|
|
25608
25751
|
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
25609
25752
|
};
|
|
25610
25753
|
|
|
25754
|
+
overridePropsDeletePath = function (fiber, path) {
|
|
25755
|
+
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path);
|
|
25756
|
+
|
|
25757
|
+
if (fiber.alternate) {
|
|
25758
|
+
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
25759
|
+
}
|
|
25760
|
+
|
|
25761
|
+
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
25762
|
+
};
|
|
25763
|
+
|
|
25764
|
+
overridePropsRenamePath = function (fiber, oldPath, newPath) {
|
|
25765
|
+
fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
|
|
25766
|
+
|
|
25767
|
+
if (fiber.alternate) {
|
|
25768
|
+
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
25769
|
+
}
|
|
25770
|
+
|
|
25771
|
+
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
25772
|
+
};
|
|
25773
|
+
|
|
25611
25774
|
scheduleUpdate = function (fiber) {
|
|
25612
25775
|
scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
|
|
25613
25776
|
};
|
|
@@ -25644,7 +25807,11 @@ function injectIntoDevTools(devToolsConfig) {
|
|
|
25644
25807
|
rendererPackageName: devToolsConfig.rendererPackageName,
|
|
25645
25808
|
rendererConfig: devToolsConfig.rendererConfig,
|
|
25646
25809
|
overrideHookState: overrideHookState,
|
|
25810
|
+
overrideHookStateDeletePath: overrideHookStateDeletePath,
|
|
25811
|
+
overrideHookStateRenamePath: overrideHookStateRenamePath,
|
|
25647
25812
|
overrideProps: overrideProps,
|
|
25813
|
+
overridePropsDeletePath: overridePropsDeletePath,
|
|
25814
|
+
overridePropsRenamePath: overridePropsRenamePath,
|
|
25648
25815
|
setSuspenseHandler: setSuspenseHandler,
|
|
25649
25816
|
scheduleUpdate: scheduleUpdate,
|
|
25650
25817
|
currentDispatcherRef: ReactCurrentDispatcher,
|
|
@@ -26056,7 +26223,8 @@ function unstable_createPortal(children, container) {
|
|
|
26056
26223
|
var Internals = {
|
|
26057
26224
|
// Keep in sync with ReactTestUtils.js, and ReactTestUtilsAct.js.
|
|
26058
26225
|
// This is an array for better minification.
|
|
26059
|
-
Events: [getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, restoreStateIfNeeded, flushPassiveEffects,
|
|
26226
|
+
Events: [getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, restoreStateIfNeeded, flushPassiveEffects, // TODO: This is related to `act`, not events. Move to separate key?
|
|
26227
|
+
IsThisRendererActing]
|
|
26060
26228
|
};
|
|
26061
26229
|
var foundDevTools = injectIntoDevTools({
|
|
26062
26230
|
findFiberByHostInstance: getClosestInstanceFromNode,
|