/** @license React v16.8.6 * react-test-renderer.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree.
*/
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require("resource://devtools/client/shared/vendor/react.js")) : typeof define === 'function' && define.amd ? define(['resource://devtools/client/shared/vendor/react.js'], factory) :
(global.ReactTestRenderer = factory(global.React));
}(this, (function (React) { 'use strict';
/** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production.
*/
function invariant(condition, format, a, b, c, d, e, f) { if (!condition) { var error = void 0; if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else { var args = [a, b, c, d, e, f]; var argIndex = 0;
error = new Error(format.replace(/%s/g, function () { return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame throw error;
}
}
// Relying on the `invariant()` implementation lets us // preserve the format and params in the www builds. /** * WARNING: DO NOT manually require this module. * This is a replacement for `invariant(...)` used by the error code system * and will _only_ be required by the corresponding babel pass. * It always throws.
*/ function reactProdInvariant(code) { var argCount = arguments.length - 1; var url = 'https://reactjs.org/docs/error-decoder.html?invariant=' + code; for (var argIdx = 0; argIdx < argCount; argIdx++) {
url += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
} // Rename it so that our build transform doesn't attempt // to replace this invariant() call with reactProdInvariant(). var i = invariant;
i(false, // The error code is intentionally part of the message (and // not the format argument) so that we could deduplicate // different errors in logs based on the code. 'Minified React error #' + code + '; visit %s ' + 'for the full message or use the non-minified dev environment ' + 'for full errors and additional helpful warnings. ', url);
}
var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
var _assign = ReactInternals.assign;
/** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths.
*/
/** * `ReactInstanceMap` maintains a mapping from a public facing stateful * instance (key) and the internal representation (value). This allows public * methods to accept the user facing instance as an argument and map them back * to internal methods. * * Note that this module is currently shared and assumed to be stateless. * If this becomes an actual Map, that will break.
*/
/** * This API should be called `delete` but we'd have to make sure to always * transform these to strings for IE support. When this transform is fully * supported we can rename it.
*/
function get(key) { return key._reactInternalFiber;
}
function set(key, value) {
key._reactInternalFiber = value;
}
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
// Prevent newer renderers from RTE when used with older react package versions. // Current owner and dispatcher used to share the same ref, // but PR #14548 split them out to better support the react-debug-tools package. if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
ReactSharedInternals.ReactCurrentDispatcher = {
current: null
};
}
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol // nor polyfill, then a plain number is used for performance. var hasSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator';
function getIteratorFn(maybeIterable) { if (maybeIterable === null || typeof maybeIterable !== 'object') { returnnull;
} var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; if (typeof maybeIterator === 'function') { return maybeIterator;
} returnnull;
}
var Pending = 0; var Resolved = 1; var Rejected = 2;
function getComponentName(type) { if (type == null) { // Host root, text node or just invalid type. returnnull;
} if (typeof type === 'function') { return type.displayName || type.name || null;
} if (typeof type === 'string') { return type;
} switch (type) { case REACT_CONCURRENT_MODE_TYPE: return'ConcurrentMode'; case REACT_FRAGMENT_TYPE: return'Fragment'; case REACT_PORTAL_TYPE: return'Portal'; case REACT_PROFILER_TYPE: return'Profiler'; case REACT_STRICT_MODE_TYPE: return'StrictMode'; case REACT_SUSPENSE_TYPE: return'Suspense';
} if (typeof type === 'object') { switch (type.$$typeof) { case REACT_CONTEXT_TYPE: return'Context.Consumer'; case REACT_PROVIDER_TYPE: return'Context.Provider'; case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, 'ForwardRef'); case REACT_MEMO_TYPE: return getComponentName(type.type); case REACT_LAZY_TYPE:
{ var thenable = type; var resolvedThenable = refineResolvedLazyComponent(thenable); if (resolvedThenable) { return getComponentName(resolvedThenable);
}
}
}
} returnnull;
}
var FunctionComponent = 0; var ClassComponent = 1; var IndeterminateComponent = 2; // Before we know whether it is function or class var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. var HostComponent = 5; var HostText = 6; var Fragment = 7; var Mode = 8; var ContextConsumer = 9; var ContextProvider = 10; var ForwardRef = 11; var Profiler = 12; var SuspenseComponent = 13; var MemoComponent = 14; var SimpleMemoComponent = 15; var LazyComponent = 16; var IncompleteClassComponent = 17; var DehydratedSuspenseComponent = 18;
// Don't change these two values. They're used by React Dev Tools. var NoEffect = /* */0; var PerformedWork = /* */1;
// You can change the rest (and add more). var Placement = /* */2; var Update = /* */4; var PlacementAndUpdate = /* */6; var Deletion = /* */8; var ContentReset = /* */16; var Callback = /* */32; var DidCapture = /* */64; var Ref = /* */128; var Snapshot = /* */256; var Passive = /* */512;
// Union of all host effects var HostEffectMask = /* */1023;
var Incomplete = /* */1024; var ShouldCapture = /* */2048;
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
var MOUNTING = 1; var MOUNTED = 2; var UNMOUNTED = 3;
function isFiberMountedImpl(fiber) { var node = fiber; if (!fiber.alternate) { // If there is no alternate, this might be a new tree that isn't inserted // yet. If it is, then it will have a pending insertion effect on it. if ((node.effectTag & Placement) !== NoEffect) { return MOUNTING;
} while (node.return) {
node = node.return; if ((node.effectTag & Placement) !== NoEffect) { return MOUNTING;
}
}
} else { while (node.return) {
node = node.return;
}
} if (node.tag === HostRoot) { // TODO: Check if this was a nested HostRoot when used with // renderContainerIntoSubtree. return MOUNTED;
} // If we didn't hit the root, that means that we're in an disconnected tree // that has been unmounted. return UNMOUNTED;
}
function isFiberMounted(fiber) { return isFiberMountedImpl(fiber) === MOUNTED;
}
function isMounted(component) { var fiber = get(component); if (!fiber) { returnfalse;
} return isFiberMountedImpl(fiber) === MOUNTED;
}
function findCurrentFiberUsingSlowPath(fiber) { var alternate = fiber.alternate; if (!alternate) { // If there is no alternate, then we only need to check if it is mounted. var state = isFiberMountedImpl(fiber);
!(state !== UNMOUNTED) ? reactProdInvariant('188') : void 0; if (state === MOUNTING) { returnnull;
} return fiber;
} // If we have two possible branches, we'll walk backwards up to the root // to see what path the root points to. On the way we may hit one of the // special cases and we'll deal with them. var a = fiber; var b = alternate; while (true) { var parentA = a.return; var parentB = parentA ? parentA.alternate : null; if (!parentA || !parentB) { // We're at the root. break;
}
// If both copies of the parent fiber point to the same child, we can // assume that the child is current. This happens when we bailout on low // priority: the bailed out fiber's child reuses the current child. if (parentA.child === parentB.child) { var child = parentA.child; while (child) { if (child === a) { // We've determined that A is the current branch.
assertIsMounted(parentA); return fiber;
} if (child === b) { // We've determined that B is the current branch.
assertIsMounted(parentA); return alternate;
}
child = child.sibling;
} // We should never have an alternate for any mounting node. So the only // way this could possibly happen is if this was unmounted, if at all.
reactProdInvariant('188');
}
if (a.return !== b.return) { // The return pointer of A and the return pointer of B point to different // fibers. We assume that return pointers never criss-cross, so A must // belong to the child set of A.return, and B must belong to the child // set of B.return.
a = parentA;
b = parentB;
} else { // The return pointers point to the same fiber. We'll have to use the // default, slow path: scan the child sets of each parent alternate to see // which child belongs to which set. // // Search parent A's child set var didFindChild = false; var _child = parentA.child; while (_child) { if (_child === a) {
didFindChild = true;
a = parentA;
b = parentB; break;
} if (_child === b) {
didFindChild = true;
b = parentA;
a = parentB; break;
}
_child = _child.sibling;
} if (!didFindChild) { // Search parent B's child set
_child = parentB.child; while (_child) { if (_child === a) {
didFindChild = true;
a = parentB;
b = parentA; break;
} if (_child === b) {
didFindChild = true;
b = parentB;
a = parentA; break;
}
_child = _child.sibling;
}
!didFindChild ? reactProdInvariant('189') : void 0;
}
}
!(a.alternate === b) ? reactProdInvariant('190') : void 0;
} // If the root is not a host container, we're in a disconnected tree. I.e. // unmounted.
!(a.tag === HostRoot) ? reactProdInvariant('188') : void 0; if (a.stateNode.current === a) { // We've determined that A is the current branch. return fiber;
} // Otherwise B has to be current branch. return alternate;
}
function findCurrentHostFiber(parent) { var currentParent = findCurrentFiberUsingSlowPath(parent); if (!currentParent) { returnnull;
}
// Next we'll drill down this component to find the first HostComponent/Text. var node = currentParent; while (true) { if (node.tag === HostComponent || node.tag === HostText) { return node;
} elseif (node.child) {
node.child.return = node;
node = node.child; continue;
} if (node === currentParent) { returnnull;
} while (!node.sibling) { if (!node.return || node.return === currentParent) { returnnull;
}
node = node.return;
}
node.sibling.return = node.return;
node = node.sibling;
} // Flow needs the return null here, but ESLint complains about it. // eslint-disable-next-line no-unreachable returnnull;
}
// Current virtual time var nowImplementation = function () { return 0;
}; var scheduledCallback = null; var yieldedValues = [];
var didStop = false; var expectedNumberOfYields = -1;
function scheduleDeferredCallback$1(callback, options) {
scheduledCallback = callback; var fakeCallbackId = 0; return fakeCallbackId;
}
function cancelDeferredCallback$1(timeoutID) {
scheduledCallback = null;
}
function setNowImplementation(implementation) {
nowImplementation = implementation;
}
function shouldYield$1() { if (expectedNumberOfYields !== -1 && yieldedValues.length >= expectedNumberOfYields) { // We yielded at least as many values as expected. Stop rendering.
didStop = true; returntrue;
} // Keep rendering. returnfalse;
}
function flushAll() {
yieldedValues = []; while (scheduledCallback !== null) { var cb = scheduledCallback;
scheduledCallback = null;
cb();
} var values = yieldedValues;
yieldedValues = []; return values;
}
function yieldValue(value) {
yieldedValues.push(value);
}
function clearYields() { var values = yieldedValues;
yieldedValues = []; return values;
}
// Renderers that don't support persistence // can re-export everything from this module.
function shim() {
reactProdInvariant('270');
}
// Persistence (when unsupported) var supportsPersistence = false; var cloneInstance = shim; var createContainerChildSet = shim; var appendChildToContainerChildSet = shim; var finalizeContainerChildren = shim; var replaceContainerChildren = shim; var cloneHiddenInstance = shim; var cloneUnhiddenInstance = shim; var createHiddenTextInstance = shim;
// Renderers that don't support hydration // can re-export everything from this module.
function shim$1() {
reactProdInvariant('305');
}
// Hydration (when unsupported)
var supportsHydration = false; var canHydrateInstance = shim$1; var canHydrateTextInstance = shim$1; var canHydrateSuspenseInstance = shim$1; var getNextHydratableSibling = shim$1; var getFirstHydratableChild = shim$1; var hydrateInstance = shim$1; var hydrateTextInstance = shim$1; var getNextHydratableInstanceAfterSuspenseInstance = shim$1; var clearSuspenseBoundary = shim$1; var clearSuspenseBoundaryFromContainer = shim$1;
var NO_CONTEXT = {}; var UPDATE_SIGNAL = {}; function getPublicInstance(inst) { switch (inst.tag) { case'INSTANCE': var _createNodeMock = inst.rootContainerInstance.createNodeMock; return _createNodeMock({
type: inst.type,
props: inst.props
}); default: return inst;
}
}
function appendChild(parentInstance, child) { var index = parentInstance.children.indexOf(child); if (index !== -1) {
parentInstance.children.splice(index, 1);
}
parentInstance.children.push(child);
}
function insertBefore(parentInstance, child, beforeChild) { var index = parentInstance.children.indexOf(child); if (index !== -1) {
parentInstance.children.splice(index, 1);
} var beforeIndex = parentInstance.children.indexOf(beforeChild);
parentInstance.children.splice(beforeIndex, 0, child);
}
function removeChild(parentInstance, child) { var index = parentInstance.children.indexOf(child);
parentInstance.children.splice(index, 1);
}
function getRootHostContext(rootContainerInstance) { return NO_CONTEXT;
}
function getChildHostContext(parentHostContext, type, rootContainerInstance) { return NO_CONTEXT;
}
function prepareForCommit(containerInfo) { // noop
}
function resetAfterCommit(containerInfo) { // noop
}
function appendInitialChild(parentInstance, child) { var index = parentInstance.children.indexOf(child); if (index !== -1) {
parentInstance.children.splice(index, 1);
}
parentInstance.children.push(child);
}
function finalizeInitialChildren(testElement, type, props, rootContainerInstance, hostContext) { returnfalse;
}
var isPrimaryRenderer = false; // This approach enables `now` to be mocked by tests, // Even after the reconciler has initialized and read host config values. var now = function () { return nowImplementation();
}; var scheduleDeferredCallback$$1 = scheduleDeferredCallback$1; var cancelDeferredCallback$$1 = cancelDeferredCallback$1; var shouldYield$$1 = shouldYield$1;
var scheduleTimeout = setTimeout; var cancelTimeout = clearTimeout; var noTimeout = -1; var schedulePassiveEffects = scheduleDeferredCallback$$1; var cancelPassiveEffects = cancelDeferredCallback$$1;
function commitTextUpdate(textInstance, oldText, newText) {
textInstance.text = newText;
}
function resetTextContent(testElement) { // noop
}
var appendChildToContainer = appendChild; var insertInContainerBefore = insertBefore; var removeChildFromContainer = removeChild;
function hideInstance(instance) {
instance.isHidden = true;
}
function hideTextInstance(textInstance) {
textInstance.isHidden = true;
}
function unhideInstance(instance, props) {
instance.isHidden = false;
}
function unhideTextInstance(textInstance, text) {
textInstance.isHidden = false;
}
/** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree.
*/
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
var describeComponentFrame = function (name, source, ownerName) { var sourceInfo = ''; if (source) { var path = source.fileName; var fileName = path.replace(BEFORE_SLASH_RE, '');
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
} elseif (ownerName) {
sourceInfo = ' (created by ' + ownerName + ')';
} return'\n in ' + (name || 'Unknown') + sourceInfo;
};
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
function describeFiber(fiber) { switch (fiber.tag) { case HostRoot: case HostPortal: case HostText: case Fragment: case ContextProvider: case ContextConsumer: return''; default: var owner = fiber._debugOwner; var source = fiber._debugSource; var name = getComponentName(fiber.type); var ownerName = null; if (owner) {
ownerName = getComponentName(owner.type);
} return describeComponentFrame(name, source, ownerName);
}
}
function getStackByFiberInDevAndProd(workInProgress) { var info = ''; var node = workInProgress; do {
info += describeFiber(node);
node = node.return;
} while (node); return info;
}
var enableUserTimingAPI = false;
var enableProfilerTimer = false; var enableSchedulerTracing = false; var enableSuspenseServerRenderer = false;
// Only used in www builds.
// Prefix measurements so that it's possible to filter them. // Longer prefixes are hard to read in DevTools. var reactEmoji = '\u269B'; var warningEmoji = '\u26D4'; var supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
// Keep track of current fiber so that we know the path to unwind on pause. // TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them? var currentFiber = null; // If we're in the middle of user code, which fiber and method is it? // Reusing `currentFiber` would be confusing for this because user code fiber // can change during commit phase too, but we don't need to unwind it (since // lifecycles in the commit phase don't resemble a tree). var currentPhase = null; var currentPhaseFiber = null; // Did lifecycle hook schedule an update? This is often a performance problem, // so we will keep track of it, and include it in the report. // Track commits caused by cascading updates. var isCommitting = false; var hasScheduledUpdateInCurrentCommit = false; var hasScheduledUpdateInCurrentPhase = false; var commitCountInCurrentWorkLoop = 0; var effectCountInCurrentCommit = 0; var isWaitingForCallback = false; // During commits, we only show a measurement once per method name // to avoid stretch the commit phase with measurement overhead. var labelsInCurrentCommit = new Set();
var formatMarkName = function (markName) { return reactEmoji + ' ' + markName;
};
var beginMark = function (markName) {
performance.mark(formatMarkName(markName));
};
var clearMark = function (markName) {
performance.clearMarks(formatMarkName(markName));
};
var endMark = function (label, markName, warning) { var formattedMarkName = formatMarkName(markName); var formattedLabel = formatLabel(label, warning); try {
performance.measure(formattedLabel, formattedMarkName);
} catch (err) {} // If previous mark was missing for some reason, this will throw. // This could only happen if React crashed in an unexpected place earlier. // Don't pile on with more errors.
// Clear marks immediately to avoid growing buffer.
performance.clearMarks(formattedMarkName);
performance.clearMeasures(formattedLabel);
};
var getFiberMarkName = function (label, debugID) { return label + ' (#' + debugID + ')';
};
var getFiberLabel = function (componentName, isMounted, phase) { if (phase === null) { // These are composite component total time measurements. return componentName + ' [' + (isMounted ? 'update' : 'mount') + ']';
} else { // Composite component methods. return componentName + '.' + phase;
}
};
var beginFiberMark = function (fiber, phase) { var componentName = getComponentName(fiber.type) || 'Unknown'; var debugID = fiber._debugID; var isMounted = fiber.alternate !== null; var label = getFiberLabel(componentName, isMounted, phase);
if (isCommitting && labelsInCurrentCommit.has(label)) { // During the commit phase, we don't show duplicate labels because // there is a fixed overhead for every measurement, and we don't // want to stretch the commit phase beyond necessary. returnfalse;
}
labelsInCurrentCommit.add(label);
var markName = getFiberMarkName(label, debugID);
beginMark(markName); returntrue;
};
var clearFiberMark = function (fiber, phase) { var componentName = getComponentName(fiber.type) || 'Unknown'; var debugID = fiber._debugID; var isMounted = fiber.alternate !== null; var label = getFiberLabel(componentName, isMounted, phase); var markName = getFiberMarkName(label, debugID);
clearMark(markName);
};
var endFiberMark = function (fiber, phase, warning) { var componentName = getComponentName(fiber.type) || 'Unknown'; var debugID = fiber._debugID; var isMounted = fiber.alternate !== null; var label = getFiberLabel(componentName, isMounted, phase); var markName = getFiberMarkName(label, debugID);
endMark(label, markName, warning);
};
var shouldIgnoreFiber = function (fiber) { // Host components should be skipped in the timeline. // We could check typeof fiber.type, but does this work with RN? switch (fiber.tag) { case HostRoot: case HostComponent: case HostText: case HostPortal: case Fragment: case ContextProvider: case ContextConsumer: case Mode: returntrue; default: returnfalse;
}
};
var clearPendingPhaseMeasurement = function () { if (currentPhase !== null && currentPhaseFiber !== null) {
clearFiberMark(currentPhaseFiber, currentPhase);
}
currentPhaseFiber = null;
currentPhase = null;
hasScheduledUpdateInCurrentPhase = false;
};
var pauseTimers = function () { // Stops all currently active measurements so that they can be resumed // if we continue in a later deferred loop from the same unit of work. var fiber = currentFiber; while (fiber) { if (fiber._debugIsCurrentlyTiming) {
endFiberMark(fiber, null, null);
}
fiber = fiber.return;
}
};
var resumeTimersRecursively = function (fiber) { if (fiber.return !== null) {
resumeTimersRecursively(fiber.return);
} if (fiber._debugIsCurrentlyTiming) {
beginFiberMark(fiber, null);
}
};
var resumeTimers = function () { // Resumes all measurements that were active during the last deferred loop. if (currentFiber !== null) {
resumeTimersRecursively(currentFiber);
}
};
function recordEffect() { if (enableUserTimingAPI) {
effectCountInCurrentCommit++;
}
}
function recordScheduleUpdate() { if (enableUserTimingAPI) { if (isCommitting) {
hasScheduledUpdateInCurrentCommit = true;
} if (currentPhase !== null && currentPhase !== 'componentWillMount' && currentPhase !== 'componentWillReceiveProps') {
hasScheduledUpdateInCurrentPhase = true;
}
}
}
function startRequestCallbackTimer() { if (enableUserTimingAPI) { if (supportsUserTiming && !isWaitingForCallback) {
isWaitingForCallback = true;
beginMark('(Waiting for async callback...)');
}
}
}
function stopRequestCallbackTimer(didExpire, expirationTime) { if (enableUserTimingAPI) { if (supportsUserTiming) {
isWaitingForCallback = false; var warning = didExpire ? 'React was blocked by main thread' : null;
endMark('(Waiting for async callback... will force flush in ' + expirationTime + ' ms)', '(Waiting for async callback...)', warning);
}
}
}
function startWorkTimer(fiber) { if (enableUserTimingAPI) { if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { return;
} // If we pause, this is the fiber to unwind from.
currentFiber = fiber; if (!beginFiberMark(fiber, null)) { return;
}
fiber._debugIsCurrentlyTiming = true;
}
}
function cancelWorkTimer(fiber) { if (enableUserTimingAPI) { if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { return;
} // Remember we shouldn't complete measurement for this fiber. // Otherwise flamechart will be deep even for small updates.
fiber._debugIsCurrentlyTiming = false;
clearFiberMark(fiber, null);
}
}
function stopWorkTimer(fiber) { if (enableUserTimingAPI) { if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { return;
} // If we pause, its parent is the fiber to unwind from.
currentFiber = fiber.return; if (!fiber._debugIsCurrentlyTiming) { return;
}
fiber._debugIsCurrentlyTiming = false;
endFiberMark(fiber, null, null);
}
}
function stopFailedWorkTimer(fiber) { if (enableUserTimingAPI) { if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { return;
} // If we pause, its parent is the fiber to unwind from.
currentFiber = fiber.return; if (!fiber._debugIsCurrentlyTiming) { return;
}
fiber._debugIsCurrentlyTiming = false; var warning = fiber.tag === SuspenseComponent || fiber.tag === DehydratedSuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
endFiberMark(fiber, null, warning);
}
}
function startPhaseTimer(fiber, phase) { if (enableUserTimingAPI) { if (!supportsUserTiming) { return;
}
clearPendingPhaseMeasurement(); if (!beginFiberMark(fiber, phase)) { return;
}
currentPhaseFiber = fiber;
currentPhase = phase;
}
}
function stopPhaseTimer() { if (enableUserTimingAPI) { if (!supportsUserTiming) { return;
} if (currentPhase !== null && currentPhaseFiber !== null) { var warning = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null;
endFiberMark(currentPhaseFiber, currentPhase, warning);
}
currentPhase = null;
currentPhaseFiber = null;
}
}
function startWorkLoopTimer(nextUnitOfWork) { if (enableUserTimingAPI) {
currentFiber = nextUnitOfWork; if (!supportsUserTiming) { return;
}
commitCountInCurrentWorkLoop = 0; // This is top level call. // Any other measurements are performed within.
beginMark('(React Tree Reconciliation)'); // Resume any measurements that were in progress during the last loop.
resumeTimers();
}
}
function stopWorkLoopTimer(interruptedBy, didCompleteRoot) { if (enableUserTimingAPI) { if (!supportsUserTiming) { return;
} var warning = null; if (interruptedBy !== null) { if (interruptedBy.tag === HostRoot) {
warning = 'A top-level update interrupted the previous render';
} else { var componentName = getComponentName(interruptedBy.type) || 'Unknown';
warning = 'An update to ' + componentName + ' interrupted the previous render';
}
} elseif (commitCountInCurrentWorkLoop > 1) {
warning = 'There were cascading updates';
}
commitCountInCurrentWorkLoop = 0; var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)'; // Pause any measurements until the next loop.
pauseTimers();
endMark(label, '(React Tree Reconciliation)', warning);
}
}
function startCommitTimer() { if (enableUserTimingAPI) { if (!supportsUserTiming) { return;
}
isCommitting = true;
hasScheduledUpdateInCurrentCommit = false;
labelsInCurrentCommit.clear();
beginMark('(Committing Changes)');
}
}
function stopCommitTimer() { if (enableUserTimingAPI) { if (!supportsUserTiming) { return;
}
var warning = null; if (hasScheduledUpdateInCurrentCommit) {
warning = 'Lifecycle hook scheduled a cascading update';
} elseif (commitCountInCurrentWorkLoop > 0) {
warning = 'Caused by a cascading update in earlier commit';
}
hasScheduledUpdateInCurrentCommit = false;
commitCountInCurrentWorkLoop++;
isCommitting = false;
labelsInCurrentCommit.clear();
function startCommitSnapshotEffectsTimer() { if (enableUserTimingAPI) { if (!supportsUserTiming) { return;
}
effectCountInCurrentCommit = 0;
beginMark('(Committing Snapshot Effects)');
}
}
function stopCommitSnapshotEffectsTimer() { if (enableUserTimingAPI) { if (!supportsUserTiming) { return;
} var count = effectCountInCurrentCommit;
effectCountInCurrentCommit = 0;
endMark('(Committing Snapshot Effects: ' + count + ' Total)', '(Committing Snapshot Effects)', null);
}
}
function startCommitHostEffectsTimer() { if (enableUserTimingAPI) { if (!supportsUserTiming) { return;
}
effectCountInCurrentCommit = 0;
beginMark('(Committing Host Effects)');
}
}
function stopCommitHostEffectsTimer() { if (enableUserTimingAPI) { if (!supportsUserTiming) { return;
} var count = effectCountInCurrentCommit;
effectCountInCurrentCommit = 0;
endMark('(Committing Host Effects: ' + count + ' Total)', '(Committing Host Effects)', null);
}
}
function startCommitLifeCyclesTimer() { if (enableUserTimingAPI) { if (!supportsUserTiming) { return;
}
effectCountInCurrentCommit = 0;
beginMark('(Calling Lifecycle Methods)');
}
}
function stopCommitLifeCyclesTimer() { if (enableUserTimingAPI) { if (!supportsUserTiming) { return;
} var count = effectCountInCurrentCommit;
effectCountInCurrentCommit = 0;
endMark('(Calling Lifecycle Methods: ' + count + ' Total)', '(Calling Lifecycle Methods)', null);
}
}
var valueStack = [];
var index = -1;
function createCursor(defaultValue) { return {
current: defaultValue
};
}
function pop(cursor, fiber) { if (index < 0) { return;
}
cursor.current = valueStack[index];
valueStack[index] = null;
index--;
}
function push(cursor, value, fiber) {
index++;
valueStack[index] = cursor.current;
cursor.current = value;
}
var emptyContextObject = {}; // A cursor to the current merged context object on the stack. var contextStackCursor = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. // We use this to get access to the parent context after we have already // pushed the next context provider, and now need to merge their contexts. var previousContext = emptyContextObject;
function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { if (didPushOwnContextIfProvider && isContextProvider(Component)) { // If the fiber is a context provider itself, when we read its context // we may have already pushed its own child context on the stack. A context // provider should not "see" its own child context. Therefore we read the // previous (parent) context instead for a context provider. return previousContext;
} return contextStackCursor.current;
}
function cacheContext(workInProgress, unmaskedContext, maskedContext) { var instance = workInProgress.stateNode;
instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
}
function getMaskedContext(workInProgress, unmaskedContext) { var type = workInProgress.type; var contextTypes = type.contextTypes; if (!contextTypes) { return emptyContextObject;
}
// Avoid recreating masked context unless unmasked context has changed. // Failing to do this will result in unnecessary calls to componentWillReceiveProps. // This may trigger infinite loops if componentWillReceiveProps calls setState. var instance = workInProgress.stateNode; if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { return instance.__reactInternalMemoizedMaskedChildContext;
}
var context = {}; for (var key in contextTypes) {
context[key] = unmaskedContext[key];
}
if (instance) {
cacheContext(workInProgress, unmaskedContext, context);
}
return context;
}
function hasContextChanged() { return didPerformWorkStackCursor.current;
}
function isContextProvider(type) { var childContextTypes = type.childContextTypes;
return childContextTypes !== null && childContextTypes !== undefined;
}
function popContext(fiber) {
pop(didPerformWorkStackCursor, fiber);
pop(contextStackCursor, fiber);
}
function popTopLevelContextObject(fiber) {
pop(didPerformWorkStackCursor, fiber);
pop(contextStackCursor, fiber);
}
function processChildContext(fiber, type, parentContext) { var instance = fiber.stateNode; var childContextTypes = type.childContextTypes;
// TODO (bvaughn) Replace this behavior with an invariant() in the future.
// It has only been added in Fiber to match the (unintentional) behavior in Stack.
if (typeof instance.getChildContext !== 'function') {
return parentContext;
}
var childContext = void 0;
startPhaseTimer(fiber, 'getChildContext');
childContext = instance.getChildContext();
stopPhaseTimer();
for (var contextKey in childContext) {
!(contextKey in childContextTypes) ? reactProdInvariant('108', getComponentName(type) || 'Unknown', contextKey) : void 0;
}
return _assign({}, parentContext, childContext);
}
function pushContextProvider(workInProgress) { var instance = workInProgress.stateNode;
// We push the context as early as possible to ensure stack integrity.
// If the instance does not exist yet, we will push null at first,
// and replace it on the stack later when invalidating the context. var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject;
// Remember the parent context so we can merge with it later.
// Inherit the parent's did-perform-work value to avoid inadvertently blocking updates.
previousContext = contextStackCursor.current;
push(contextStackCursor, memoizedMergedChildContext, workInProgress);
push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress);
return true;
}
function invalidateContextProvider(workInProgress, type, didChange) { var instance = workInProgress.stateNode;
!instance ? reactProdInvariant('169') : void 0;
if (didChange) {
// Merge parent and own context.
// Skip this if we're not updating due to sCU.
// This avoids unnecessarily recomputing memoized values. var mergedContext = processChildContext(workInProgress, type, previousContext);
instance.__reactInternalMemoizedMergedChildContext = mergedContext;
// Replace the old (or empty) context with the new one.
// It is important to unwind the context in the reverse order.
pop(didPerformWorkStackCursor, workInProgress);
pop(contextStackCursor, workInProgress);
// Now push the new context and mark that it has changed.
push(contextStackCursor, mergedContext, workInProgress);
push(didPerformWorkStackCursor, didChange, workInProgress);
} else {
pop(didPerformWorkStackCursor, workInProgress);
push(didPerformWorkStackCursor, didChange, workInProgress);
}
}
function findCurrentUnmaskedContext(fiber) {
// Currently this is only used with renderSubtreeIntoContainer; not sure if it
// makes sense elsewhere
!(isFiberMounted(fiber) && fiber.tag === ClassComponent) ? reactProdInvariant('170') : void 0;
var node = fiber;
do {
switch (node.tag) {
case HostRoot:
return node.stateNode.context;
case ClassComponent:
{ var Component = node.type;
if (isContextProvider(Component)) {
return node.stateNode.__reactInternalMemoizedMergedChildContext;
}
break;
}
}
node = node.return;
} while (node !== null);
reactProdInvariant('171');
}
var onCommitFiberRoot = null; var onCommitFiberUnmount = null;
function catchErrors(fn) {
return function (arg) {
try {
return fn(arg);
} catch (err) {
}
};
}
var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
function injectInternals(internals) {
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
// No DevTools
return false;
} var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (hook.isDisabled) {
// This isn't a real property on the hook, but it can be set to opt out
// of DevTools integration and associated warnings and logs.
// https://github.com/facebook/react/issues/3877
return true;
}
if (!hook.supportsFiber) {
return true;
}
try { var rendererID = hook.inject(internals);
// We have successfully injected, so now it is safe to set up hooks.
onCommitFiberRoot = catchErrors(function (root) {
return hook.onCommitFiberRoot(rendererID, root);
});
onCommitFiberUnmount = catchErrors(function (fiber) {
return hook.onCommitFiberUnmount(rendererID, fiber);
});
} catch (err) {
// Catch all errors because it is unsafe to throw during initialization.
}
// DevTools exists
return true;
}
function onCommitRoot(root) {
if (typeof onCommitFiberRoot === 'function') {
onCommitFiberRoot(root);
}
}
function onCommitUnmount(fiber) {
if (typeof onCommitFiberUnmount === 'function') {
onCommitFiberUnmount(fiber);
}
}
// Max 31 bit integer. The max integer size in V8 for 32-bit systems.
// Math.pow(2, 30) - 1
// 0b111111111111111111111111111111 var maxSigned31BitInt = 1073741823;
var NoWork = 0; var Never = 1; var Sync = maxSigned31BitInt;
var UNIT_SIZE = 10; var MAGIC_NUMBER_OFFSET = maxSigned31BitInt - 1;
// 1 unit of expiration time represents 10ms.
function msToExpirationTime(ms) {
// Always add an offset so that we don't clash with the magic number for NoWork.
return MAGIC_NUMBER_OFFSET - (ms / UNIT_SIZE | 0);
}
function expirationTimeToMs(expirationTime) {
return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE;
}
var LOW_PRIORITY_EXPIRATION = 5000; var LOW_PRIORITY_BATCH_SIZE = 250;
function computeAsyncExpiration(currentTime) {
return computeExpirationBucket(currentTime, LOW_PRIORITY_EXPIRATION, LOW_PRIORITY_BATCH_SIZE);
}
// We intentionally set a higher expiration time for interactive updates in
// dev than in production.
//
// If the main thread is being blocked so long that you hit the expiration,
// it's a problem that could be solved with better scheduling.
//
// People will be more likely to notice this and fix it with the long
// expiration time in development.
//
// In production we opt for better UX at the risk of masking scheduling
// problems, by expiring fast. var HIGH_PRIORITY_EXPIRATION = 150; var HIGH_PRIORITY_BATCH_SIZE = 100;
function computeInteractiveExpiration(currentTime) {
return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
}
var NoContext = 0; var ConcurrentMode = 1; var StrictMode = 2; var ProfileMode = 4;
if (enableProfilerTimer) {
// Note: The following is done to avoid a v8 performance cliff.
//
// Initializing the fields below to smis and later updating them with
// double values will cause Fibers to end up having separate shapes.
// This behavior/bug has something to do with Object.preventExtension().
// Fortunately this only impacts DEV builds.
// Unfortunately it makes React unusably slow for some applications.
// To work around this, initialize the fields below with doubles.
//
// Learn more about this here:
// https://github.com/facebook/react/issues/14365
// https://bugs.chromium.org/p/v8/issues/detail?id=8538
this.actualDuration = Number.NaN;
this.actualStartTime = Number.NaN;
this.selfBaseDuration = Number.NaN;
this.treeBaseDuration = Number.NaN;
// It's okay to replace the initial doubles with smis after initialization.
// This won't trigger the performance cliff mentioned above,
// and it simplifies other profiler code (including DevTools).
this.actualDuration = 0;
this.actualStartTime = -1;
this.selfBaseDuration = 0;
this.treeBaseDuration = 0;
}
}
// This is a constructor function, rather than a POJO constructor, still
// please ensure we do the following:
// 1) Nobody should add any instance methods on this. Instance methods can be
// more difficult to predict when they get optimized and they are almost
// never inlined properly in static compilers.
// 2) Nobody should rely on `instanceof Fiber` for type testing. We should
// always know when it is a fiber.
// 3) We might want to experiment with using numeric keys since they are easier
// to optimize in a non-JIT environment.
// 4) We can easily go from a constructor to a createFiber object literal if that
// is faster.
// 5) It should be easy to port this to a C struct and keep a C implementation
// compatible. var createFiber = function (tag, pendingProps, key, mode) {
// $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
return new FiberNode(tag, pendingProps, key, mode);
};
function shouldConstruct(Component) { var prototype = Component.prototype;
return !!(prototype && prototype.isReactComponent);
}
function isSimpleFunctionComponent(type) {
return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
}
function resolveLazyComponentTag(Component) {
if (typeof Component === 'function') {
return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
} else if (Component !== undefined && Component !== null) { var $$typeof = Component.$$typeof;
if ($$typeof === REACT_FORWARD_REF_TYPE) {
return ForwardRef;
}
if ($$typeof === REACT_MEMO_TYPE) {
return MemoComponent;
}
}
return IndeterminateComponent;
}
// This is used to create an alternate fiber to do work on.
function createWorkInProgress(current, pendingProps, expirationTime) { var workInProgress = current.alternate;
if (workInProgress === null) {
// We use a double buffering pooling technique because we know that we'll
// only ever need at most two versions of a tree. We pool the "other" unused
// node that we're free to reuse. This is lazily created to avoid allocating
// extra objects for things that are never updated. It also allow us to
// reclaim the extra memory if needed.
workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
workInProgress.elementType = current.elementType;
workInProgress.type = current.type;
workInProgress.stateNode = current.stateNode;
// We already have an alternate.
// Reset the effect tag.
workInProgress.effectTag = NoEffect;
// The effect list is no longer valid.
workInProgress.nextEffect = null;
workInProgress.firstEffect = null;
workInProgress.lastEffect = null;
if (enableProfilerTimer) {
// We intentionally reset, rather than copy, actualDuration & actualStartTime.
// This prevents time from endlessly accumulating in new commits.
// This has the downside of resetting values for different priority renders,
// But works for yielding (the common case) and should support resuming.
workInProgress.actualDuration = 0;
workInProgress.actualStartTime = -1;
}
}
// These will be overridden during the parent's reconciliation
workInProgress.sibling = current.sibling;
workInProgress.index = current.index;
workInProgress.ref = current.ref;
if (enableProfilerTimer) {
workInProgress.selfBaseDuration = current.selfBaseDuration;
workInProgress.treeBaseDuration = current.treeBaseDuration;
}
return workInProgress;
}
function createHostRootFiber(isConcurrent) { var mode = isConcurrent ? ConcurrentMode | StrictMode : NoContext;
if (enableProfilerTimer && isDevToolsPresent) {
// Always collect profile timings when DevTools are present.
// This enables DevTools to start capturing timing at any point–
// Without some nodes in the tree having empty base times.
mode |= ProfileMode;
}
return createFiber(HostRoot, null, null, mode);
}
function createFiberFromTypeAndProps(type, // React$ElementType
key, pendingProps, owner, mode, expirationTime) { var fiber = void 0;
var fiberTag = IndeterminateComponent;
// The resolved type is set if we know what the final type will be. I.e. it's not lazy. var resolvedType = type;
if (typeof type === 'function') {
if (shouldConstruct(type)) {
fiberTag = ClassComponent;
}
} else if (typeof type === 'string') {
fiberTag = HostComponent;
} else {
getTag: switch (type) {
case REACT_FRAGMENT_TYPE:
return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
case REACT_CONCURRENT_MODE_TYPE:
return createFiberFromMode(pendingProps, mode | ConcurrentMode | StrictMode, expirationTime, key);
case REACT_STRICT_MODE_TYPE:
return createFiberFromMode(pendingProps, mode | StrictMode, expirationTime, key);
case REACT_PROFILER_TYPE:
return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
case REACT_SUSPENSE_TYPE:
return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
default:
{
if (typeof type === 'object' && type !== null) {
switch (type.$$typeof) {
case REACT_PROVIDER_TYPE:
fiberTag = ContextProvider;
break getTag;
case REACT_CONTEXT_TYPE:
// This is a consumer
fiberTag = ContextConsumer;
break getTag;
case REACT_FORWARD_REF_TYPE:
fiberTag = ForwardRef;
break getTag;
case REACT_MEMO_TYPE:
fiberTag = MemoComponent;
break getTag;
case REACT_LAZY_TYPE:
fiberTag = LazyComponent;
resolvedType = null;
break getTag;
}
} var info = '';
reactProdInvariant('130', type == null ? type : typeof type, info);
}
}
}
function createFiberFromElement(element, mode, expirationTime) { var owner = null; var type = element.type; var key = element.key; var pendingProps = element.props; var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
return fiber;
}
function createFiberFromFragment(elements, mode, expirationTime, key) { var fiber = createFiber(Fragment, elements, key, mode);
fiber.expirationTime = expirationTime;
return fiber;
}
function createFiberFromProfiler(pendingProps, mode, expirationTime, key) { var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
// TODO: The Profiler fiber shouldn't have a type. It has a tag.
fiber.elementType = REACT_PROFILER_TYPE;
fiber.type = REACT_PROFILER_TYPE;
fiber.expirationTime = expirationTime;
return fiber;
}
function createFiberFromMode(pendingProps, mode, expirationTime, key) { var fiber = createFiber(Mode, pendingProps, key, mode);
// TODO: The Mode fiber shouldn't have a type. It has a tag. var type = (mode & ConcurrentMode) === NoContext ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE;
fiber.elementType = type;
fiber.type = type;
function createFiberFromText(content, mode, expirationTime) { var fiber = createFiber(HostText, content, null, mode);
fiber.expirationTime = expirationTime;
return fiber;
}
function createFiberFromHostInstanceForDeletion() { var fiber = createFiber(HostComponent, null, null, NoContext);
// TODO: These should not need a type.
fiber.elementType = 'DELETED';
fiber.type = 'DELETED';
return fiber;
}
function createFiberFromPortal(portal, mode, expirationTime) { var pendingProps = portal.children !== null ? portal.children : []; var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
fiber.expirationTime = expirationTime;
fiber.stateNode = {
containerInfo: portal.containerInfo,
pendingChildren: null, // Used by persistent updates
implementation: portal.implementation
};
return fiber;
}
// Used for stashing WIP properties to replay failed work in DEV.
var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
var _ReactInternals$Sched = ReactInternals$1.SchedulerTracing; var __interactionsRef = _ReactInternals$Sched.__interactionsRef; var __subscriberRef = _ReactInternals$Sched.__subscriberRef; var unstable_clear = _ReactInternals$Sched.unstable_clear; var unstable_getCurrent = _ReactInternals$Sched.unstable_getCurrent; var unstable_getThreadID = _ReactInternals$Sched.unstable_getThreadID; var unstable_subscribe = _ReactInternals$Sched.unstable_subscribe; var unstable_trace = _ReactInternals$Sched.unstable_trace; var unstable_unsubscribe = _ReactInternals$Sched.unstable_unsubscribe; var unstable_wrap = _ReactInternals$Sched.unstable_wrap;
// TODO: This should be lifted into the renderer.
// The following attributes are only used by interaction tracing builds.
// They enable interactions to be associated with their async work,
// And expose interaction metadata to the React DevTools Profiler plugin.
// Note that these attributes are only defined when the enableSchedulerTracing flag is enabled.
// Exported FiberRoot type includes all properties,
// To avoid requiring potentially error-prone :any casts throughout the project.
// Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true).
// The types are defined separately within this file to ensure they stay in sync.
// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.)
function createFiberRoot(containerInfo, isConcurrent, hydrate) {
// Cyclic construction. This cheats the type system right now because
// stateNode is any. var uninitializedFiber = createHostRootFiber(isConcurrent);
var root = void 0;
if (enableSchedulerTracing) {
root = {
current: uninitializedFiber,
containerInfo: containerInfo,
pendingChildren: null,
// The reason for the way the Flow types are structured in this file,
// Is to avoid needing :any casts everywhere interaction tracing fields are used.
// Unfortunately that requires an :any cast for non-interaction tracing capable builds.
// $FlowFixMe Remove this :any cast and replace it with something better.
return root;
}
var ReactInternals$2 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
var _ReactInternals$Sched$1 = ReactInternals$2.Scheduler; var unstable_cancelCallback = _ReactInternals$Sched$1.unstable_cancelCallback; var unstable_now = _ReactInternals$Sched$1.unstable_now; var unstable_scheduleCallback = _ReactInternals$Sched$1.unstable_scheduleCallback; var unstable_shouldYield = _ReactInternals$Sched$1.unstable_shouldYield; var unstable_getFirstCallbackNode = _ReactInternals$Sched$1.unstable_getFirstCallbackNode; var unstable_runWithPriority = _ReactInternals$Sched$1.unstable_runWithPriority; var unstable_next = _ReactInternals$Sched$1.unstable_next; var unstable_continueExecution = _ReactInternals$Sched$1.unstable_continueExecution; var unstable_pauseExecution = _ReactInternals$Sched$1.unstable_pauseExecution; var unstable_getCurrentPriorityLevel = _ReactInternals$Sched$1.unstable_getCurrentPriorityLevel; var unstable_ImmediatePriority = _ReactInternals$Sched$1.unstable_ImmediatePriority; var unstable_UserBlockingPriority = _ReactInternals$Sched$1.unstable_UserBlockingPriority; var unstable_NormalPriority = _ReactInternals$Sched$1.unstable_NormalPriority; var unstable_LowPriority = _ReactInternals$Sched$1.unstable_LowPriority; var unstable_IdlePriority = _ReactInternals$Sched$1.unstable_IdlePriority;
/**
* Call a function while guarding against errors that happens within it.
* Returns an error if it throws, otherwise null.
*
* In production, this is implemented using a try-catch. The reason we don't
* use a try-catch directly is so that we can swap out a different
* implementation in DEV mode.
*
* @param {String} name of the guard to use for logging or debugging
* @param {Function} func The function to invoke
* @param {*} context The context to use when calling the function
* @param {...*} args Arguments for function
*/
/**
* Same as invokeGuardedCallback, but instead of returning an error, it stores
* it in a global so it can be rethrown by `rethrowCaughtError` later.
* TODO: See if caughtError and rethrowError can be unified.
*
* @param {String} name of the guard to use for logging or debugging
* @param {Function} func The function to invoke
* @param {*} context The context to use when calling the function
* @param {...*} args Arguments for function
*/
/**
* During execution of guarded functions we will capture the first error which
* we will rethrow to be handled by the top level error handler.
*/
/**
* Forked from fbjs/warning:
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
*
* Only change is we use console.warn instead of console.error,
* and do nothing when 'console' is not supported.
* This really simplifies the code.
* ---
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
// This lets us hook into Fiber to debug what it's doing.
// See https://github.com/facebook/react/pull/8033.
// This is not part of the public API, not even for React DevTools.
// You may only inject a debugTool if you work on React Fiber itself.
// TODO: Offscreen updates should never suspend. However, a promise that
// suspended inside an offscreen subtree should be able to ping at the priority
// of the outer render.
function markPendingPriorityLevel(root, expirationTime) {
// If there's a gap between completing a failed root and retrying it,
// additional updates may be scheduled. Clear `didError`, in case the update
// is sufficient to fix the error.
root.didError = false;
// Update the latest and earliest pending times var earliestPendingTime = root.earliestPendingTime;
if (earliestPendingTime === NoWork) {
// No other pending updates.
root.earliestPendingTime = root.latestPendingTime = expirationTime;
} else {
if (earliestPendingTime < expirationTime) {
// This is the earliest pending update.
root.earliestPendingTime = expirationTime;
} else { var latestPendingTime = root.latestPendingTime;
if (latestPendingTime > expirationTime) {
// This is the latest pending update
root.latestPendingTime = expirationTime;
}
}
}
findNextExpirationTimeToWorkOn(expirationTime, root);
}
function markCommittedPriorityLevels(root, earliestRemainingTime) {
root.didError = false;
if (earliestRemainingTime < root.latestPingedTime) {
root.latestPingedTime = NoWork;
}
// Let's see if the previous latest known pending level was just flushed. var latestPendingTime = root.latestPendingTime;
if (latestPendingTime !== NoWork) {
if (latestPendingTime > earliestRemainingTime) {
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Dauer der Verarbeitung: 0.68 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.