React sync for revisions a7b9f98...4eed18d
Reviewed By: gaearon Differential Revision: D6875052 fbshipit-source-id: 516f46f1b78bd8ca3323ba119d3afda491d76497
This commit is contained in:
parent
e485cde187
commit
13829751b1
|
@ -1 +1 @@
|
||||||
a7b9f98e7abab7305978b4b36881c8267a450097
|
4eed18dd72cb811de11bd34b8ff86e4d193c7d4e
|
File diff suppressed because it is too large
Load Diff
|
@ -1021,35 +1021,32 @@ function restoreStateOfTarget(target) {
|
||||||
null.restoreControlledState(target.stateNode, target.type, props);
|
null.restoreControlledState(target.stateNode, target.type, props);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function fiberBatchedUpdates(fn, bookkeeping) {
|
function _batchedUpdates(fn, bookkeeping) {
|
||||||
return fn(bookkeeping);
|
return fn(bookkeeping);
|
||||||
}
|
}
|
||||||
var isNestingBatched = !1;
|
function _flushInteractiveUpdates() {}
|
||||||
|
var isBatching = !1;
|
||||||
function batchedUpdates(fn, bookkeeping) {
|
function batchedUpdates(fn, bookkeeping) {
|
||||||
if (isNestingBatched) return fiberBatchedUpdates(fn, bookkeeping);
|
if (isBatching) return fn(bookkeeping);
|
||||||
isNestingBatched = !0;
|
isBatching = !0;
|
||||||
try {
|
try {
|
||||||
return fiberBatchedUpdates(fn, bookkeeping);
|
return _batchedUpdates(fn, bookkeeping);
|
||||||
} finally {
|
} finally {
|
||||||
if (
|
if (((isBatching = !1), null !== restoreTarget || null !== restoreQueue))
|
||||||
((isNestingBatched = !1),
|
if (
|
||||||
restoreTarget &&
|
(_flushInteractiveUpdates(),
|
||||||
((bookkeeping = restoreTarget),
|
restoreTarget &&
|
||||||
(fn = restoreQueue),
|
((bookkeeping = restoreTarget),
|
||||||
(restoreQueue = restoreTarget = null),
|
(fn = restoreQueue),
|
||||||
restoreStateOfTarget(bookkeeping),
|
(restoreQueue = restoreTarget = null),
|
||||||
fn))
|
restoreStateOfTarget(bookkeeping),
|
||||||
)
|
fn))
|
||||||
for (bookkeeping = 0; bookkeeping < fn.length; bookkeeping++)
|
)
|
||||||
restoreStateOfTarget(fn[bookkeeping]);
|
for (bookkeeping = 0; bookkeeping < fn.length; bookkeeping++)
|
||||||
|
restoreStateOfTarget(fn[bookkeeping]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var injection$2 = {
|
var ReactNativeTagHandles = {
|
||||||
injectFiberBatchedUpdates: function(_batchedUpdates) {
|
|
||||||
fiberBatchedUpdates = _batchedUpdates;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
ReactNativeTagHandles = {
|
|
||||||
tagsStartAt: 1,
|
tagsStartAt: 1,
|
||||||
tagCount: 1,
|
tagCount: 1,
|
||||||
allocateTag: function() {
|
allocateTag: function() {
|
||||||
|
@ -1174,6 +1171,7 @@ var hasSymbol = "function" === typeof Symbol && Symbol["for"],
|
||||||
: 60108,
|
: 60108,
|
||||||
REACT_PROVIDER_TYPE = hasSymbol ? Symbol["for"]("react.provider") : 60109,
|
REACT_PROVIDER_TYPE = hasSymbol ? Symbol["for"]("react.provider") : 60109,
|
||||||
REACT_CONTEXT_TYPE = hasSymbol ? Symbol["for"]("react.context") : 60110,
|
REACT_CONTEXT_TYPE = hasSymbol ? Symbol["for"]("react.context") : 60110,
|
||||||
|
REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol["for"]("react.async_mode") : 60111,
|
||||||
MAYBE_ITERATOR_SYMBOL = "function" === typeof Symbol && Symbol.iterator;
|
MAYBE_ITERATOR_SYMBOL = "function" === typeof Symbol && Symbol.iterator;
|
||||||
function getIteratorFn(maybeIterable) {
|
function getIteratorFn(maybeIterable) {
|
||||||
if (null === maybeIterable || "undefined" === typeof maybeIterable)
|
if (null === maybeIterable || "undefined" === typeof maybeIterable)
|
||||||
|
@ -1943,7 +1941,7 @@ function invalidateContextProvider(workInProgress, didChange) {
|
||||||
} else pop(didPerformWorkStackCursor, workInProgress);
|
} else pop(didPerformWorkStackCursor, workInProgress);
|
||||||
push(didPerformWorkStackCursor, didChange, workInProgress);
|
push(didPerformWorkStackCursor, didChange, workInProgress);
|
||||||
}
|
}
|
||||||
function FiberNode(tag, pendingProps, key, internalContextTag) {
|
function FiberNode(tag, pendingProps, key, mode) {
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.stateNode = this.type = null;
|
this.stateNode = this.type = null;
|
||||||
|
@ -1952,7 +1950,7 @@ function FiberNode(tag, pendingProps, key, internalContextTag) {
|
||||||
this.ref = null;
|
this.ref = null;
|
||||||
this.pendingProps = pendingProps;
|
this.pendingProps = pendingProps;
|
||||||
this.memoizedState = this.updateQueue = this.memoizedProps = null;
|
this.memoizedState = this.updateQueue = this.memoizedProps = null;
|
||||||
this.internalContextTag = internalContextTag;
|
this.mode = mode;
|
||||||
this.effectTag = 0;
|
this.effectTag = 0;
|
||||||
this.lastEffect = this.firstEffect = this.nextEffect = null;
|
this.lastEffect = this.firstEffect = this.nextEffect = null;
|
||||||
this.expirationTime = 0;
|
this.expirationTime = 0;
|
||||||
|
@ -1965,7 +1963,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
||||||
current.tag,
|
current.tag,
|
||||||
pendingProps,
|
pendingProps,
|
||||||
current.key,
|
current.key,
|
||||||
current.internalContextTag
|
current.mode
|
||||||
)),
|
)),
|
||||||
(workInProgress.type = current.type),
|
(workInProgress.type = current.type),
|
||||||
(workInProgress.stateNode = current.stateNode),
|
(workInProgress.stateNode = current.stateNode),
|
||||||
|
@ -1986,7 +1984,7 @@ function createWorkInProgress(current, pendingProps, expirationTime) {
|
||||||
workInProgress.ref = current.ref;
|
workInProgress.ref = current.ref;
|
||||||
return workInProgress;
|
return workInProgress;
|
||||||
}
|
}
|
||||||
function createFiberFromElement(element, internalContextTag, expirationTime) {
|
function createFiberFromElement(element, mode, expirationTime) {
|
||||||
var type = element.type,
|
var type = element.type,
|
||||||
key = element.key;
|
key = element.key;
|
||||||
element = element.props;
|
element = element.props;
|
||||||
|
@ -1999,13 +1997,17 @@ function createFiberFromElement(element, internalContextTag, expirationTime) {
|
||||||
case REACT_FRAGMENT_TYPE:
|
case REACT_FRAGMENT_TYPE:
|
||||||
return createFiberFromFragment(
|
return createFiberFromFragment(
|
||||||
element.children,
|
element.children,
|
||||||
internalContextTag,
|
mode,
|
||||||
expirationTime,
|
expirationTime,
|
||||||
key
|
key
|
||||||
);
|
);
|
||||||
|
case REACT_ASYNC_MODE_TYPE:
|
||||||
|
fiberTag = 11;
|
||||||
|
mode |= 3;
|
||||||
|
break;
|
||||||
case REACT_STRICT_MODE_TYPE:
|
case REACT_STRICT_MODE_TYPE:
|
||||||
fiberTag = 11;
|
fiberTag = 11;
|
||||||
internalContextTag |= 2;
|
mode |= 2;
|
||||||
break;
|
break;
|
||||||
case REACT_CALL_TYPE:
|
case REACT_CALL_TYPE:
|
||||||
fiberTag = 7;
|
fiberTag = 7;
|
||||||
|
@ -2025,24 +2027,19 @@ function createFiberFromElement(element, internalContextTag, expirationTime) {
|
||||||
default:
|
default:
|
||||||
if ("number" === typeof type.tag)
|
if ("number" === typeof type.tag)
|
||||||
return (
|
return (
|
||||||
(internalContextTag = type),
|
(mode = type),
|
||||||
(internalContextTag.pendingProps = element),
|
(mode.pendingProps = element),
|
||||||
(internalContextTag.expirationTime = expirationTime),
|
(mode.expirationTime = expirationTime),
|
||||||
internalContextTag
|
mode
|
||||||
);
|
);
|
||||||
throwOnInvalidElementType(type, null);
|
throwOnInvalidElementType(type, null);
|
||||||
}
|
}
|
||||||
else throwOnInvalidElementType(type, null);
|
else throwOnInvalidElementType(type, null);
|
||||||
}
|
}
|
||||||
internalContextTag = new FiberNode(
|
mode = new FiberNode(fiberTag, element, key, mode);
|
||||||
fiberTag,
|
mode.type = type;
|
||||||
element,
|
mode.expirationTime = expirationTime;
|
||||||
key,
|
return mode;
|
||||||
internalContextTag
|
|
||||||
);
|
|
||||||
internalContextTag.type = type;
|
|
||||||
internalContextTag.expirationTime = expirationTime;
|
|
||||||
return internalContextTag;
|
|
||||||
}
|
}
|
||||||
function throwOnInvalidElementType(type) {
|
function throwOnInvalidElementType(type) {
|
||||||
invariant(
|
invariant(
|
||||||
|
@ -2052,35 +2049,30 @@ function throwOnInvalidElementType(type) {
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function createFiberFromFragment(
|
function createFiberFromFragment(elements, mode, expirationTime, key) {
|
||||||
elements,
|
elements = new FiberNode(10, elements, key, mode);
|
||||||
internalContextTag,
|
|
||||||
expirationTime,
|
|
||||||
key
|
|
||||||
) {
|
|
||||||
elements = new FiberNode(10, elements, key, internalContextTag);
|
|
||||||
elements.expirationTime = expirationTime;
|
elements.expirationTime = expirationTime;
|
||||||
return elements;
|
return elements;
|
||||||
}
|
}
|
||||||
function createFiberFromText(content, internalContextTag, expirationTime) {
|
function createFiberFromText(content, mode, expirationTime) {
|
||||||
content = new FiberNode(6, content, null, internalContextTag);
|
content = new FiberNode(6, content, null, mode);
|
||||||
content.expirationTime = expirationTime;
|
content.expirationTime = expirationTime;
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
function createFiberFromPortal(portal, internalContextTag, expirationTime) {
|
function createFiberFromPortal(portal, mode, expirationTime) {
|
||||||
internalContextTag = new FiberNode(
|
mode = new FiberNode(
|
||||||
4,
|
4,
|
||||||
null !== portal.children ? portal.children : [],
|
null !== portal.children ? portal.children : [],
|
||||||
portal.key,
|
portal.key,
|
||||||
internalContextTag
|
mode
|
||||||
);
|
);
|
||||||
internalContextTag.expirationTime = expirationTime;
|
mode.expirationTime = expirationTime;
|
||||||
internalContextTag.stateNode = {
|
mode.stateNode = {
|
||||||
containerInfo: portal.containerInfo,
|
containerInfo: portal.containerInfo,
|
||||||
pendingChildren: null,
|
pendingChildren: null,
|
||||||
implementation: portal.implementation
|
implementation: portal.implementation
|
||||||
};
|
};
|
||||||
return internalContextTag;
|
return mode;
|
||||||
}
|
}
|
||||||
var onCommitFiberRoot = null,
|
var onCommitFiberRoot = null,
|
||||||
onCommitFiberUnmount = null;
|
onCommitFiberUnmount = null;
|
||||||
|
@ -2356,18 +2348,14 @@ function ReactFiberClassComponent(
|
||||||
instance.state = workInProgress.memoizedState;
|
instance.state = workInProgress.memoizedState;
|
||||||
instance.refs = emptyObject;
|
instance.refs = emptyObject;
|
||||||
instance.context = getMaskedContext(workInProgress, unmaskedContext);
|
instance.context = getMaskedContext(workInProgress, unmaskedContext);
|
||||||
null != workInProgress.type &&
|
|
||||||
null != workInProgress.type.prototype &&
|
|
||||||
!0 === workInProgress.type.prototype.unstable_isAsyncReactComponent &&
|
|
||||||
((workInProgress.internalContextTag |= 1),
|
|
||||||
(workInProgress.internalContextTag |= 2));
|
|
||||||
("function" !== typeof instance.UNSAFE_componentWillMount &&
|
("function" !== typeof instance.UNSAFE_componentWillMount &&
|
||||||
"function" !== typeof instance.componentWillMount) ||
|
"function" !== typeof instance.componentWillMount) ||
|
||||||
"function" === typeof workInProgress.type.getDerivedStateFromProps ||
|
"function" === typeof workInProgress.type.getDerivedStateFromProps ||
|
||||||
((unmaskedContext = instance.state),
|
((unmaskedContext = instance.state),
|
||||||
"function" === typeof instance.componentWillMount
|
"function" === typeof instance.componentWillMount &&
|
||||||
? instance.componentWillMount()
|
instance.componentWillMount(),
|
||||||
: instance.UNSAFE_componentWillMount(),
|
"function" === typeof instance.UNSAFE_componentWillMount &&
|
||||||
|
instance.UNSAFE_componentWillMount(),
|
||||||
unmaskedContext !== instance.state &&
|
unmaskedContext !== instance.state &&
|
||||||
updater.enqueueReplaceState(instance, instance.state, null),
|
updater.enqueueReplaceState(instance, instance.state, null),
|
||||||
(unmaskedContext = workInProgress.updateQueue),
|
(unmaskedContext = workInProgress.updateQueue),
|
||||||
|
@ -2401,12 +2389,13 @@ function ReactFiberClassComponent(
|
||||||
"function" === typeof workInProgress.type.getDerivedStateFromProps ||
|
"function" === typeof workInProgress.type.getDerivedStateFromProps ||
|
||||||
(oldProps === newProps && oldContext === newUnmaskedContext) ||
|
(oldProps === newProps && oldContext === newUnmaskedContext) ||
|
||||||
((oldContext = instance.state),
|
((oldContext = instance.state),
|
||||||
"function" === typeof instance.componentWillReceiveProps
|
"function" === typeof instance.componentWillReceiveProps &&
|
||||||
? instance.componentWillReceiveProps(newProps, newUnmaskedContext)
|
instance.componentWillReceiveProps(newProps, newUnmaskedContext),
|
||||||
: instance.UNSAFE_componentWillReceiveProps(
|
"function" === typeof instance.UNSAFE_componentWillReceiveProps &&
|
||||||
newProps,
|
instance.UNSAFE_componentWillReceiveProps(
|
||||||
newUnmaskedContext
|
newProps,
|
||||||
),
|
newUnmaskedContext
|
||||||
|
),
|
||||||
instance.state !== oldContext &&
|
instance.state !== oldContext &&
|
||||||
updater.enqueueReplaceState(instance, instance.state, null));
|
updater.enqueueReplaceState(instance, instance.state, null));
|
||||||
var partialState = void 0;
|
var partialState = void 0;
|
||||||
|
@ -2477,17 +2466,18 @@ function ReactFiberClassComponent(
|
||||||
"function" !== typeof instance.componentWillUpdate) ||
|
"function" !== typeof instance.componentWillUpdate) ||
|
||||||
"function" ===
|
"function" ===
|
||||||
typeof workInProgress.type.getDerivedStateFromProps ||
|
typeof workInProgress.type.getDerivedStateFromProps ||
|
||||||
("function" === typeof instance.componentWillUpdate
|
("function" === typeof instance.componentWillUpdate &&
|
||||||
? instance.componentWillUpdate(
|
instance.componentWillUpdate(
|
||||||
newProps,
|
newProps,
|
||||||
renderExpirationTime,
|
renderExpirationTime,
|
||||||
newUnmaskedContext
|
newUnmaskedContext
|
||||||
)
|
),
|
||||||
: instance.UNSAFE_componentWillUpdate(
|
"function" === typeof instance.UNSAFE_componentWillUpdate &&
|
||||||
newProps,
|
instance.UNSAFE_componentWillUpdate(
|
||||||
renderExpirationTime,
|
newProps,
|
||||||
newUnmaskedContext
|
renderExpirationTime,
|
||||||
)),
|
newUnmaskedContext
|
||||||
|
)),
|
||||||
"function" === typeof instance.componentDidUpdate &&
|
"function" === typeof instance.componentDidUpdate &&
|
||||||
(workInProgress.effectTag |= 4))
|
(workInProgress.effectTag |= 4))
|
||||||
: ("function" !== typeof instance.componentDidUpdate ||
|
: ("function" !== typeof instance.componentDidUpdate ||
|
||||||
|
@ -2616,7 +2606,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
||||||
return (
|
return (
|
||||||
(current = createFiberFromText(
|
(current = createFiberFromText(
|
||||||
textContent,
|
textContent,
|
||||||
returnFiber.internalContextTag,
|
returnFiber.mode,
|
||||||
expirationTime
|
expirationTime
|
||||||
)),
|
)),
|
||||||
(current["return"] = returnFiber),
|
(current["return"] = returnFiber),
|
||||||
|
@ -2636,7 +2626,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
||||||
);
|
);
|
||||||
expirationTime = createFiberFromElement(
|
expirationTime = createFiberFromElement(
|
||||||
element,
|
element,
|
||||||
returnFiber.internalContextTag,
|
returnFiber.mode,
|
||||||
expirationTime
|
expirationTime
|
||||||
);
|
);
|
||||||
expirationTime.ref = coerceRef(current, element);
|
expirationTime.ref = coerceRef(current, element);
|
||||||
|
@ -2653,7 +2643,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
||||||
return (
|
return (
|
||||||
(current = createFiberFromPortal(
|
(current = createFiberFromPortal(
|
||||||
portal,
|
portal,
|
||||||
returnFiber.internalContextTag,
|
returnFiber.mode,
|
||||||
expirationTime
|
expirationTime
|
||||||
)),
|
)),
|
||||||
(current["return"] = returnFiber),
|
(current["return"] = returnFiber),
|
||||||
|
@ -2668,7 +2658,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
||||||
return (
|
return (
|
||||||
(current = createFiberFromFragment(
|
(current = createFiberFromFragment(
|
||||||
fragment,
|
fragment,
|
||||||
returnFiber.internalContextTag,
|
returnFiber.mode,
|
||||||
expirationTime,
|
expirationTime,
|
||||||
key
|
key
|
||||||
)),
|
)),
|
||||||
|
@ -2684,7 +2674,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
||||||
return (
|
return (
|
||||||
(newChild = createFiberFromText(
|
(newChild = createFiberFromText(
|
||||||
"" + newChild,
|
"" + newChild,
|
||||||
returnFiber.internalContextTag,
|
returnFiber.mode,
|
||||||
expirationTime
|
expirationTime
|
||||||
)),
|
)),
|
||||||
(newChild["return"] = returnFiber),
|
(newChild["return"] = returnFiber),
|
||||||
|
@ -2696,7 +2686,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
||||||
return (
|
return (
|
||||||
(expirationTime = createFiberFromElement(
|
(expirationTime = createFiberFromElement(
|
||||||
newChild,
|
newChild,
|
||||||
returnFiber.internalContextTag,
|
returnFiber.mode,
|
||||||
expirationTime
|
expirationTime
|
||||||
)),
|
)),
|
||||||
(expirationTime.ref = coerceRef(null, newChild)),
|
(expirationTime.ref = coerceRef(null, newChild)),
|
||||||
|
@ -2707,7 +2697,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
||||||
return (
|
return (
|
||||||
(newChild = createFiberFromPortal(
|
(newChild = createFiberFromPortal(
|
||||||
newChild,
|
newChild,
|
||||||
returnFiber.internalContextTag,
|
returnFiber.mode,
|
||||||
expirationTime
|
expirationTime
|
||||||
)),
|
)),
|
||||||
(newChild["return"] = returnFiber),
|
(newChild["return"] = returnFiber),
|
||||||
|
@ -2718,7 +2708,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
||||||
return (
|
return (
|
||||||
(newChild = createFiberFromFragment(
|
(newChild = createFiberFromFragment(
|
||||||
newChild,
|
newChild,
|
||||||
returnFiber.internalContextTag,
|
returnFiber.mode,
|
||||||
expirationTime,
|
expirationTime,
|
||||||
null
|
null
|
||||||
)),
|
)),
|
||||||
|
@ -3058,7 +3048,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
||||||
newChild.type === REACT_FRAGMENT_TYPE
|
newChild.type === REACT_FRAGMENT_TYPE
|
||||||
? ((currentFirstChild = createFiberFromFragment(
|
? ((currentFirstChild = createFiberFromFragment(
|
||||||
newChild.props.children,
|
newChild.props.children,
|
||||||
returnFiber.internalContextTag,
|
returnFiber.mode,
|
||||||
expirationTime,
|
expirationTime,
|
||||||
newChild.key
|
newChild.key
|
||||||
)),
|
)),
|
||||||
|
@ -3066,7 +3056,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
||||||
(returnFiber = currentFirstChild))
|
(returnFiber = currentFirstChild))
|
||||||
: ((expirationTime = createFiberFromElement(
|
: ((expirationTime = createFiberFromElement(
|
||||||
newChild,
|
newChild,
|
||||||
returnFiber.internalContextTag,
|
returnFiber.mode,
|
||||||
expirationTime
|
expirationTime
|
||||||
)),
|
)),
|
||||||
(expirationTime.ref = coerceRef(currentFirstChild, newChild)),
|
(expirationTime.ref = coerceRef(currentFirstChild, newChild)),
|
||||||
|
@ -3106,7 +3096,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
||||||
}
|
}
|
||||||
currentFirstChild = createFiberFromPortal(
|
currentFirstChild = createFiberFromPortal(
|
||||||
newChild,
|
newChild,
|
||||||
returnFiber.internalContextTag,
|
returnFiber.mode,
|
||||||
expirationTime
|
expirationTime
|
||||||
);
|
);
|
||||||
currentFirstChild["return"] = returnFiber;
|
currentFirstChild["return"] = returnFiber;
|
||||||
|
@ -3127,7 +3117,7 @@ function ChildReconciler(shouldTrackSideEffects) {
|
||||||
: (deleteRemainingChildren(returnFiber, currentFirstChild),
|
: (deleteRemainingChildren(returnFiber, currentFirstChild),
|
||||||
(currentFirstChild = createFiberFromText(
|
(currentFirstChild = createFiberFromText(
|
||||||
newChild,
|
newChild,
|
||||||
returnFiber.internalContextTag,
|
returnFiber.mode,
|
||||||
expirationTime
|
expirationTime
|
||||||
))),
|
))),
|
||||||
(currentFirstChild["return"] = returnFiber),
|
(currentFirstChild["return"] = returnFiber),
|
||||||
|
@ -3167,6 +3157,13 @@ var reconcileChildFibers = ChildReconciler(!0),
|
||||||
mountChildFibers = ChildReconciler(!1),
|
mountChildFibers = ChildReconciler(!1),
|
||||||
stack = [],
|
stack = [],
|
||||||
index$1 = -1;
|
index$1 = -1;
|
||||||
|
function pushProvider(providerFiber) {
|
||||||
|
index$1 += 1;
|
||||||
|
stack[index$1] = providerFiber;
|
||||||
|
var context = providerFiber.type.context;
|
||||||
|
context.currentValue = providerFiber.pendingProps.value;
|
||||||
|
context.changedBits = providerFiber.stateNode;
|
||||||
|
}
|
||||||
function popProvider(providerFiber) {
|
function popProvider(providerFiber) {
|
||||||
stack[index$1] = null;
|
stack[index$1] = null;
|
||||||
--index$1;
|
--index$1;
|
||||||
|
@ -3244,6 +3241,63 @@ function ReactFiberBeginWork(
|
||||||
pushTopLevelContextObject(workInProgress, root.context, !1);
|
pushTopLevelContextObject(workInProgress, root.context, !1);
|
||||||
pushHostContainer(workInProgress, root.containerInfo);
|
pushHostContainer(workInProgress, root.containerInfo);
|
||||||
}
|
}
|
||||||
|
function propagateContextChange(
|
||||||
|
workInProgress,
|
||||||
|
context,
|
||||||
|
changedBits,
|
||||||
|
renderExpirationTime
|
||||||
|
) {
|
||||||
|
for (var fiber = workInProgress.child; null !== fiber; ) {
|
||||||
|
switch (fiber.tag) {
|
||||||
|
case 12:
|
||||||
|
var nextFiber = fiber.stateNode | 0;
|
||||||
|
if (fiber.type === context && 0 !== (nextFiber & changedBits)) {
|
||||||
|
for (nextFiber = fiber; null !== nextFiber; ) {
|
||||||
|
var alternate = nextFiber.alternate;
|
||||||
|
if (
|
||||||
|
0 === nextFiber.expirationTime ||
|
||||||
|
nextFiber.expirationTime > renderExpirationTime
|
||||||
|
)
|
||||||
|
(nextFiber.expirationTime = renderExpirationTime),
|
||||||
|
null !== alternate &&
|
||||||
|
(0 === alternate.expirationTime ||
|
||||||
|
alternate.expirationTime > renderExpirationTime) &&
|
||||||
|
(alternate.expirationTime = renderExpirationTime);
|
||||||
|
else if (
|
||||||
|
null !== alternate &&
|
||||||
|
(0 === alternate.expirationTime ||
|
||||||
|
alternate.expirationTime > renderExpirationTime)
|
||||||
|
)
|
||||||
|
alternate.expirationTime = renderExpirationTime;
|
||||||
|
else break;
|
||||||
|
nextFiber = nextFiber["return"];
|
||||||
|
}
|
||||||
|
nextFiber = null;
|
||||||
|
} else nextFiber = fiber.child;
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
nextFiber = fiber.child;
|
||||||
|
}
|
||||||
|
if (null !== nextFiber) nextFiber["return"] = fiber;
|
||||||
|
else
|
||||||
|
for (nextFiber = fiber; null !== nextFiber; ) {
|
||||||
|
if (nextFiber === workInProgress) {
|
||||||
|
nextFiber = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fiber = nextFiber.sibling;
|
||||||
|
if (null !== fiber) {
|
||||||
|
nextFiber = fiber;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
nextFiber = nextFiber["return"];
|
||||||
|
}
|
||||||
|
fiber = nextFiber;
|
||||||
|
}
|
||||||
|
}
|
||||||
function bailoutOnAlreadyFinishedWork(current, workInProgress) {
|
function bailoutOnAlreadyFinishedWork(current, workInProgress) {
|
||||||
invariant(
|
invariant(
|
||||||
null === current || workInProgress.child === current.child,
|
null === current || workInProgress.child === current.child,
|
||||||
|
@ -3284,11 +3338,7 @@ function ReactFiberBeginWork(
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
(index$1 += 1),
|
pushProvider(workInProgress);
|
||||||
(stack[index$1] = workInProgress),
|
|
||||||
(current = workInProgress.type.context),
|
|
||||||
(current.currentValue = workInProgress.pendingProps.value),
|
|
||||||
(current.changedBits = workInProgress.stateNode);
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -3467,7 +3517,7 @@ function ReactFiberBeginWork(
|
||||||
(workInProgress.effectTag |= 16),
|
(workInProgress.effectTag |= 16),
|
||||||
markRef(current, workInProgress),
|
markRef(current, workInProgress),
|
||||||
1073741823 !== renderExpirationTime &&
|
1073741823 !== renderExpirationTime &&
|
||||||
workInProgress.internalContextTag & 1 &&
|
workInProgress.mode & 1 &&
|
||||||
shouldDeprioritizeSubtree(props, fn)
|
shouldDeprioritizeSubtree(props, fn)
|
||||||
? ((workInProgress.expirationTime = 1073741823),
|
? ((workInProgress.expirationTime = 1073741823),
|
||||||
(current = null))
|
(current = null))
|
||||||
|
@ -3574,9 +3624,66 @@ function ReactFiberBeginWork(
|
||||||
current
|
current
|
||||||
);
|
);
|
||||||
case 13:
|
case 13:
|
||||||
return null;
|
props = workInProgress.type.context;
|
||||||
|
fn = workInProgress.pendingProps;
|
||||||
|
unmaskedContext = workInProgress.memoizedProps;
|
||||||
|
if (didPerformWorkStackCursor.current || unmaskedContext !== fn) {
|
||||||
|
workInProgress.memoizedProps = fn;
|
||||||
|
memoizedProps = fn.value;
|
||||||
|
if (null === unmaskedContext) memoizedProps = 1073741823;
|
||||||
|
else {
|
||||||
|
var oldValue = unmaskedContext.value;
|
||||||
|
(oldValue === memoizedProps &&
|
||||||
|
(0 !== oldValue || 1 / oldValue === 1 / memoizedProps)) ||
|
||||||
|
(oldValue !== oldValue && memoizedProps !== memoizedProps)
|
||||||
|
? (memoizedProps = 0)
|
||||||
|
: ((memoizedProps =
|
||||||
|
"function" === typeof props.calculateChangedBits
|
||||||
|
? props.calculateChangedBits(oldValue, memoizedProps)
|
||||||
|
: 1073741823),
|
||||||
|
(memoizedProps |= 0),
|
||||||
|
0 !== memoizedProps &&
|
||||||
|
propagateContextChange(
|
||||||
|
workInProgress,
|
||||||
|
props,
|
||||||
|
memoizedProps,
|
||||||
|
renderExpirationTime
|
||||||
|
));
|
||||||
|
}
|
||||||
|
workInProgress.stateNode = memoizedProps;
|
||||||
|
pushProvider(workInProgress);
|
||||||
|
null !== unmaskedContext && unmaskedContext.children === fn.children
|
||||||
|
? (current = bailoutOnAlreadyFinishedWork(
|
||||||
|
current,
|
||||||
|
workInProgress
|
||||||
|
))
|
||||||
|
: (reconcileChildren(current, workInProgress, fn.children),
|
||||||
|
(current = workInProgress.child));
|
||||||
|
} else
|
||||||
|
(workInProgress.stateNode = 0),
|
||||||
|
pushProvider(workInProgress),
|
||||||
|
(current = bailoutOnAlreadyFinishedWork(current, workInProgress));
|
||||||
|
return current;
|
||||||
case 12:
|
case 12:
|
||||||
return null;
|
unmaskedContext = workInProgress.type;
|
||||||
|
fn = workInProgress.pendingProps;
|
||||||
|
props = unmaskedContext.currentValue;
|
||||||
|
memoizedProps = unmaskedContext.changedBits;
|
||||||
|
0 !== memoizedProps &&
|
||||||
|
propagateContextChange(
|
||||||
|
workInProgress,
|
||||||
|
unmaskedContext,
|
||||||
|
memoizedProps,
|
||||||
|
renderExpirationTime
|
||||||
|
);
|
||||||
|
renderExpirationTime = fn.observedBits;
|
||||||
|
if (void 0 === renderExpirationTime || null === renderExpirationTime)
|
||||||
|
renderExpirationTime = 1073741823;
|
||||||
|
workInProgress.stateNode = renderExpirationTime;
|
||||||
|
renderExpirationTime = fn.children;
|
||||||
|
renderExpirationTime = renderExpirationTime(props);
|
||||||
|
reconcileChildren(current, workInProgress, renderExpirationTime);
|
||||||
|
return workInProgress.child;
|
||||||
default:
|
default:
|
||||||
invariant(
|
invariant(
|
||||||
!1,
|
!1,
|
||||||
|
@ -4509,38 +4616,26 @@ function ReactFiberScheduler(config) {
|
||||||
ReactCurrentOwner.current = null;
|
ReactCurrentOwner.current = null;
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
function workLoop(expirationTime) {
|
function workLoop(isAsync) {
|
||||||
if (null !== capturedErrors) {
|
if (null !== capturedErrors)
|
||||||
if (
|
if (isAsync)
|
||||||
!(
|
|
||||||
0 === nextRenderExpirationTime ||
|
|
||||||
nextRenderExpirationTime > expirationTime
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if (nextRenderExpirationTime <= mostRecentCurrentTime)
|
|
||||||
for (; null !== nextUnitOfWork; )
|
|
||||||
nextUnitOfWork = hasCapturedError(nextUnitOfWork)
|
|
||||||
? performFailedUnitOfWork(nextUnitOfWork)
|
|
||||||
: performUnitOfWork(nextUnitOfWork);
|
|
||||||
else
|
|
||||||
for (; null !== nextUnitOfWork && !shouldYield(); )
|
|
||||||
nextUnitOfWork = hasCapturedError(nextUnitOfWork)
|
|
||||||
? performFailedUnitOfWork(nextUnitOfWork)
|
|
||||||
: performUnitOfWork(nextUnitOfWork);
|
|
||||||
} else if (
|
|
||||||
!(
|
|
||||||
0 === nextRenderExpirationTime ||
|
|
||||||
nextRenderExpirationTime > expirationTime
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if (nextRenderExpirationTime <= mostRecentCurrentTime)
|
|
||||||
for (; null !== nextUnitOfWork; )
|
|
||||||
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
|
|
||||||
else
|
|
||||||
for (; null !== nextUnitOfWork && !shouldYield(); )
|
for (; null !== nextUnitOfWork && !shouldYield(); )
|
||||||
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
|
nextUnitOfWork = hasCapturedError(nextUnitOfWork)
|
||||||
|
? performFailedUnitOfWork(nextUnitOfWork)
|
||||||
|
: performUnitOfWork(nextUnitOfWork);
|
||||||
|
else
|
||||||
|
for (; null !== nextUnitOfWork; )
|
||||||
|
nextUnitOfWork = hasCapturedError(nextUnitOfWork)
|
||||||
|
? performFailedUnitOfWork(nextUnitOfWork)
|
||||||
|
: performUnitOfWork(nextUnitOfWork);
|
||||||
|
else if (isAsync)
|
||||||
|
for (; null !== nextUnitOfWork && !shouldYield(); )
|
||||||
|
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
|
||||||
|
else
|
||||||
|
for (; null !== nextUnitOfWork; )
|
||||||
|
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
|
||||||
}
|
}
|
||||||
function renderRoot(root, expirationTime) {
|
function renderRoot(root, expirationTime, isAsync) {
|
||||||
invariant(
|
invariant(
|
||||||
!isWorking,
|
!isWorking,
|
||||||
"renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue."
|
"renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue."
|
||||||
|
@ -4562,6 +4657,7 @@ function ReactFiberScheduler(config) {
|
||||||
context.changedBits = 0;
|
context.changedBits = 0;
|
||||||
stack[i] = null;
|
stack[i] = null;
|
||||||
}
|
}
|
||||||
|
index$1 = -1;
|
||||||
resetHostContainer();
|
resetHostContainer();
|
||||||
nextRoot = root;
|
nextRoot = root;
|
||||||
nextRenderExpirationTime = expirationTime;
|
nextRenderExpirationTime = expirationTime;
|
||||||
|
@ -4571,65 +4667,69 @@ function ReactFiberScheduler(config) {
|
||||||
expirationTime
|
expirationTime
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
context = !1;
|
i = !1;
|
||||||
var error = null;
|
context = null;
|
||||||
try {
|
try {
|
||||||
workLoop(expirationTime);
|
workLoop(isAsync);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
(context = !0), (error = e);
|
(i = !0), (context = e);
|
||||||
}
|
}
|
||||||
for (; context; ) {
|
for (; i; ) {
|
||||||
if (didFatal) {
|
if (didFatal) {
|
||||||
firstUncaughtError = error;
|
firstUncaughtError = context;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i = nextUnitOfWork;
|
expirationTime = nextUnitOfWork;
|
||||||
if (null === i) didFatal = !0;
|
if (null === expirationTime) didFatal = !0;
|
||||||
else {
|
else {
|
||||||
var boundary = captureError(i, error);
|
var boundary = captureError(expirationTime, context);
|
||||||
invariant(
|
invariant(
|
||||||
null !== boundary,
|
null !== boundary,
|
||||||
"Should have found an error boundary. This error is likely caused by a bug in React. Please file an issue."
|
"Should have found an error boundary. This error is likely caused by a bug in React. Please file an issue."
|
||||||
);
|
);
|
||||||
if (!didFatal) {
|
if (!didFatal) {
|
||||||
try {
|
try {
|
||||||
context = boundary;
|
i = boundary;
|
||||||
error = expirationTime;
|
context = isAsync;
|
||||||
for (boundary = context; null !== i; ) {
|
for (boundary = i; null !== expirationTime; ) {
|
||||||
switch (i.tag) {
|
switch (expirationTime.tag) {
|
||||||
case 2:
|
case 2:
|
||||||
popContextProvider(i);
|
popContextProvider(expirationTime);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
popHostContext(i);
|
popHostContext(expirationTime);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
popHostContainer(i);
|
popHostContainer(expirationTime);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
popHostContainer(i);
|
popHostContainer(expirationTime);
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
popProvider(i);
|
popProvider(expirationTime);
|
||||||
}
|
}
|
||||||
if (i === boundary || i.alternate === boundary) break;
|
if (
|
||||||
i = i["return"];
|
expirationTime === boundary ||
|
||||||
|
expirationTime.alternate === boundary
|
||||||
|
)
|
||||||
|
break;
|
||||||
|
expirationTime = expirationTime["return"];
|
||||||
}
|
}
|
||||||
nextUnitOfWork = performFailedUnitOfWork(context);
|
nextUnitOfWork = performFailedUnitOfWork(i);
|
||||||
workLoop(error);
|
workLoop(context);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
context = !0;
|
i = !0;
|
||||||
error = e;
|
context = e;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expirationTime = firstUncaughtError;
|
isAsync = firstUncaughtError;
|
||||||
didFatal = isWorking = !1;
|
didFatal = isWorking = !1;
|
||||||
firstUncaughtError = null;
|
firstUncaughtError = null;
|
||||||
null !== expirationTime && onUncaughtError(expirationTime);
|
null !== isAsync && onUncaughtError(isAsync);
|
||||||
return root.isReadyForCommit ? root.current.alternate : null;
|
return root.isReadyForCommit ? root.current.alternate : null;
|
||||||
}
|
}
|
||||||
function captureError(failedWork, error$jscomp$0) {
|
function captureError(failedWork, error$jscomp$0) {
|
||||||
|
@ -4747,11 +4847,21 @@ function ReactFiberScheduler(config) {
|
||||||
return 20 * ((((recalculateCurrentTime() + 100) / 20) | 0) + 1);
|
return 20 * ((((recalculateCurrentTime() + 100) / 20) | 0) + 1);
|
||||||
}
|
}
|
||||||
function computeExpirationForFiber(fiber) {
|
function computeExpirationForFiber(fiber) {
|
||||||
return 0 !== expirationContext
|
fiber =
|
||||||
? expirationContext
|
0 !== expirationContext
|
||||||
: isWorking
|
? expirationContext
|
||||||
? isCommitting ? 1 : nextRenderExpirationTime
|
: isWorking
|
||||||
: fiber.internalContextTag & 1 ? computeAsyncExpiration() : 1;
|
? isCommitting ? 1 : nextRenderExpirationTime
|
||||||
|
: fiber.mode & 1
|
||||||
|
? isBatchingInteractiveUpdates
|
||||||
|
? 10 * ((((recalculateCurrentTime() + 50) / 10) | 0) + 1)
|
||||||
|
: computeAsyncExpiration()
|
||||||
|
: 1;
|
||||||
|
isBatchingInteractiveUpdates &&
|
||||||
|
(0 === lowestPendingInteractiveExpirationTime ||
|
||||||
|
fiber > lowestPendingInteractiveExpirationTime) &&
|
||||||
|
(lowestPendingInteractiveExpirationTime = fiber);
|
||||||
|
return fiber;
|
||||||
}
|
}
|
||||||
function scheduleWork(fiber, expirationTime) {
|
function scheduleWork(fiber, expirationTime) {
|
||||||
return scheduleWorkImpl(fiber, expirationTime, !1);
|
return scheduleWorkImpl(fiber, expirationTime, !1);
|
||||||
|
@ -4788,6 +4898,15 @@ function ReactFiberScheduler(config) {
|
||||||
function recalculateCurrentTime() {
|
function recalculateCurrentTime() {
|
||||||
return (mostRecentCurrentTime = (((now() - startTime) / 10) | 0) + 2);
|
return (mostRecentCurrentTime = (((now() - startTime) / 10) | 0) + 2);
|
||||||
}
|
}
|
||||||
|
function syncUpdates(fn, a, b, c, d) {
|
||||||
|
var previousExpirationContext = expirationContext;
|
||||||
|
expirationContext = 1;
|
||||||
|
try {
|
||||||
|
return fn(a, b, c, d);
|
||||||
|
} finally {
|
||||||
|
expirationContext = previousExpirationContext;
|
||||||
|
}
|
||||||
|
}
|
||||||
function scheduleCallbackWithExpiration(expirationTime) {
|
function scheduleCallbackWithExpiration(expirationTime) {
|
||||||
if (0 !== callbackExpirationTime) {
|
if (0 !== callbackExpirationTime) {
|
||||||
if (expirationTime > callbackExpirationTime) return;
|
if (expirationTime > callbackExpirationTime) return;
|
||||||
|
@ -4825,9 +4944,9 @@ function ReactFiberScheduler(config) {
|
||||||
? isUnbatchingUpdates &&
|
? isUnbatchingUpdates &&
|
||||||
((nextFlushedRoot = root),
|
((nextFlushedRoot = root),
|
||||||
(nextFlushedExpirationTime = 1),
|
(nextFlushedExpirationTime = 1),
|
||||||
performWorkOnRoot(root, 1, recalculateCurrentTime()))
|
performWorkOnRoot(root, 1, !1))
|
||||||
: 1 === expirationTime
|
: 1 === expirationTime
|
||||||
? performWork(1, null)
|
? performWork(1, !1, null)
|
||||||
: scheduleCallbackWithExpiration(expirationTime));
|
: scheduleCallbackWithExpiration(expirationTime));
|
||||||
}
|
}
|
||||||
function findHighestPriorityRoot() {
|
function findHighestPriorityRoot() {
|
||||||
|
@ -4884,25 +5003,39 @@ function ReactFiberScheduler(config) {
|
||||||
nextFlushedExpirationTime = highestPriorityWork;
|
nextFlushedExpirationTime = highestPriorityWork;
|
||||||
}
|
}
|
||||||
function performAsyncWork(dl) {
|
function performAsyncWork(dl) {
|
||||||
performWork(0, dl);
|
performWork(0, !0, dl);
|
||||||
}
|
}
|
||||||
function performWork(minExpirationTime, dl) {
|
function performWork(minExpirationTime, isAsync, dl) {
|
||||||
deadline = dl;
|
deadline = dl;
|
||||||
for (
|
findHighestPriorityRoot();
|
||||||
findHighestPriorityRoot();
|
if (isAsync)
|
||||||
null !== nextFlushedRoot &&
|
for (
|
||||||
0 !== nextFlushedExpirationTime &&
|
;
|
||||||
(0 === minExpirationTime ||
|
null !== nextFlushedRoot &&
|
||||||
nextFlushedExpirationTime <= minExpirationTime) &&
|
0 !== nextFlushedExpirationTime &&
|
||||||
!deadlineDidExpire;
|
(0 === minExpirationTime ||
|
||||||
|
minExpirationTime >= nextFlushedExpirationTime) &&
|
||||||
|
(!deadlineDidExpire ||
|
||||||
|
recalculateCurrentTime() >= nextFlushedExpirationTime);
|
||||||
|
|
||||||
)
|
)
|
||||||
performWorkOnRoot(
|
performWorkOnRoot(
|
||||||
nextFlushedRoot,
|
nextFlushedRoot,
|
||||||
nextFlushedExpirationTime,
|
nextFlushedExpirationTime,
|
||||||
recalculateCurrentTime()
|
!deadlineDidExpire
|
||||||
),
|
),
|
||||||
findHighestPriorityRoot();
|
findHighestPriorityRoot();
|
||||||
|
else
|
||||||
|
for (
|
||||||
|
;
|
||||||
|
null !== nextFlushedRoot &&
|
||||||
|
0 !== nextFlushedExpirationTime &&
|
||||||
|
(0 === minExpirationTime ||
|
||||||
|
minExpirationTime >= nextFlushedExpirationTime);
|
||||||
|
|
||||||
|
)
|
||||||
|
performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !1),
|
||||||
|
findHighestPriorityRoot();
|
||||||
null !== deadline && ((callbackExpirationTime = 0), (callbackID = -1));
|
null !== deadline && ((callbackExpirationTime = 0), (callbackID = -1));
|
||||||
0 !== nextFlushedExpirationTime &&
|
0 !== nextFlushedExpirationTime &&
|
||||||
scheduleCallbackWithExpiration(nextFlushedExpirationTime);
|
scheduleCallbackWithExpiration(nextFlushedExpirationTime);
|
||||||
|
@ -4931,29 +5064,28 @@ function ReactFiberScheduler(config) {
|
||||||
(hasUnhandledError = !1),
|
(hasUnhandledError = !1),
|
||||||
batches);
|
batches);
|
||||||
}
|
}
|
||||||
function performWorkOnRoot(root, expirationTime, currentTime) {
|
function performWorkOnRoot(root, expirationTime, isAsync) {
|
||||||
invariant(
|
invariant(
|
||||||
!isRendering,
|
!isRendering,
|
||||||
"performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue."
|
"performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue."
|
||||||
);
|
);
|
||||||
isRendering = !0;
|
isRendering = !0;
|
||||||
expirationTime <= currentTime
|
isAsync
|
||||||
? ((currentTime = root.finishedWork),
|
? ((isAsync = root.finishedWork),
|
||||||
null !== currentTime
|
null !== isAsync
|
||||||
? completeRoot(root, currentTime, expirationTime)
|
? completeRoot(root, isAsync, expirationTime)
|
||||||
: ((root.finishedWork = null),
|
: ((root.finishedWork = null),
|
||||||
(currentTime = renderRoot(root, expirationTime)),
|
(isAsync = renderRoot(root, expirationTime, !0)),
|
||||||
null !== currentTime &&
|
null !== isAsync &&
|
||||||
completeRoot(root, currentTime, expirationTime)))
|
|
||||||
: ((currentTime = root.finishedWork),
|
|
||||||
null !== currentTime
|
|
||||||
? completeRoot(root, currentTime, expirationTime)
|
|
||||||
: ((root.finishedWork = null),
|
|
||||||
(currentTime = renderRoot(root, expirationTime)),
|
|
||||||
null !== currentTime &&
|
|
||||||
(shouldYield()
|
(shouldYield()
|
||||||
? (root.finishedWork = currentTime)
|
? (root.finishedWork = isAsync)
|
||||||
: completeRoot(root, currentTime, expirationTime))));
|
: completeRoot(root, isAsync, expirationTime))))
|
||||||
|
: ((isAsync = root.finishedWork),
|
||||||
|
null !== isAsync
|
||||||
|
? completeRoot(root, isAsync, expirationTime)
|
||||||
|
: ((root.finishedWork = null),
|
||||||
|
(isAsync = renderRoot(root, expirationTime, !1)),
|
||||||
|
null !== isAsync && completeRoot(root, isAsync, expirationTime)));
|
||||||
isRendering = !1;
|
isRendering = !1;
|
||||||
}
|
}
|
||||||
function completeRoot(root, finishedWork, expirationTime) {
|
function completeRoot(root, finishedWork, expirationTime) {
|
||||||
|
@ -4985,7 +5117,7 @@ function ReactFiberScheduler(config) {
|
||||||
(firstBatch = finishedWork.firstEffect))
|
(firstBatch = finishedWork.firstEffect))
|
||||||
: (firstBatch = finishedWork)
|
: (firstBatch = finishedWork)
|
||||||
: (firstBatch = finishedWork.firstEffect);
|
: (firstBatch = finishedWork.firstEffect);
|
||||||
prepareForCommit();
|
prepareForCommit(expirationTime.containerInfo);
|
||||||
for (nextEffect = firstBatch; null !== nextEffect; ) {
|
for (nextEffect = firstBatch; null !== nextEffect; ) {
|
||||||
var didError = !1,
|
var didError = !1,
|
||||||
_error = void 0;
|
_error = void 0;
|
||||||
|
@ -5028,7 +5160,7 @@ function ReactFiberScheduler(config) {
|
||||||
captureError(nextEffect, _error),
|
captureError(nextEffect, _error),
|
||||||
null !== nextEffect && (nextEffect = nextEffect.nextEffect));
|
null !== nextEffect && (nextEffect = nextEffect.nextEffect));
|
||||||
}
|
}
|
||||||
resetAfterCommit();
|
resetAfterCommit(expirationTime.containerInfo);
|
||||||
expirationTime.current = finishedWork;
|
expirationTime.current = finishedWork;
|
||||||
for (nextEffect = firstBatch; null !== nextEffect; ) {
|
for (nextEffect = firstBatch; null !== nextEffect; ) {
|
||||||
effectTag = !1;
|
effectTag = !1;
|
||||||
|
@ -5164,12 +5296,14 @@ function ReactFiberScheduler(config) {
|
||||||
isRendering = !1,
|
isRendering = !1,
|
||||||
nextFlushedRoot = null,
|
nextFlushedRoot = null,
|
||||||
nextFlushedExpirationTime = 0,
|
nextFlushedExpirationTime = 0,
|
||||||
|
lowestPendingInteractiveExpirationTime = 0,
|
||||||
deadlineDidExpire = !1,
|
deadlineDidExpire = !1,
|
||||||
hasUnhandledError = !1,
|
hasUnhandledError = !1,
|
||||||
unhandledError = null,
|
unhandledError = null,
|
||||||
deadline = null,
|
deadline = null,
|
||||||
isBatchingUpdates = !1,
|
isBatchingUpdates = !1,
|
||||||
isUnbatchingUpdates = !1,
|
isUnbatchingUpdates = !1,
|
||||||
|
isBatchingInteractiveUpdates = !1,
|
||||||
completedBatches = null,
|
completedBatches = null,
|
||||||
NESTED_UPDATE_LIMIT = 1e3,
|
NESTED_UPDATE_LIMIT = 1e3,
|
||||||
nestedUpdateCount = 0,
|
nestedUpdateCount = 0,
|
||||||
|
@ -5183,7 +5317,7 @@ function ReactFiberScheduler(config) {
|
||||||
!isRendering,
|
!isRendering,
|
||||||
"work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method."
|
"work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method."
|
||||||
);
|
);
|
||||||
performWorkOnRoot(root, expirationTime, expirationTime);
|
performWorkOnRoot(root, expirationTime, !1);
|
||||||
finishRendering();
|
finishRendering();
|
||||||
},
|
},
|
||||||
batchedUpdates: function(fn, a) {
|
batchedUpdates: function(fn, a) {
|
||||||
|
@ -5194,43 +5328,43 @@ function ReactFiberScheduler(config) {
|
||||||
} finally {
|
} finally {
|
||||||
(isBatchingUpdates = previousIsBatchingUpdates) ||
|
(isBatchingUpdates = previousIsBatchingUpdates) ||
|
||||||
isRendering ||
|
isRendering ||
|
||||||
performWork(1, null);
|
performWork(1, !1, null);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unbatchedUpdates: function(fn) {
|
unbatchedUpdates: function(fn, a) {
|
||||||
if (isBatchingUpdates && !isUnbatchingUpdates) {
|
if (isBatchingUpdates && !isUnbatchingUpdates) {
|
||||||
isUnbatchingUpdates = !0;
|
isUnbatchingUpdates = !0;
|
||||||
try {
|
try {
|
||||||
return fn();
|
return fn(a);
|
||||||
} finally {
|
} finally {
|
||||||
isUnbatchingUpdates = !1;
|
isUnbatchingUpdates = !1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fn();
|
return fn(a);
|
||||||
},
|
},
|
||||||
flushSync: function(fn) {
|
flushSync: function(fn, a) {
|
||||||
|
invariant(
|
||||||
|
!isRendering,
|
||||||
|
"flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering."
|
||||||
|
);
|
||||||
var previousIsBatchingUpdates = isBatchingUpdates;
|
var previousIsBatchingUpdates = isBatchingUpdates;
|
||||||
isBatchingUpdates = !0;
|
isBatchingUpdates = !0;
|
||||||
try {
|
try {
|
||||||
a: {
|
return syncUpdates(fn, a);
|
||||||
var previousExpirationContext = expirationContext;
|
|
||||||
expirationContext = 1;
|
|
||||||
try {
|
|
||||||
var JSCompiler_inline_result = fn();
|
|
||||||
break a;
|
|
||||||
} finally {
|
|
||||||
expirationContext = previousExpirationContext;
|
|
||||||
}
|
|
||||||
JSCompiler_inline_result = void 0;
|
|
||||||
}
|
|
||||||
return JSCompiler_inline_result;
|
|
||||||
} finally {
|
} finally {
|
||||||
(isBatchingUpdates = previousIsBatchingUpdates),
|
(isBatchingUpdates = previousIsBatchingUpdates),
|
||||||
invariant(
|
performWork(1, !1, null);
|
||||||
!isRendering,
|
}
|
||||||
"flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering."
|
},
|
||||||
),
|
flushControlled: function(fn) {
|
||||||
performWork(1, null);
|
var previousIsBatchingUpdates = isBatchingUpdates;
|
||||||
|
isBatchingUpdates = !0;
|
||||||
|
try {
|
||||||
|
syncUpdates(fn);
|
||||||
|
} finally {
|
||||||
|
(isBatchingUpdates = previousIsBatchingUpdates) ||
|
||||||
|
isRendering ||
|
||||||
|
performWork(1, !1, null);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deferredUpdates: function(fn) {
|
deferredUpdates: function(fn) {
|
||||||
|
@ -5242,6 +5376,32 @@ function ReactFiberScheduler(config) {
|
||||||
expirationContext = previousExpirationContext;
|
expirationContext = previousExpirationContext;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
syncUpdates: syncUpdates,
|
||||||
|
interactiveUpdates: function(fn, a, b) {
|
||||||
|
if (isBatchingInteractiveUpdates) return fn(a, b);
|
||||||
|
isBatchingUpdates ||
|
||||||
|
isRendering ||
|
||||||
|
0 === lowestPendingInteractiveExpirationTime ||
|
||||||
|
(performWork(lowestPendingInteractiveExpirationTime, !1, null),
|
||||||
|
(lowestPendingInteractiveExpirationTime = 0));
|
||||||
|
var previousIsBatchingInteractiveUpdates = isBatchingInteractiveUpdates,
|
||||||
|
previousIsBatchingUpdates = isBatchingUpdates;
|
||||||
|
isBatchingUpdates = isBatchingInteractiveUpdates = !0;
|
||||||
|
try {
|
||||||
|
return fn(a, b);
|
||||||
|
} finally {
|
||||||
|
(isBatchingInteractiveUpdates = previousIsBatchingInteractiveUpdates),
|
||||||
|
(isBatchingUpdates = previousIsBatchingUpdates) ||
|
||||||
|
isRendering ||
|
||||||
|
performWork(1, !1, null);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
flushInteractiveUpdates: function() {
|
||||||
|
isRendering ||
|
||||||
|
0 === lowestPendingInteractiveExpirationTime ||
|
||||||
|
(performWork(lowestPendingInteractiveExpirationTime, !1, null),
|
||||||
|
(lowestPendingInteractiveExpirationTime = 0));
|
||||||
|
},
|
||||||
computeUniqueAsyncExpiration: function() {
|
computeUniqueAsyncExpiration: function() {
|
||||||
var result = computeAsyncExpiration();
|
var result = computeAsyncExpiration();
|
||||||
result <= lastUniqueAsyncExpiration &&
|
result <= lastUniqueAsyncExpiration &&
|
||||||
|
@ -5344,6 +5504,10 @@ function ReactFiberReconciler$1(config) {
|
||||||
batchedUpdates: config.batchedUpdates,
|
batchedUpdates: config.batchedUpdates,
|
||||||
unbatchedUpdates: config.unbatchedUpdates,
|
unbatchedUpdates: config.unbatchedUpdates,
|
||||||
deferredUpdates: config.deferredUpdates,
|
deferredUpdates: config.deferredUpdates,
|
||||||
|
syncUpdates: config.syncUpdates,
|
||||||
|
interactiveUpdates: config.interactiveUpdates,
|
||||||
|
flushInteractiveUpdates: config.flushInteractiveUpdates,
|
||||||
|
flushControlled: config.flushControlled,
|
||||||
flushSync: config.flushSync,
|
flushSync: config.flushSync,
|
||||||
getPublicRootInstance: function(container) {
|
getPublicRootInstance: function(container) {
|
||||||
container = container.current;
|
container = container.current;
|
||||||
|
@ -5566,14 +5730,14 @@ var ReactFiberReconciler$2 = Object.freeze({ default: ReactFiberReconciler$1 }),
|
||||||
},
|
},
|
||||||
replaceContainerChildren: function() {}
|
replaceContainerChildren: function() {}
|
||||||
}
|
}
|
||||||
});
|
}),
|
||||||
injection$2.injectFiberBatchedUpdates(ReactFabricRenderer.batchedUpdates);
|
getInspectorDataForViewTag = void 0;
|
||||||
var getInspectorDataForViewTag = void 0;
|
|
||||||
getInspectorDataForViewTag = function() {
|
getInspectorDataForViewTag = function() {
|
||||||
invariant(!1, "getInspectorDataForViewTag() is not available in production");
|
invariant(!1, "getInspectorDataForViewTag() is not available in production");
|
||||||
};
|
};
|
||||||
findHostInstanceFabric = ReactFabricRenderer.findHostInstance;
|
findHostInstanceFabric = ReactFabricRenderer.findHostInstance;
|
||||||
injection$2.injectFiberBatchedUpdates(ReactFabricRenderer.batchedUpdates);
|
_batchedUpdates = ReactFabricRenderer.batchedUpdates;
|
||||||
|
_flushInteractiveUpdates = ReactFabricRenderer.flushInteractiveUpdates;
|
||||||
var roots = new Map(),
|
var roots = new Map(),
|
||||||
ReactFabric = {
|
ReactFabric = {
|
||||||
NativeComponent: ReactNativeComponent,
|
NativeComponent: ReactNativeComponent,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -71,19 +71,15 @@ export type ReactConsumer<T> = {
|
||||||
key: null | string,
|
key: null | string,
|
||||||
ref: null,
|
ref: null,
|
||||||
props: {
|
props: {
|
||||||
render: (value: T) => ReactNodeList,
|
children: (value: T) => ReactNodeList,
|
||||||
bits?: number,
|
bits?: number,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ReactContext<T> = {
|
export type ReactContext<T> = {
|
||||||
$$typeof: Symbol | number,
|
$$typeof: Symbol | number,
|
||||||
provide(value: T, children: ReactNodeList, key?: string): ReactProvider<T>,
|
Consumer: ReactContext<T>,
|
||||||
consume(
|
Provider: ReactProviderType<T>,
|
||||||
render: (value: T) => ReactNodeList,
|
|
||||||
observedBits?: number,
|
|
||||||
key?: string,
|
|
||||||
): ReactConsumer<T>,
|
|
||||||
calculateChangedBits: ((a: T, b: T) => number) | null,
|
calculateChangedBits: ((a: T, b: T) => number) | null,
|
||||||
defaultValue: T,
|
defaultValue: T,
|
||||||
currentValue: T,
|
currentValue: T,
|
||||||
|
|
Loading…
Reference in New Issue