aboutsummaryrefslogtreecommitdiff
path: root/AnsiblePilotPlugin/index.js
diff options
context:
space:
mode:
authorspmfox <spmfox@foxwd.com>2023-08-03 22:58:31 -0400
committerspmfox <spmfox@foxwd.com>2023-08-03 22:58:31 -0400
commit65182b27d8b5ee76157a1b82f59c719882fc86fa (patch)
treea86037c2996576c5ac0f2345b55ced7d87cbf6c6 /AnsiblePilotPlugin/index.js
parent096ca12f11e27c370057e20d5badd6d332eeb4ae (diff)
fixing scroll issueHEADmaindev
Diffstat (limited to 'AnsiblePilotPlugin/index.js')
-rw-r--r--AnsiblePilotPlugin/index.js13087
1 files changed, 7746 insertions, 5341 deletions
diff --git a/AnsiblePilotPlugin/index.js b/AnsiblePilotPlugin/index.js
index ab4f3bd..eda3158 100644
--- a/AnsiblePilotPlugin/index.js
+++ b/AnsiblePilotPlugin/index.js
@@ -25,129 +25,31 @@
mod
));
- // node_modules/object-assign/index.js
- var require_object_assign = __commonJS({
- "node_modules/object-assign/index.js"(exports, module) {
- "use strict";
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
- function toObject(val) {
- if (val === null || val === void 0) {
- throw new TypeError("Object.assign cannot be called with null or undefined");
- }
- return Object(val);
- }
- function shouldUseNative() {
- try {
- if (!Object.assign) {
- return false;
- }
- var test1 = new String("abc");
- test1[5] = "de";
- if (Object.getOwnPropertyNames(test1)[0] === "5") {
- return false;
- }
- var test2 = {};
- for (var i = 0; i < 10; i++) {
- test2["_" + String.fromCharCode(i)] = i;
- }
- var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
- return test2[n];
- });
- if (order2.join("") !== "0123456789") {
- return false;
- }
- var test3 = {};
- "abcdefghijklmnopqrst".split("").forEach(function(letter) {
- test3[letter] = letter;
- });
- if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
- return false;
- }
- return true;
- } catch (err) {
- return false;
- }
- }
- module.exports = shouldUseNative() ? Object.assign : function(target, source) {
- var from;
- var to = toObject(target);
- var symbols;
- for (var s = 1; s < arguments.length; s++) {
- from = Object(arguments[s]);
- for (var key in from) {
- if (hasOwnProperty.call(from, key)) {
- to[key] = from[key];
- }
- }
- if (getOwnPropertySymbols) {
- symbols = getOwnPropertySymbols(from);
- for (var i = 0; i < symbols.length; i++) {
- if (propIsEnumerable.call(from, symbols[i])) {
- to[symbols[i]] = from[symbols[i]];
- }
- }
- }
- }
- return to;
- };
- }
- });
-
// node_modules/react/cjs/react.development.js
var require_react_development = __commonJS({
- "node_modules/react/cjs/react.development.js"(exports) {
+ "node_modules/react/cjs/react.development.js"(exports, module) {
"use strict";
if (true) {
(function() {
"use strict";
- var _assign = require_object_assign();
- var ReactVersion = "17.0.2";
- var REACT_ELEMENT_TYPE = 60103;
- var REACT_PORTAL_TYPE = 60106;
- exports.Fragment = 60107;
- exports.StrictMode = 60108;
- exports.Profiler = 60114;
- var REACT_PROVIDER_TYPE = 60109;
- var REACT_CONTEXT_TYPE = 60110;
- var REACT_FORWARD_REF_TYPE = 60112;
- exports.Suspense = 60113;
- var REACT_SUSPENSE_LIST_TYPE = 60120;
- var REACT_MEMO_TYPE = 60115;
- var REACT_LAZY_TYPE = 60116;
- var REACT_BLOCK_TYPE = 60121;
- var REACT_SERVER_BLOCK_TYPE = 60122;
- var REACT_FUNDAMENTAL_TYPE = 60117;
- var REACT_SCOPE_TYPE = 60119;
- var REACT_OPAQUE_ID_TYPE = 60128;
- var REACT_DEBUG_TRACING_MODE_TYPE = 60129;
- var REACT_OFFSCREEN_TYPE = 60130;
- var REACT_LEGACY_HIDDEN_TYPE = 60131;
- if (typeof Symbol === "function" && Symbol.for) {
- var symbolFor = Symbol.for;
- REACT_ELEMENT_TYPE = symbolFor("react.element");
- REACT_PORTAL_TYPE = symbolFor("react.portal");
- exports.Fragment = symbolFor("react.fragment");
- exports.StrictMode = symbolFor("react.strict_mode");
- exports.Profiler = symbolFor("react.profiler");
- REACT_PROVIDER_TYPE = symbolFor("react.provider");
- REACT_CONTEXT_TYPE = symbolFor("react.context");
- REACT_FORWARD_REF_TYPE = symbolFor("react.forward_ref");
- exports.Suspense = symbolFor("react.suspense");
- REACT_SUSPENSE_LIST_TYPE = symbolFor("react.suspense_list");
- REACT_MEMO_TYPE = symbolFor("react.memo");
- REACT_LAZY_TYPE = symbolFor("react.lazy");
- REACT_BLOCK_TYPE = symbolFor("react.block");
- REACT_SERVER_BLOCK_TYPE = symbolFor("react.server.block");
- REACT_FUNDAMENTAL_TYPE = symbolFor("react.fundamental");
- REACT_SCOPE_TYPE = symbolFor("react.scope");
- REACT_OPAQUE_ID_TYPE = symbolFor("react.opaque.id");
- REACT_DEBUG_TRACING_MODE_TYPE = symbolFor("react.debug_trace_mode");
- REACT_OFFSCREEN_TYPE = symbolFor("react.offscreen");
- REACT_LEGACY_HIDDEN_TYPE = symbolFor("react.legacy_hidden");
- }
- var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
+ }
+ var ReactVersion = "18.2.0";
+ var REACT_ELEMENT_TYPE = Symbol.for("react.element");
+ var REACT_PORTAL_TYPE = Symbol.for("react.portal");
+ var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
+ var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
+ var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
+ var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
+ var REACT_CONTEXT_TYPE = Symbol.for("react.context");
+ var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
+ var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
+ var REACT_MEMO_TYPE = Symbol.for("react.memo");
+ var REACT_LAZY_TYPE = Symbol.for("react.lazy");
+ var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = "@@iterator";
function getIteratorFn(maybeIterable) {
if (maybeIterable === null || typeof maybeIterable !== "object") {
@@ -167,7 +69,13 @@
current: null
};
var ReactCurrentBatchConfig = {
- transition: 0
+ transition: null
+ };
+ var ReactCurrentActQueue = {
+ current: null,
+ // Used to reproduce behavior of `batchedUpdates` in legacy mode.
+ isBatchingLegacy: false,
+ didScheduleLegacyUpdate: false
};
var ReactCurrentOwner = {
/**
@@ -202,34 +110,38 @@
return stack;
};
}
- var IsSomeRendererActing = {
- current: false
- };
+ var enableScopeAPI = false;
+ var enableCacheElement = false;
+ var enableTransitionTracing = false;
+ var enableLegacyHidden = false;
+ var enableDebugTracing = false;
var ReactSharedInternals = {
ReactCurrentDispatcher,
ReactCurrentBatchConfig,
- ReactCurrentOwner,
- IsSomeRendererActing,
- // Used by renderers to avoid bundling object-assign twice in UMD bundles:
- assign: _assign
+ ReactCurrentOwner
};
{
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
+ ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
}
function warn(format2) {
{
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
+ {
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+ printWarning("warn", format2, args);
}
- printWarning("warn", format2, args);
}
}
function error(format2) {
{
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- args[_key2 - 1] = arguments[_key2];
+ {
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
+ args[_key2 - 1] = arguments[_key2];
+ }
+ printWarning("error", format2, args);
}
- printWarning("error", format2, args);
}
}
function printWarning(level, format2, args) {
@@ -241,7 +153,7 @@
args = args.concat([stack]);
}
var argsWithFormat = args.map(function(item) {
- return "" + item;
+ return String(item);
});
argsWithFormat.unshift("Warning: " + format2);
Function.prototype.apply.call(console[level], console, argsWithFormat);
@@ -321,6 +233,7 @@
warnNoop(publicInstance, "setState");
}
};
+ var assign = Object.assign;
var emptyObject = {};
{
Object.freeze(emptyObject);
@@ -333,10 +246,8 @@
}
Component7.prototype.isReactComponent = {};
Component7.prototype.setState = function(partialState, callback) {
- if (!(typeof partialState === "object" || typeof partialState === "function" || partialState == null)) {
- {
- throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
- }
+ if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null) {
+ throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
}
this.updater.enqueueSetState(this, partialState, callback, "setState");
};
@@ -373,7 +284,7 @@
}
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
pureComponentPrototype.constructor = PureComponent;
- _assign(pureComponentPrototype, Component7.prototype);
+ assign(pureComponentPrototype, Component7.prototype);
pureComponentPrototype.isPureReactComponent = true;
function createRef2() {
var refObject = {
@@ -384,20 +295,56 @@
}
return refObject;
}
+ var isArrayImpl = Array.isArray;
+ function isArray(a) {
+ return isArrayImpl(a);
+ }
+ function typeName(value) {
+ {
+ var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
+ return type;
+ }
+ }
+ function willCoercionThrow(value) {
+ {
+ try {
+ testStringCoercion(value);
+ return false;
+ } catch (e) {
+ return true;
+ }
+ }
+ }
+ function testStringCoercion(value) {
+ return "" + value;
+ }
+ function checkKeyStringCoercion(value) {
+ {
+ if (willCoercionThrow(value)) {
+ error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
+ return testStringCoercion(value);
+ }
+ }
+ }
function getWrappedName(outerType, innerType, wrapperName) {
+ var displayName = outerType.displayName;
+ if (displayName) {
+ return displayName;
+ }
var functionName = innerType.displayName || innerType.name || "";
- return outerType.displayName || (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName);
+ return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
}
function getContextName(type) {
return type.displayName || "Context";
}
- function getComponentName(type) {
+ function getComponentNameFromType(type) {
if (type == null) {
return null;
}
{
if (typeof type.tag === "number") {
- error("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue.");
+ error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
}
}
if (typeof type === "function") {
@@ -407,15 +354,15 @@
return type;
}
switch (type) {
- case exports.Fragment:
+ case REACT_FRAGMENT_TYPE:
return "Fragment";
case REACT_PORTAL_TYPE:
return "Portal";
- case exports.Profiler:
+ case REACT_PROFILER_TYPE:
return "Profiler";
- case exports.StrictMode:
+ case REACT_STRICT_MODE_TYPE:
return "StrictMode";
- case exports.Suspense:
+ case REACT_SUSPENSE_TYPE:
return "Suspense";
case REACT_SUSPENSE_LIST_TYPE:
return "SuspenseList";
@@ -431,15 +378,17 @@
case REACT_FORWARD_REF_TYPE:
return getWrappedName(type, type.render, "ForwardRef");
case REACT_MEMO_TYPE:
- return getComponentName(type.type);
- case REACT_BLOCK_TYPE:
- return getComponentName(type._render);
+ var outerName = type.displayName || null;
+ if (outerName !== null) {
+ return outerName;
+ }
+ return getComponentNameFromType(type.type) || "Memo";
case REACT_LAZY_TYPE: {
var lazyComponent = type;
var payload = lazyComponent._payload;
var init = lazyComponent._init;
try {
- return getComponentName(init(payload));
+ return getComponentNameFromType(init(payload));
} catch (x) {
return null;
}
@@ -514,7 +463,7 @@
function warnIfStringRefCannotBeAutoConverted(config) {
{
if (typeof config.ref === "string" && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
- var componentName = getComponentName(ReactCurrentOwner.current.type);
+ var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
if (!didWarnAboutStringRefs[componentName]) {
error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
didWarnAboutStringRefs[componentName] = true;
@@ -576,6 +525,9 @@
}
}
if (hasValidKey(config)) {
+ {
+ checkKeyStringCoercion(config.key);
+ }
key = "" + config.key;
}
self = config.__self === void 0 ? null : config.__self;
@@ -627,13 +579,11 @@
return newElement;
}
function cloneElement2(element, config, children) {
- if (!!(element === null || element === void 0)) {
- {
- throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
- }
+ if (element === null || element === void 0) {
+ throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
}
var propName;
- var props = _assign({}, element.props);
+ var props = assign({}, element.props);
var key = element.key;
var ref = element.ref;
var self = element._self;
@@ -645,6 +595,9 @@
owner = ReactCurrentOwner.current;
}
if (hasValidKey(config)) {
+ {
+ checkKeyStringCoercion(config.key);
+ }
key = "" + config.key;
}
var defaultProps;
@@ -696,6 +649,9 @@
}
function getElementKey(element, index) {
if (typeof element === "object" && element !== null && element.key != null) {
+ {
+ checkKeyStringCoercion(element.key);
+ }
return escape("" + element.key);
}
return index.toString(36);
@@ -726,7 +682,7 @@
var _child = children;
var mappedChild = callback(_child);
var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
- if (Array.isArray(mappedChild)) {
+ if (isArray(mappedChild)) {
var escapedChildKey = "";
if (childKey != null) {
escapedChildKey = escapeUserProvidedKey(childKey) + "/";
@@ -736,6 +692,11 @@
});
} else if (mappedChild != null) {
if (isValidElement2(mappedChild)) {
+ {
+ if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
+ checkKeyStringCoercion(mappedChild.key);
+ }
+ }
mappedChild = cloneAndReplaceKey(
mappedChild,
// Keep both the (mapped) and old keys if they differ, just as
@@ -743,6 +704,7 @@
escapedPrefix + // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
(mappedChild.key && (!_child || _child.key !== mappedChild.key) ? (
// $FlowFixMe Flow incorrectly thinks existing element's key can be a number
+ // eslint-disable-next-line react-internal/safe-string-coercion
escapeUserProvidedKey("" + mappedChild.key) + "/"
) : "") + childKey
);
@@ -755,7 +717,7 @@
var nextName;
var subtreeCount = 0;
var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR;
- if (Array.isArray(children)) {
+ if (isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
nextName = nextNamePrefix + getElementKey(child, i);
@@ -782,12 +744,8 @@
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
}
} else if (type === "object") {
- var childrenString = "" + children;
- {
- {
- throw Error("Objects are not valid as a React child (found: " + (childrenString === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead.");
- }
- }
+ var childrenString = String(children);
+ throw new Error("Objects are not valid as a React child (found: " + (childrenString === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead.");
}
}
return subtreeCount;
@@ -822,25 +780,13 @@
}
function onlyChild(children) {
if (!isValidElement2(children)) {
- {
- throw Error("React.Children.only expected to receive a single React element child.");
- }
+ throw new Error("React.Children.only expected to receive a single React element child.");
}
return children;
}
- function createContext2(defaultValue, calculateChangedBits) {
- if (calculateChangedBits === void 0) {
- calculateChangedBits = null;
- } else {
- {
- if (calculateChangedBits !== null && typeof calculateChangedBits !== "function") {
- error("createContext: Expected the optional second argument to be a function. Instead received: %s", calculateChangedBits);
- }
- }
- }
+ function createContext2(defaultValue) {
var context = {
$$typeof: REACT_CONTEXT_TYPE,
- _calculateChangedBits: calculateChangedBits,
// As a workaround to support multiple concurrent renderers, we categorize
// some renderers as primary and others as secondary. We only expect
// there to be two concurrent renderers at most: React Native (primary) and
@@ -853,7 +799,10 @@
_threadCount: 0,
// These are circular
Provider: null,
- Consumer: null
+ Consumer: null,
+ // Add these to use same hidden class in VM as ServerContext
+ _defaultValue: null,
+ _globalName: null
};
context.Provider = {
$$typeof: REACT_PROVIDER_TYPE,
@@ -865,8 +814,7 @@
{
var Consumer = {
$$typeof: REACT_CONTEXT_TYPE,
- _context: context,
- _calculateChangedBits: context._calculateChangedBits
+ _context: context
};
Object.defineProperties(Consumer, {
Provider: {
@@ -942,31 +890,38 @@
if (payload._status === Uninitialized) {
var ctor = payload._result;
var thenable = ctor();
- var pending = payload;
- pending._status = Pending;
- pending._result = thenable;
- thenable.then(function(moduleObject) {
- if (payload._status === Pending) {
- var defaultExport = moduleObject.default;
- {
- if (defaultExport === void 0) {
- error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
- }
- }
+ thenable.then(function(moduleObject2) {
+ if (payload._status === Pending || payload._status === Uninitialized) {
var resolved = payload;
resolved._status = Resolved;
- resolved._result = defaultExport;
+ resolved._result = moduleObject2;
}
}, function(error2) {
- if (payload._status === Pending) {
+ if (payload._status === Pending || payload._status === Uninitialized) {
var rejected = payload;
rejected._status = Rejected;
rejected._result = error2;
}
});
+ if (payload._status === Uninitialized) {
+ var pending = payload;
+ pending._status = Pending;
+ pending._result = thenable;
+ }
}
if (payload._status === Resolved) {
- return payload._result;
+ var moduleObject = payload._result;
+ {
+ if (moduleObject === void 0) {
+ error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", moduleObject);
+ }
+ }
+ {
+ if (!("default" in moduleObject)) {
+ error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
+ }
+ }
+ return moduleObject.default;
} else {
throw payload._result;
}
@@ -974,7 +929,7 @@
function lazy(ctor) {
var payload = {
// We use these fields to store the result.
- _status: -1,
+ _status: Uninitialized,
_result: ctor
};
var lazyType = {
@@ -1047,7 +1002,7 @@
},
set: function(name) {
ownName = name;
- if (render.displayName == null) {
+ if (!render.name && !render.displayName) {
render.displayName = name;
}
}
@@ -1055,16 +1010,23 @@
}
return elementType;
}
- var enableScopeAPI = false;
+ var REACT_MODULE_REFERENCE;
+ {
+ REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
+ }
function isValidElementType(type) {
if (typeof type === "string" || typeof type === "function") {
return true;
}
- if (type === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI) {
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
return true;
}
if (typeof type === "object" && type !== null) {
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
+ // types supported by any Flight configuration anywhere since
+ // we don't know which Flight build this will end up being used
+ // with.
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
return true;
}
}
@@ -1091,7 +1053,7 @@
},
set: function(name) {
ownName = name;
- if (type.displayName == null) {
+ if (!type.name && !type.displayName) {
type.displayName = name;
}
}
@@ -1101,19 +1063,16 @@
}
function resolveDispatcher() {
var dispatcher = ReactCurrentDispatcher.current;
- if (!(dispatcher !== null)) {
- {
- throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
+ {
+ if (dispatcher === null) {
+ error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
}
}
return dispatcher;
}
- function useContext2(Context, unstable_observedBits) {
+ function useContext2(Context) {
var dispatcher = resolveDispatcher();
{
- if (unstable_observedBits !== void 0) {
- error("useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s", unstable_observedBits, typeof unstable_observedBits === "number" && Array.isArray(arguments[2]) ? "\n\nDid you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://reactjs.org/link/rules-of-hooks" : "");
- }
if (Context._context !== void 0) {
var realContext = Context._context;
if (realContext.Consumer === Context) {
@@ -1123,7 +1082,7 @@
}
}
}
- return dispatcher.useContext(Context, unstable_observedBits);
+ return dispatcher.useContext(Context);
}
function useState4(initialState) {
var dispatcher = resolveDispatcher();
@@ -1141,6 +1100,10 @@
var dispatcher = resolveDispatcher();
return dispatcher.useEffect(create, deps);
}
+ function useInsertionEffect(create, deps) {
+ var dispatcher = resolveDispatcher();
+ return dispatcher.useInsertionEffect(create, deps);
+ }
function useLayoutEffect2(create, deps) {
var dispatcher = resolveDispatcher();
return dispatcher.useLayoutEffect(create, deps);
@@ -1163,6 +1126,22 @@
return dispatcher.useDebugValue(value, formatterFn);
}
}
+ function useTransition() {
+ var dispatcher = resolveDispatcher();
+ return dispatcher.useTransition();
+ }
+ function useDeferredValue(value) {
+ var dispatcher = resolveDispatcher();
+ return dispatcher.useDeferredValue(value);
+ }
+ function useId() {
+ var dispatcher = resolveDispatcher();
+ return dispatcher.useId();
+ }
+ function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
+ var dispatcher = resolveDispatcher();
+ return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
+ }
var disabledDepth = 0;
var prevLog;
var prevInfo;
@@ -1213,25 +1192,25 @@
writable: true
};
Object.defineProperties(console, {
- log: _assign({}, props, {
+ log: assign({}, props, {
value: prevLog
}),
- info: _assign({}, props, {
+ info: assign({}, props, {
value: prevInfo
}),
- warn: _assign({}, props, {
+ warn: assign({}, props, {
value: prevWarn
}),
- error: _assign({}, props, {
+ error: assign({}, props, {
value: prevError
}),
- group: _assign({}, props, {
+ group: assign({}, props, {
value: prevGroup
}),
- groupCollapsed: _assign({}, props, {
+ groupCollapsed: assign({}, props, {
value: prevGroupCollapsed
}),
- groupEnd: _assign({}, props, {
+ groupEnd: assign({}, props, {
value: prevGroupEnd
})
});
@@ -1332,6 +1311,9 @@
c--;
if (c < 0 || sampleLines[s] !== controlLines[c]) {
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
+ if (fn.displayName && _frame.includes("<anonymous>")) {
+ _frame = _frame.replace("<anonymous>", fn.displayName);
+ }
{
if (typeof fn === "function") {
componentFrameCache.set(fn, _frame);
@@ -1384,7 +1366,7 @@
return describeBuiltInComponentFrame(type);
}
switch (type) {
- case exports.Suspense:
+ case REACT_SUSPENSE_TYPE:
return describeBuiltInComponentFrame("Suspense");
case REACT_SUSPENSE_LIST_TYPE:
return describeBuiltInComponentFrame("SuspenseList");
@@ -1395,8 +1377,6 @@
return describeFunctionComponentFrame(type.render);
case REACT_MEMO_TYPE:
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
- case REACT_BLOCK_TYPE:
- return describeFunctionComponentFrame(type._render);
case REACT_LAZY_TYPE: {
var lazyComponent = type;
var payload = lazyComponent._payload;
@@ -1425,7 +1405,7 @@
}
function checkPropTypes(typeSpecs, values, location, componentName, element) {
{
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
+ var has = Function.call.bind(hasOwnProperty);
for (var typeSpecName in typeSpecs) {
if (has(typeSpecs, typeSpecName)) {
var error$1 = void 0;
@@ -1471,7 +1451,7 @@
}
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
- var name = getComponentName(ReactCurrentOwner.current.type);
+ var name = getComponentNameFromType(ReactCurrentOwner.current.type);
if (name) {
return "\n\nCheck the render method of `" + name + "`.";
}
@@ -1515,7 +1495,7 @@
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
var childOwner = "";
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
- childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
}
{
setCurrentlyValidatingElement$1(element);
@@ -1527,7 +1507,7 @@
if (typeof node !== "object") {
return;
}
- if (Array.isArray(node)) {
+ if (isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
if (isValidElement2(child)) {
@@ -1570,11 +1550,11 @@
return;
}
if (propTypes) {
- var name = getComponentName(type);
+ var name = getComponentNameFromType(type);
checkPropTypes(propTypes, element.props, "prop", name, element);
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
propTypesMisspellWarningShown = true;
- var _name = getComponentName(type);
+ var _name = getComponentNameFromType(type);
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
}
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
@@ -1617,10 +1597,10 @@
var typeString;
if (type === null) {
typeString = "null";
- } else if (Array.isArray(type)) {
+ } else if (isArray(type)) {
typeString = "array";
} else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
- typeString = "<" + (getComponentName(type.type) || "Unknown") + " />";
+ typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
info = " Did you accidentally export a JSX literal instead of a component?";
} else {
typeString = typeof type;
@@ -1638,7 +1618,7 @@
validateChildKeys(arguments[i], type);
}
}
- if (type === exports.Fragment) {
+ if (type === REACT_FRAGMENT_TYPE) {
validateFragmentProps(element);
} else {
validatePropTypes(element);
@@ -1675,12 +1655,194 @@
validatePropTypes(newElement);
return newElement;
}
- {
+ function startTransition(scope, options) {
+ var prevTransition = ReactCurrentBatchConfig.transition;
+ ReactCurrentBatchConfig.transition = {};
+ var currentTransition = ReactCurrentBatchConfig.transition;
+ {
+ ReactCurrentBatchConfig.transition._updatedFibers = /* @__PURE__ */ new Set();
+ }
try {
- var frozenObject = Object.freeze({});
- /* @__PURE__ */ new Map([[frozenObject, null]]);
- /* @__PURE__ */ new Set([frozenObject]);
- } catch (e) {
+ scope();
+ } finally {
+ ReactCurrentBatchConfig.transition = prevTransition;
+ {
+ if (prevTransition === null && currentTransition._updatedFibers) {
+ var updatedFibersCount = currentTransition._updatedFibers.size;
+ if (updatedFibersCount > 10) {
+ warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.");
+ }
+ currentTransition._updatedFibers.clear();
+ }
+ }
+ }
+ }
+ var didWarnAboutMessageChannel = false;
+ var enqueueTaskImpl = null;
+ function enqueueTask(task) {
+ if (enqueueTaskImpl === null) {
+ try {
+ var requireString = ("require" + Math.random()).slice(0, 7);
+ var nodeRequire = module && module[requireString];
+ enqueueTaskImpl = nodeRequire.call(module, "timers").setImmediate;
+ } catch (_err) {
+ enqueueTaskImpl = function(callback) {
+ {
+ if (didWarnAboutMessageChannel === false) {
+ didWarnAboutMessageChannel = true;
+ if (typeof MessageChannel === "undefined") {
+ error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning.");
+ }
+ }
+ }
+ var channel = new MessageChannel();
+ channel.port1.onmessage = callback;
+ channel.port2.postMessage(void 0);
+ };
+ }
+ }
+ return enqueueTaskImpl(task);
+ }
+ var actScopeDepth = 0;
+ var didWarnNoAwaitAct = false;
+ function act(callback) {
+ {
+ var prevActScopeDepth = actScopeDepth;
+ actScopeDepth++;
+ if (ReactCurrentActQueue.current === null) {
+ ReactCurrentActQueue.current = [];
+ }
+ var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
+ var result;
+ try {
+ ReactCurrentActQueue.isBatchingLegacy = true;
+ result = callback();
+ if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
+ var queue = ReactCurrentActQueue.current;
+ if (queue !== null) {
+ ReactCurrentActQueue.didScheduleLegacyUpdate = false;
+ flushActQueue(queue);
+ }
+ }
+ } catch (error2) {
+ popActScope(prevActScopeDepth);
+ throw error2;
+ } finally {
+ ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
+ }
+ if (result !== null && typeof result === "object" && typeof result.then === "function") {
+ var thenableResult = result;
+ var wasAwaited = false;
+ var thenable = {
+ then: function(resolve, reject) {
+ wasAwaited = true;
+ thenableResult.then(function(returnValue2) {
+ popActScope(prevActScopeDepth);
+ if (actScopeDepth === 0) {
+ recursivelyFlushAsyncActWork(returnValue2, resolve, reject);
+ } else {
+ resolve(returnValue2);
+ }
+ }, function(error2) {
+ popActScope(prevActScopeDepth);
+ reject(error2);
+ });
+ }
+ };
+ {
+ if (!didWarnNoAwaitAct && typeof Promise !== "undefined") {
+ Promise.resolve().then(function() {
+ }).then(function() {
+ if (!wasAwaited) {
+ didWarnNoAwaitAct = true;
+ error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);");
+ }
+ });
+ }
+ }
+ return thenable;
+ } else {
+ var returnValue = result;
+ popActScope(prevActScopeDepth);
+ if (actScopeDepth === 0) {
+ var _queue = ReactCurrentActQueue.current;
+ if (_queue !== null) {
+ flushActQueue(_queue);
+ ReactCurrentActQueue.current = null;
+ }
+ var _thenable = {
+ then: function(resolve, reject) {
+ if (ReactCurrentActQueue.current === null) {
+ ReactCurrentActQueue.current = [];
+ recursivelyFlushAsyncActWork(returnValue, resolve, reject);
+ } else {
+ resolve(returnValue);
+ }
+ }
+ };
+ return _thenable;
+ } else {
+ var _thenable2 = {
+ then: function(resolve, reject) {
+ resolve(returnValue);
+ }
+ };
+ return _thenable2;
+ }
+ }
+ }
+ }
+ function popActScope(prevActScopeDepth) {
+ {
+ if (prevActScopeDepth !== actScopeDepth - 1) {
+ error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
+ }
+ actScopeDepth = prevActScopeDepth;
+ }
+ }
+ function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
+ {
+ var queue = ReactCurrentActQueue.current;
+ if (queue !== null) {
+ try {
+ flushActQueue(queue);
+ enqueueTask(function() {
+ if (queue.length === 0) {
+ ReactCurrentActQueue.current = null;
+ resolve(returnValue);
+ } else {
+ recursivelyFlushAsyncActWork(returnValue, resolve, reject);
+ }
+ });
+ } catch (error2) {
+ reject(error2);
+ }
+ } else {
+ resolve(returnValue);
+ }
+ }
+ }
+ var isFlushing = false;
+ function flushActQueue(queue) {
+ {
+ if (!isFlushing) {
+ isFlushing = true;
+ var i = 0;
+ try {
+ for (; i < queue.length; i++) {
+ var callback = queue[i];
+ do {
+ callback = callback(true);
+ } while (callback !== null);
+ }
+ queue.length = 0;
+ } catch (error2) {
+ queue = queue.slice(i + 1);
+ throw error2;
+ } finally {
+ isFlushing = false;
+ }
+ }
}
}
var createElement$1 = createElementWithValidation;
@@ -1695,7 +1857,11 @@
};
exports.Children = Children;
exports.Component = Component7;
+ exports.Fragment = REACT_FRAGMENT_TYPE;
+ exports.Profiler = REACT_PROFILER_TYPE;
exports.PureComponent = PureComponent;
+ exports.StrictMode = REACT_STRICT_MODE_TYPE;
+ exports.Suspense = REACT_SUSPENSE_TYPE;
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
exports.cloneElement = cloneElement$1;
exports.createContext = createContext2;
@@ -1706,17 +1872,27 @@
exports.isValidElement = isValidElement2;
exports.lazy = lazy;
exports.memo = memo;
+ exports.startTransition = startTransition;
+ exports.unstable_act = act;
exports.useCallback = useCallback2;
exports.useContext = useContext2;
exports.useDebugValue = useDebugValue;
+ exports.useDeferredValue = useDeferredValue;
exports.useEffect = useEffect6;
+ exports.useId = useId;
exports.useImperativeHandle = useImperativeHandle;
+ exports.useInsertionEffect = useInsertionEffect;
exports.useLayoutEffect = useLayoutEffect2;
exports.useMemo = useMemo4;
exports.useReducer = useReducer;
exports.useRef = useRef4;
exports.useState = useState4;
+ exports.useSyncExternalStore = useSyncExternalStore;
+ exports.useTransition = useTransition;
exports.version = ReactVersion;
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
+ }
})();
}
}
@@ -1741,170 +1917,38 @@
if (true) {
(function() {
"use strict";
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
+ }
var enableSchedulerDebugging = false;
var enableProfiling = false;
- var requestHostCallback;
- var requestHostTimeout;
- var cancelHostTimeout;
- var requestPaint;
- var hasPerformanceNow = typeof performance === "object" && typeof performance.now === "function";
- if (hasPerformanceNow) {
- var localPerformance = performance;
- exports.unstable_now = function() {
- return localPerformance.now();
- };
- } else {
- var localDate = Date;
- var initialTime = localDate.now();
- exports.unstable_now = function() {
- return localDate.now() - initialTime;
- };
- }
- if (
- // If Scheduler runs in a non-DOM environment, it falls back to a naive
- // implementation using setTimeout.
- typeof window === "undefined" || // Check if MessageChannel is supported, too.
- typeof MessageChannel !== "function"
- ) {
- var _callback = null;
- var _timeoutID = null;
- var _flushCallback = function() {
- if (_callback !== null) {
- try {
- var currentTime = exports.unstable_now();
- var hasRemainingTime = true;
- _callback(hasRemainingTime, currentTime);
- _callback = null;
- } catch (e) {
- setTimeout(_flushCallback, 0);
- throw e;
- }
- }
- };
- requestHostCallback = function(cb) {
- if (_callback !== null) {
- setTimeout(requestHostCallback, 0, cb);
- } else {
- _callback = cb;
- setTimeout(_flushCallback, 0);
- }
- };
- requestHostTimeout = function(cb, ms) {
- _timeoutID = setTimeout(cb, ms);
- };
- cancelHostTimeout = function() {
- clearTimeout(_timeoutID);
- };
- exports.unstable_shouldYield = function() {
- return false;
- };
- requestPaint = exports.unstable_forceFrameRate = function() {
- };
- } else {
- var _setTimeout = window.setTimeout;
- var _clearTimeout = window.clearTimeout;
- if (typeof console !== "undefined") {
- var requestAnimationFrame = window.requestAnimationFrame;
- var cancelAnimationFrame = window.cancelAnimationFrame;
- if (typeof requestAnimationFrame !== "function") {
- console["error"]("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");
- }
- if (typeof cancelAnimationFrame !== "function") {
- console["error"]("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");
- }
- }
- var isMessageLoopRunning = false;
- var scheduledHostCallback = null;
- var taskTimeoutID = -1;
- var yieldInterval = 5;
- var deadline = 0;
- {
- exports.unstable_shouldYield = function() {
- return exports.unstable_now() >= deadline;
- };
- requestPaint = function() {
- };
- }
- exports.unstable_forceFrameRate = function(fps) {
- if (fps < 0 || fps > 125) {
- console["error"]("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported");
- return;
- }
- if (fps > 0) {
- yieldInterval = Math.floor(1e3 / fps);
- } else {
- yieldInterval = 5;
- }
- };
- var performWorkUntilDeadline = function() {
- if (scheduledHostCallback !== null) {
- var currentTime = exports.unstable_now();
- deadline = currentTime + yieldInterval;
- var hasTimeRemaining = true;
- try {
- var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
- if (!hasMoreWork) {
- isMessageLoopRunning = false;
- scheduledHostCallback = null;
- } else {
- port.postMessage(null);
- }
- } catch (error) {
- port.postMessage(null);
- throw error;
- }
- } else {
- isMessageLoopRunning = false;
- }
- };
- var channel = new MessageChannel();
- var port = channel.port2;
- channel.port1.onmessage = performWorkUntilDeadline;
- requestHostCallback = function(callback) {
- scheduledHostCallback = callback;
- if (!isMessageLoopRunning) {
- isMessageLoopRunning = true;
- port.postMessage(null);
- }
- };
- requestHostTimeout = function(callback, ms) {
- taskTimeoutID = _setTimeout(function() {
- callback(exports.unstable_now());
- }, ms);
- };
- cancelHostTimeout = function() {
- _clearTimeout(taskTimeoutID);
- taskTimeoutID = -1;
- };
- }
+ var frameYieldMs = 5;
function push(heap, node) {
var index = heap.length;
heap.push(node);
siftUp(heap, node, index);
}
function peek(heap) {
- var first = heap[0];
- return first === void 0 ? null : first;
+ return heap.length === 0 ? null : heap[0];
}
function pop(heap) {
- var first = heap[0];
- if (first !== void 0) {
- var last = heap.pop();
- if (last !== first) {
- heap[0] = last;
- siftDown(heap, last, 0);
- }
- return first;
- } else {
+ if (heap.length === 0) {
return null;
}
+ var first = heap[0];
+ var last = heap.pop();
+ if (last !== first) {
+ heap[0] = last;
+ siftDown(heap, last, 0);
+ }
+ return first;
}
function siftUp(heap, node, i) {
var index = i;
- while (true) {
+ while (index > 0) {
var parentIndex = index - 1 >>> 1;
var parent = heap[parentIndex];
- if (parent !== void 0 && compare(parent, node) > 0) {
+ if (compare(parent, node) > 0) {
heap[parentIndex] = node;
heap[index] = parent;
index = parentIndex;
@@ -1916,13 +1960,14 @@
function siftDown(heap, node, i) {
var index = i;
var length = heap.length;
- while (index < length) {
+ var halfLength = length >>> 1;
+ while (index < halfLength) {
var leftIndex = (index + 1) * 2 - 1;
var left2 = heap[leftIndex];
var rightIndex = leftIndex + 1;
var right2 = heap[rightIndex];
- if (left2 !== void 0 && compare(left2, node) < 0) {
- if (right2 !== void 0 && compare(right2, left2) < 0) {
+ if (compare(left2, node) < 0) {
+ if (rightIndex < length && compare(right2, left2) < 0) {
heap[index] = right2;
heap[rightIndex] = node;
index = rightIndex;
@@ -1931,7 +1976,7 @@
heap[leftIndex] = node;
index = leftIndex;
}
- } else if (right2 !== void 0 && compare(right2, node) < 0) {
+ } else if (rightIndex < length && compare(right2, node) < 0) {
heap[index] = right2;
heap[rightIndex] = node;
index = rightIndex;
@@ -1951,6 +1996,19 @@
var IdlePriority = 5;
function markTaskErrored(task, ms) {
}
+ var hasPerformanceNow = typeof performance === "object" && typeof performance.now === "function";
+ if (hasPerformanceNow) {
+ var localPerformance = performance;
+ exports.unstable_now = function() {
+ return localPerformance.now();
+ };
+ } else {
+ var localDate = Date;
+ var initialTime = localDate.now();
+ exports.unstable_now = function() {
+ return localDate.now() - initialTime;
+ };
+ }
var maxSigned31BitInt = 1073741823;
var IMMEDIATE_PRIORITY_TIMEOUT = -1;
var USER_BLOCKING_PRIORITY_TIMEOUT = 250;
@@ -1965,6 +2023,10 @@
var isPerformingWork = false;
var isHostCallbackScheduled = false;
var isHostTimeoutScheduled = false;
+ var localSetTimeout = typeof setTimeout === "function" ? setTimeout : null;
+ var localClearTimeout = typeof clearTimeout === "function" ? clearTimeout : null;
+ var localSetImmediate = typeof setImmediate !== "undefined" ? setImmediate : null;
+ var isInputPending = typeof navigator !== "undefined" && navigator.scheduling !== void 0 && navigator.scheduling.isInputPending !== void 0 ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null;
function advanceTimers(currentTime) {
var timer = peek(timerQueue);
while (timer !== null) {
@@ -2029,7 +2091,7 @@
advanceTimers(currentTime);
currentTask = peek(taskQueue);
while (currentTask !== null && !enableSchedulerDebugging) {
- if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || exports.unstable_shouldYield())) {
+ if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
break;
}
var callback = currentTask.callback;
@@ -2115,16 +2177,16 @@
}
function unstable_scheduleCallback(priorityLevel, callback, options) {
var currentTime = exports.unstable_now();
- var startTime;
+ var startTime2;
if (typeof options === "object" && options !== null) {
var delay3 = options.delay;
if (typeof delay3 === "number" && delay3 > 0) {
- startTime = currentTime + delay3;
+ startTime2 = currentTime + delay3;
} else {
- startTime = currentTime;
+ startTime2 = currentTime;
}
} else {
- startTime = currentTime;
+ startTime2 = currentTime;
}
var timeout;
switch (priorityLevel) {
@@ -2145,17 +2207,17 @@
timeout = NORMAL_PRIORITY_TIMEOUT;
break;
}
- var expirationTime = startTime + timeout;
+ var expirationTime = startTime2 + timeout;
var newTask = {
id: taskIdCounter++,
callback,
priorityLevel,
- startTime,
+ startTime: startTime2,
expirationTime,
sortIndex: -1
};
- if (startTime > currentTime) {
- newTask.sortIndex = startTime;
+ if (startTime2 > currentTime) {
+ newTask.sortIndex = startTime2;
push(timerQueue, newTask);
if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
if (isHostTimeoutScheduled) {
@@ -2163,7 +2225,7 @@
} else {
isHostTimeoutScheduled = true;
}
- requestHostTimeout(handleTimeout, startTime - currentTime);
+ requestHostTimeout(handleTimeout, startTime2 - currentTime);
}
} else {
newTask.sortIndex = expirationTime;
@@ -2192,6 +2254,84 @@
function unstable_getCurrentPriorityLevel() {
return currentPriorityLevel;
}
+ var isMessageLoopRunning = false;
+ var scheduledHostCallback = null;
+ var taskTimeoutID = -1;
+ var frameInterval = frameYieldMs;
+ var startTime = -1;
+ function shouldYieldToHost() {
+ var timeElapsed = exports.unstable_now() - startTime;
+ if (timeElapsed < frameInterval) {
+ return false;
+ }
+ return true;
+ }
+ function requestPaint() {
+ }
+ function forceFrameRate(fps) {
+ if (fps < 0 || fps > 125) {
+ console["error"]("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported");
+ return;
+ }
+ if (fps > 0) {
+ frameInterval = Math.floor(1e3 / fps);
+ } else {
+ frameInterval = frameYieldMs;
+ }
+ }
+ var performWorkUntilDeadline = function() {
+ if (scheduledHostCallback !== null) {
+ var currentTime = exports.unstable_now();
+ startTime = currentTime;
+ var hasTimeRemaining = true;
+ var hasMoreWork = true;
+ try {
+ hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
+ } finally {
+ if (hasMoreWork) {
+ schedulePerformWorkUntilDeadline();
+ } else {
+ isMessageLoopRunning = false;
+ scheduledHostCallback = null;
+ }
+ }
+ } else {
+ isMessageLoopRunning = false;
+ }
+ };
+ var schedulePerformWorkUntilDeadline;
+ if (typeof localSetImmediate === "function") {
+ schedulePerformWorkUntilDeadline = function() {
+ localSetImmediate(performWorkUntilDeadline);
+ };
+ } else if (typeof MessageChannel !== "undefined") {
+ var channel = new MessageChannel();
+ var port = channel.port2;
+ channel.port1.onmessage = performWorkUntilDeadline;
+ schedulePerformWorkUntilDeadline = function() {
+ port.postMessage(null);
+ };
+ } else {
+ schedulePerformWorkUntilDeadline = function() {
+ localSetTimeout(performWorkUntilDeadline, 0);
+ };
+ }
+ function requestHostCallback(callback) {
+ scheduledHostCallback = callback;
+ if (!isMessageLoopRunning) {
+ isMessageLoopRunning = true;
+ schedulePerformWorkUntilDeadline();
+ }
+ }
+ function requestHostTimeout(callback, ms) {
+ taskTimeoutID = localSetTimeout(function() {
+ callback(exports.unstable_now());
+ }, ms);
+ }
+ function cancelHostTimeout() {
+ localClearTimeout(taskTimeoutID);
+ taskTimeoutID = -1;
+ }
var unstable_requestPaint = requestPaint;
var unstable_Profiling = null;
exports.unstable_IdlePriority = IdlePriority;
@@ -2202,6 +2342,7 @@
exports.unstable_UserBlockingPriority = UserBlockingPriority;
exports.unstable_cancelCallback = unstable_cancelCallback;
exports.unstable_continueExecution = unstable_continueExecution;
+ exports.unstable_forceFrameRate = forceFrameRate;
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
exports.unstable_next = unstable_next;
@@ -2209,7 +2350,11 @@
exports.unstable_requestPaint = unstable_requestPaint;
exports.unstable_runWithPriority = unstable_runWithPriority;
exports.unstable_scheduleCallback = unstable_scheduleCallback;
+ exports.unstable_shouldYield = shouldYieldToHost;
exports.unstable_wrapCallback = unstable_wrapCallback;
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
+ }
})();
}
}
@@ -2227,300 +2372,6 @@
}
});
- // node_modules/scheduler/cjs/scheduler-tracing.development.js
- var require_scheduler_tracing_development = __commonJS({
- "node_modules/scheduler/cjs/scheduler-tracing.development.js"(exports) {
- "use strict";
- if (true) {
- (function() {
- "use strict";
- var DEFAULT_THREAD_ID = 0;
- var interactionIDCounter = 0;
- var threadIDCounter = 0;
- exports.__interactionsRef = null;
- exports.__subscriberRef = null;
- {
- exports.__interactionsRef = {
- current: /* @__PURE__ */ new Set()
- };
- exports.__subscriberRef = {
- current: null
- };
- }
- function unstable_clear(callback) {
- var prevInteractions = exports.__interactionsRef.current;
- exports.__interactionsRef.current = /* @__PURE__ */ new Set();
- try {
- return callback();
- } finally {
- exports.__interactionsRef.current = prevInteractions;
- }
- }
- function unstable_getCurrent() {
- {
- return exports.__interactionsRef.current;
- }
- }
- function unstable_getThreadID() {
- return ++threadIDCounter;
- }
- function unstable_trace(name, timestamp, callback) {
- var threadID = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : DEFAULT_THREAD_ID;
- var interaction = {
- __count: 1,
- id: interactionIDCounter++,
- name,
- timestamp
- };
- var prevInteractions = exports.__interactionsRef.current;
- var interactions = new Set(prevInteractions);
- interactions.add(interaction);
- exports.__interactionsRef.current = interactions;
- var subscriber = exports.__subscriberRef.current;
- var returnValue;
- try {
- if (subscriber !== null) {
- subscriber.onInteractionTraced(interaction);
- }
- } finally {
- try {
- if (subscriber !== null) {
- subscriber.onWorkStarted(interactions, threadID);
- }
- } finally {
- try {
- returnValue = callback();
- } finally {
- exports.__interactionsRef.current = prevInteractions;
- try {
- if (subscriber !== null) {
- subscriber.onWorkStopped(interactions, threadID);
- }
- } finally {
- interaction.__count--;
- if (subscriber !== null && interaction.__count === 0) {
- subscriber.onInteractionScheduledWorkCompleted(interaction);
- }
- }
- }
- }
- }
- return returnValue;
- }
- function unstable_wrap(callback) {
- var threadID = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DEFAULT_THREAD_ID;
- var wrappedInteractions = exports.__interactionsRef.current;
- var subscriber = exports.__subscriberRef.current;
- if (subscriber !== null) {
- subscriber.onWorkScheduled(wrappedInteractions, threadID);
- }
- wrappedInteractions.forEach(function(interaction) {
- interaction.__count++;
- });
- var hasRun = false;
- function wrapped() {
- var prevInteractions = exports.__interactionsRef.current;
- exports.__interactionsRef.current = wrappedInteractions;
- subscriber = exports.__subscriberRef.current;
- try {
- var returnValue;
- try {
- if (subscriber !== null) {
- subscriber.onWorkStarted(wrappedInteractions, threadID);
- }
- } finally {
- try {
- returnValue = callback.apply(void 0, arguments);
- } finally {
- exports.__interactionsRef.current = prevInteractions;
- if (subscriber !== null) {
- subscriber.onWorkStopped(wrappedInteractions, threadID);
- }
- }
- }
- return returnValue;
- } finally {
- if (!hasRun) {
- hasRun = true;
- wrappedInteractions.forEach(function(interaction) {
- interaction.__count--;
- if (subscriber !== null && interaction.__count === 0) {
- subscriber.onInteractionScheduledWorkCompleted(interaction);
- }
- });
- }
- }
- }
- wrapped.cancel = function cancel() {
- subscriber = exports.__subscriberRef.current;
- try {
- if (subscriber !== null) {
- subscriber.onWorkCanceled(wrappedInteractions, threadID);
- }
- } finally {
- wrappedInteractions.forEach(function(interaction) {
- interaction.__count--;
- if (subscriber && interaction.__count === 0) {
- subscriber.onInteractionScheduledWorkCompleted(interaction);
- }
- });
- }
- };
- return wrapped;
- }
- var subscribers = null;
- {
- subscribers = /* @__PURE__ */ new Set();
- }
- function unstable_subscribe(subscriber) {
- {
- subscribers.add(subscriber);
- if (subscribers.size === 1) {
- exports.__subscriberRef.current = {
- onInteractionScheduledWorkCompleted,
- onInteractionTraced,
- onWorkCanceled,
- onWorkScheduled,
- onWorkStarted,
- onWorkStopped
- };
- }
- }
- }
- function unstable_unsubscribe(subscriber) {
- {
- subscribers.delete(subscriber);
- if (subscribers.size === 0) {
- exports.__subscriberRef.current = null;
- }
- }
- }
- function onInteractionTraced(interaction) {
- var didCatchError = false;
- var caughtError = null;
- subscribers.forEach(function(subscriber) {
- try {
- subscriber.onInteractionTraced(interaction);
- } catch (error) {
- if (!didCatchError) {
- didCatchError = true;
- caughtError = error;
- }
- }
- });
- if (didCatchError) {
- throw caughtError;
- }
- }
- function onInteractionScheduledWorkCompleted(interaction) {
- var didCatchError = false;
- var caughtError = null;
- subscribers.forEach(function(subscriber) {
- try {
- subscriber.onInteractionScheduledWorkCompleted(interaction);
- } catch (error) {
- if (!didCatchError) {
- didCatchError = true;
- caughtError = error;
- }
- }
- });
- if (didCatchError) {
- throw caughtError;
- }
- }
- function onWorkScheduled(interactions, threadID) {
- var didCatchError = false;
- var caughtError = null;
- subscribers.forEach(function(subscriber) {
- try {
- subscriber.onWorkScheduled(interactions, threadID);
- } catch (error) {
- if (!didCatchError) {
- didCatchError = true;
- caughtError = error;
- }
- }
- });
- if (didCatchError) {
- throw caughtError;
- }
- }
- function onWorkStarted(interactions, threadID) {
- var didCatchError = false;
- var caughtError = null;
- subscribers.forEach(function(subscriber) {
- try {
- subscriber.onWorkStarted(interactions, threadID);
- } catch (error) {
- if (!didCatchError) {
- didCatchError = true;
- caughtError = error;
- }
- }
- });
- if (didCatchError) {
- throw caughtError;
- }
- }
- function onWorkStopped(interactions, threadID) {
- var didCatchError = false;
- var caughtError = null;
- subscribers.forEach(function(subscriber) {
- try {
- subscriber.onWorkStopped(interactions, threadID);
- } catch (error) {
- if (!didCatchError) {
- didCatchError = true;
- caughtError = error;
- }
- }
- });
- if (didCatchError) {
- throw caughtError;
- }
- }
- function onWorkCanceled(interactions, threadID) {
- var didCatchError = false;
- var caughtError = null;
- subscribers.forEach(function(subscriber) {
- try {
- subscriber.onWorkCanceled(interactions, threadID);
- } catch (error) {
- if (!didCatchError) {
- didCatchError = true;
- caughtError = error;
- }
- }
- });
- if (didCatchError) {
- throw caughtError;
- }
- }
- exports.unstable_clear = unstable_clear;
- exports.unstable_getCurrent = unstable_getCurrent;
- exports.unstable_getThreadID = unstable_getThreadID;
- exports.unstable_subscribe = unstable_subscribe;
- exports.unstable_trace = unstable_trace;
- exports.unstable_unsubscribe = unstable_unsubscribe;
- exports.unstable_wrap = unstable_wrap;
- })();
- }
- }
- });
-
- // node_modules/scheduler/tracing.js
- var require_tracing = __commonJS({
- "node_modules/scheduler/tracing.js"(exports, module) {
- "use strict";
- if (false) {
- module.exports = null;
- } else {
- module.exports = require_scheduler_tracing_development();
- }
- }
- });
-
// node_modules/react-dom/cjs/react-dom.development.js
var require_react_dom_development = __commonJS({
"node_modules/react-dom/cjs/react-dom.development.js"(exports) {
@@ -2528,25 +2379,36 @@
if (true) {
(function() {
"use strict";
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
+ }
var React25 = require_react();
- var _assign = require_object_assign();
var Scheduler = require_scheduler();
- var tracing = require_tracing();
var ReactSharedInternals = React25.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+ var suppressWarning = false;
+ function setSuppressWarning(newSuppressWarning) {
+ {
+ suppressWarning = newSuppressWarning;
+ }
+ }
function warn(format2) {
{
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
+ if (!suppressWarning) {
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+ printWarning("warn", format2, args);
}
- printWarning("warn", format2, args);
}
}
function error(format2) {
{
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- args[_key2 - 1] = arguments[_key2];
+ if (!suppressWarning) {
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
+ args[_key2 - 1] = arguments[_key2];
+ }
+ printWarning("error", format2, args);
}
- printWarning("error", format2, args);
}
}
function printWarning(level, format2, args) {
@@ -2558,17 +2420,12 @@
args = args.concat([stack]);
}
var argsWithFormat = args.map(function(item) {
- return "" + item;
+ return String(item);
});
argsWithFormat.unshift("Warning: " + format2);
Function.prototype.apply.call(console[level], console, argsWithFormat);
}
}
- if (!React25) {
- {
- throw Error("ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.");
- }
- }
var FunctionComponent = 0;
var ClassComponent = 1;
var IndeterminateComponent = 2;
@@ -2589,15 +2446,22 @@
var IncompleteClassComponent = 17;
var DehydratedFragment = 18;
var SuspenseListComponent = 19;
- var FundamentalComponent = 20;
var ScopeComponent = 21;
- var Block = 22;
- var OffscreenComponent = 23;
- var LegacyHiddenComponent = 24;
- var enableProfilerTimer = true;
- var enableFundamentalAPI = false;
+ var OffscreenComponent = 22;
+ var LegacyHiddenComponent = 23;
+ var CacheComponent = 24;
+ var TracingMarkerComponent = 25;
+ var enableClientRenderFallbackOnTextMismatch = true;
var enableNewReconciler = false;
+ var enableLazyContextPropagation = false;
+ var enableLegacyHidden = false;
+ var enableSuspenseAvoidThisFallback = false;
+ var disableCommentsAsDOMContainers = true;
+ var enableCustomElementPropertySupport = false;
var warnAboutStringRefs = false;
+ var enableSchedulingProfiler = true;
+ var enableProfilerTimer = true;
+ var enableProfilerCommitHooks = true;
var allNativeEvents = /* @__PURE__ */ new Set();
var registrationNameDependencies = {};
var possibleRegistrationNames = {};
@@ -2624,6 +2488,75 @@
}
}
var canUseDOM2 = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
+ function typeName(value) {
+ {
+ var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
+ return type;
+ }
+ }
+ function willCoercionThrow(value) {
+ {
+ try {
+ testStringCoercion(value);
+ return false;
+ } catch (e) {
+ return true;
+ }
+ }
+ }
+ function testStringCoercion(value) {
+ return "" + value;
+ }
+ function checkAttributeStringCoercion(value, attributeName) {
+ {
+ if (willCoercionThrow(value)) {
+ error("The provided `%s` attribute is an unsupported type %s. This value must be coerced to a string before before using it here.", attributeName, typeName(value));
+ return testStringCoercion(value);
+ }
+ }
+ }
+ function checkKeyStringCoercion(value) {
+ {
+ if (willCoercionThrow(value)) {
+ error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
+ return testStringCoercion(value);
+ }
+ }
+ }
+ function checkPropStringCoercion(value, propName) {
+ {
+ if (willCoercionThrow(value)) {
+ error("The provided `%s` prop is an unsupported type %s. This value must be coerced to a string before before using it here.", propName, typeName(value));
+ return testStringCoercion(value);
+ }
+ }
+ }
+ function checkCSSPropertyStringCoercion(value, propName) {
+ {
+ if (willCoercionThrow(value)) {
+ error("The provided `%s` CSS property is an unsupported type %s. This value must be coerced to a string before before using it here.", propName, typeName(value));
+ return testStringCoercion(value);
+ }
+ }
+ }
+ function checkHtmlStringCoercion(value) {
+ {
+ if (willCoercionThrow(value)) {
+ error("The provided HTML markup uses a value of unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
+ return testStringCoercion(value);
+ }
+ }
+ }
+ function checkFormFieldValueStringCoercion(value) {
+ {
+ if (willCoercionThrow(value)) {
+ error("Form field values (value, checked, defaultValue, or defaultChecked props) must be strings, not %s. This value must be coerced to a string before before using it here.", typeName(value));
+ return testStringCoercion(value);
+ }
+ }
+ }
var RESERVED = 0;
var STRING = 1;
var BOOLEANISH_STRING = 2;
@@ -2633,9 +2566,7 @@
var POSITIVE_NUMERIC = 6;
var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
- var ROOT_ATTRIBUTE_NAME = "data-reactroot";
var VALID_ATTRIBUTE_NAME_REGEX = new RegExp("^[" + ATTRIBUTE_NAME_START_CHAR + "][" + ATTRIBUTE_NAME_CHAR + "]*$");
- var hasOwnProperty = Object.prototype.hasOwnProperty;
var illegalAttributeNameCache = {};
var validatedAttributeNameCache = {};
function isAttributeNameSafe(attributeName) {
@@ -3127,6 +3058,9 @@
var propertyName = propertyInfo.propertyName;
return node[propertyName];
} else {
+ {
+ checkAttributeStringCoercion(expected, name);
+ }
if (propertyInfo.sanitizeURL) {
sanitizeURL("" + expected);
}
@@ -3165,18 +3099,18 @@
}
}
}
- function getValueForAttribute(node, name, expected) {
+ function getValueForAttribute(node, name, expected, isCustomComponentTag) {
{
if (!isAttributeNameSafe(name)) {
return;
}
- if (isOpaqueHydratingObject(expected)) {
- return expected;
- }
if (!node.hasAttribute(name)) {
return expected === void 0 ? void 0 : null;
}
var value = node.getAttribute(name);
+ {
+ checkAttributeStringCoercion(expected, name);
+ }
if (value === "" + expected) {
return expected;
}
@@ -3197,6 +3131,9 @@
if (value === null) {
node.removeAttribute(_attributeName);
} else {
+ {
+ checkAttributeStringCoercion(value, name);
+ }
node.setAttribute(_attributeName, "" + value);
}
}
@@ -3223,6 +3160,9 @@
attributeValue = "";
} else {
{
+ {
+ checkAttributeStringCoercion(value, attributeName);
+ }
attributeValue = "" + value;
}
if (propertyInfo.sanitizeURL) {
@@ -3236,50 +3176,25 @@
}
}
}
- var REACT_ELEMENT_TYPE = 60103;
- var REACT_PORTAL_TYPE = 60106;
- var REACT_FRAGMENT_TYPE = 60107;
- var REACT_STRICT_MODE_TYPE = 60108;
- var REACT_PROFILER_TYPE = 60114;
- var REACT_PROVIDER_TYPE = 60109;
- var REACT_CONTEXT_TYPE = 60110;
- var REACT_FORWARD_REF_TYPE = 60112;
- var REACT_SUSPENSE_TYPE = 60113;
- var REACT_SUSPENSE_LIST_TYPE = 60120;
- var REACT_MEMO_TYPE = 60115;
- var REACT_LAZY_TYPE = 60116;
- var REACT_BLOCK_TYPE = 60121;
- var REACT_SERVER_BLOCK_TYPE = 60122;
- var REACT_FUNDAMENTAL_TYPE = 60117;
- var REACT_SCOPE_TYPE = 60119;
- var REACT_OPAQUE_ID_TYPE = 60128;
- var REACT_DEBUG_TRACING_MODE_TYPE = 60129;
- var REACT_OFFSCREEN_TYPE = 60130;
- var REACT_LEGACY_HIDDEN_TYPE = 60131;
- if (typeof Symbol === "function" && Symbol.for) {
- var symbolFor = Symbol.for;
- REACT_ELEMENT_TYPE = symbolFor("react.element");
- REACT_PORTAL_TYPE = symbolFor("react.portal");
- REACT_FRAGMENT_TYPE = symbolFor("react.fragment");
- REACT_STRICT_MODE_TYPE = symbolFor("react.strict_mode");
- REACT_PROFILER_TYPE = symbolFor("react.profiler");
- REACT_PROVIDER_TYPE = symbolFor("react.provider");
- REACT_CONTEXT_TYPE = symbolFor("react.context");
- REACT_FORWARD_REF_TYPE = symbolFor("react.forward_ref");
- REACT_SUSPENSE_TYPE = symbolFor("react.suspense");
- REACT_SUSPENSE_LIST_TYPE = symbolFor("react.suspense_list");
- REACT_MEMO_TYPE = symbolFor("react.memo");
- REACT_LAZY_TYPE = symbolFor("react.lazy");
- REACT_BLOCK_TYPE = symbolFor("react.block");
- REACT_SERVER_BLOCK_TYPE = symbolFor("react.server.block");
- REACT_FUNDAMENTAL_TYPE = symbolFor("react.fundamental");
- REACT_SCOPE_TYPE = symbolFor("react.scope");
- REACT_OPAQUE_ID_TYPE = symbolFor("react.opaque.id");
- REACT_DEBUG_TRACING_MODE_TYPE = symbolFor("react.debug_trace_mode");
- REACT_OFFSCREEN_TYPE = symbolFor("react.offscreen");
- REACT_LEGACY_HIDDEN_TYPE = symbolFor("react.legacy_hidden");
- }
- var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
+ var REACT_ELEMENT_TYPE = Symbol.for("react.element");
+ var REACT_PORTAL_TYPE = Symbol.for("react.portal");
+ var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
+ var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
+ var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
+ var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
+ var REACT_CONTEXT_TYPE = Symbol.for("react.context");
+ var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
+ var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
+ var REACT_MEMO_TYPE = Symbol.for("react.memo");
+ var REACT_LAZY_TYPE = Symbol.for("react.lazy");
+ var REACT_SCOPE_TYPE = Symbol.for("react.scope");
+ var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode");
+ var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
+ var REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden");
+ var REACT_CACHE_TYPE = Symbol.for("react.cache");
+ var REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker");
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = "@@iterator";
function getIteratorFn(maybeIterable) {
if (maybeIterable === null || typeof maybeIterable !== "object") {
@@ -3291,6 +3206,7 @@
}
return null;
}
+ var assign = Object.assign;
var disabledDepth = 0;
var prevLog;
var prevInfo;
@@ -3341,25 +3257,25 @@
writable: true
};
Object.defineProperties(console, {
- log: _assign({}, props, {
+ log: assign({}, props, {
value: prevLog
}),
- info: _assign({}, props, {
+ info: assign({}, props, {
value: prevInfo
}),
- warn: _assign({}, props, {
+ warn: assign({}, props, {
value: prevWarn
}),
- error: _assign({}, props, {
+ error: assign({}, props, {
value: prevError
}),
- group: _assign({}, props, {
+ group: assign({}, props, {
value: prevGroup
}),
- groupCollapsed: _assign({}, props, {
+ groupCollapsed: assign({}, props, {
value: prevGroupCollapsed
}),
- groupEnd: _assign({}, props, {
+ groupEnd: assign({}, props, {
value: prevGroupEnd
})
});
@@ -3460,6 +3376,9 @@
c--;
if (c < 0 || sampleLines[s] !== controlLines[c]) {
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
+ if (fn.displayName && _frame.includes("<anonymous>")) {
+ _frame = _frame.replace("<anonymous>", fn.displayName);
+ }
{
if (typeof fn === "function") {
componentFrameCache.set(fn, _frame);
@@ -3528,8 +3447,6 @@
return describeFunctionComponentFrame(type.render);
case REACT_MEMO_TYPE:
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
- case REACT_BLOCK_TYPE:
- return describeFunctionComponentFrame(type._render);
case REACT_LAZY_TYPE: {
var lazyComponent = type;
var payload = lazyComponent._payload;
@@ -3561,8 +3478,6 @@
return describeFunctionComponentFrame(fiber.type);
case ForwardRef:
return describeFunctionComponentFrame(fiber.type.render);
- case Block:
- return describeFunctionComponentFrame(fiber.type._render);
case ClassComponent:
return describeClassComponentFrame(fiber.type);
default:
@@ -3583,19 +3498,23 @@
}
}
function getWrappedName(outerType, innerType, wrapperName) {
+ var displayName = outerType.displayName;
+ if (displayName) {
+ return displayName;
+ }
var functionName = innerType.displayName || innerType.name || "";
- return outerType.displayName || (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName);
+ return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
}
function getContextName(type) {
return type.displayName || "Context";
}
- function getComponentName(type) {
+ function getComponentNameFromType(type) {
if (type == null) {
return null;
}
{
if (typeof type.tag === "number") {
- error("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue.");
+ error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
}
}
if (typeof type === "function") {
@@ -3629,15 +3548,17 @@
case REACT_FORWARD_REF_TYPE:
return getWrappedName(type, type.render, "ForwardRef");
case REACT_MEMO_TYPE:
- return getComponentName(type.type);
- case REACT_BLOCK_TYPE:
- return getComponentName(type._render);
+ var outerName = type.displayName || null;
+ if (outerName !== null) {
+ return outerName;
+ }
+ return getComponentNameFromType(type.type) || "Memo";
case REACT_LAZY_TYPE: {
var lazyComponent = type;
var payload = lazyComponent._payload;
var init = lazyComponent._init;
try {
- return getComponentName(init(payload));
+ return getComponentNameFromType(init(payload));
} catch (x) {
return null;
}
@@ -3646,6 +3567,73 @@
}
return null;
}
+ function getWrappedName$1(outerType, innerType, wrapperName) {
+ var functionName = innerType.displayName || innerType.name || "";
+ return outerType.displayName || (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName);
+ }
+ function getContextName$1(type) {
+ return type.displayName || "Context";
+ }
+ function getComponentNameFromFiber(fiber) {
+ var tag = fiber.tag, type = fiber.type;
+ switch (tag) {
+ case CacheComponent:
+ return "Cache";
+ case ContextConsumer:
+ var context = type;
+ return getContextName$1(context) + ".Consumer";
+ case ContextProvider:
+ var provider = type;
+ return getContextName$1(provider._context) + ".Provider";
+ case DehydratedFragment:
+ return "DehydratedFragment";
+ case ForwardRef:
+ return getWrappedName$1(type, type.render, "ForwardRef");
+ case Fragment4:
+ return "Fragment";
+ case HostComponent:
+ return type;
+ case HostPortal:
+ return "Portal";
+ case HostRoot:
+ return "Root";
+ case HostText:
+ return "Text";
+ case LazyComponent:
+ return getComponentNameFromType(type);
+ case Mode:
+ if (type === REACT_STRICT_MODE_TYPE) {
+ return "StrictMode";
+ }
+ return "Mode";
+ case OffscreenComponent:
+ return "Offscreen";
+ case Profiler:
+ return "Profiler";
+ case ScopeComponent:
+ return "Scope";
+ case SuspenseComponent:
+ return "Suspense";
+ case SuspenseListComponent:
+ return "SuspenseList";
+ case TracingMarkerComponent:
+ return "TracingMarker";
+ case ClassComponent:
+ case FunctionComponent:
+ case IncompleteClassComponent:
+ case IndeterminateComponent:
+ case MemoComponent:
+ case SimpleMemoComponent:
+ if (typeof type === "function") {
+ return type.displayName || type.name || null;
+ }
+ if (typeof type === "string") {
+ return type;
+ }
+ break;
+ }
+ return null;
+ }
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
var current = null;
var isRendering = false;
@@ -3656,7 +3644,7 @@
}
var owner = current._debugOwner;
if (owner !== null && typeof owner !== "undefined") {
- return getComponentName(owner.type);
+ return getComponentNameFromFiber(owner);
}
}
return null;
@@ -3678,19 +3666,19 @@
}
function setCurrentFiber(fiber) {
{
- ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev;
+ ReactDebugCurrentFrame.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev;
current = fiber;
isRendering = false;
}
}
- function setIsRendering(rendering) {
+ function getCurrentFiber() {
{
- isRendering = rendering;
+ return current;
}
}
- function getIsRendering() {
+ function setIsRendering(rendering) {
{
- return isRendering;
+ isRendering = rendering;
}
}
function toString(value) {
@@ -3700,10 +3688,14 @@
switch (typeof value) {
case "boolean":
case "number":
- case "object":
case "string":
case "undefined":
return value;
+ case "object":
+ {
+ checkFormFieldValueStringCoercion(value);
+ }
+ return value;
default:
return "";
}
@@ -3753,6 +3745,9 @@
function trackValueOnNode(node) {
var valueField = isCheckable(node) ? "checked" : "value";
var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
+ {
+ checkFormFieldValueStringCoercion(node[valueField]);
+ }
var currentValue = "" + node[valueField];
if (node.hasOwnProperty(valueField) || typeof descriptor === "undefined" || typeof descriptor.get !== "function" || typeof descriptor.set !== "function") {
return;
@@ -3764,6 +3759,9 @@
return get2.call(this);
},
set: function(value) {
+ {
+ checkFormFieldValueStringCoercion(value);
+ }
currentValue = "" + value;
set2.call(this, value);
}
@@ -3776,6 +3774,9 @@
return currentValue;
},
setValue: function(value) {
+ {
+ checkFormFieldValueStringCoercion(value);
+ }
currentValue = "" + value;
},
stopTracking: function() {
@@ -3829,7 +3830,7 @@
function getHostProps(element, props) {
var node = element;
var checked = props.checked;
- var hostProps = _assign({}, props, {
+ var hostProps = assign({}, props, {
defaultChecked: void 0,
defaultValue: void 0,
value: void 0,
@@ -3951,6 +3952,9 @@
while (queryRoot.parentNode) {
queryRoot = queryRoot.parentNode;
}
+ {
+ checkAttributeStringCoercion(name, "name");
+ }
var group = queryRoot.querySelectorAll("input[name=" + JSON.stringify("" + name) + '][type="radio"]');
for (var i = 0; i < group.length; i++) {
var otherNode = group[i];
@@ -3959,9 +3963,7 @@
}
var otherProps = getFiberCurrentPropsFromNode(otherNode);
if (!otherProps) {
- {
- throw Error("ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.");
- }
+ throw new Error("ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.");
}
updateValueIfChanged(otherNode);
updateWrapper(otherNode, otherProps);
@@ -3982,34 +3984,29 @@
}
var didWarnSelectedSetOnOption = false;
var didWarnInvalidChild = false;
- function flattenChildren(children) {
- var content = "";
- React25.Children.forEach(children, function(child) {
- if (child == null) {
- return;
- }
- content += child;
- });
- return content;
- }
+ var didWarnInvalidInnerHTML = false;
function validateProps(element, props) {
{
- if (typeof props.children === "object" && props.children !== null) {
- React25.Children.forEach(props.children, function(child) {
- if (child == null) {
- return;
- }
- if (typeof child === "string" || typeof child === "number") {
- return;
- }
- if (typeof child.type !== "string") {
- return;
- }
- if (!didWarnInvalidChild) {
- didWarnInvalidChild = true;
- error("Only strings and numbers are supported as <option> children.");
+ if (props.value == null) {
+ if (typeof props.children === "object" && props.children !== null) {
+ React25.Children.forEach(props.children, function(child) {
+ if (child == null) {
+ return;
+ }
+ if (typeof child === "string" || typeof child === "number") {
+ return;
+ }
+ if (!didWarnInvalidChild) {
+ didWarnInvalidChild = true;
+ error("Cannot infer the option value of complex children. Pass a `value` prop or use a plain string as children to <option>.");
+ }
+ });
+ } else if (props.dangerouslySetInnerHTML != null) {
+ if (!didWarnInvalidInnerHTML) {
+ didWarnInvalidInnerHTML = true;
+ error("Pass a `value` prop if you set dangerouslyInnerHTML so React knows which value should be selected.");
}
- });
+ }
}
if (props.selected != null && !didWarnSelectedSetOnOption) {
error("Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>.");
@@ -4022,15 +4019,9 @@
element.setAttribute("value", toString(getToStringValue(props.value)));
}
}
- function getHostProps$1(element, props) {
- var hostProps = _assign({
- children: void 0
- }, props);
- var content = flattenChildren(props.children);
- if (content) {
- hostProps.children = content;
- }
- return hostProps;
+ var isArrayImpl = Array.isArray;
+ function isArray(a) {
+ return isArrayImpl(a);
}
var didWarnValueDefaultValue$1;
{
@@ -4052,10 +4043,10 @@
if (props[propName] == null) {
continue;
}
- var isArray2 = Array.isArray(props[propName]);
- if (props.multiple && !isArray2) {
+ var propNameIsArray = isArray(props[propName]);
+ if (props.multiple && !propNameIsArray) {
error("The `%s` prop supplied to <select> must be an array if `multiple` is true.%s", propName, getDeclarationErrorAddendum());
- } else if (!props.multiple && isArray2) {
+ } else if (!props.multiple && propNameIsArray) {
error("The `%s` prop supplied to <select> must be a scalar value if `multiple` is false.%s", propName, getDeclarationErrorAddendum());
}
}
@@ -4098,8 +4089,8 @@
}
}
}
- function getHostProps$2(element, props) {
- return _assign({}, props, {
+ function getHostProps$1(element, props) {
+ return assign({}, props, {
value: void 0
});
}
@@ -4151,14 +4142,12 @@
}
}
var didWarnValDefaultVal = false;
- function getHostProps$3(element, props) {
+ function getHostProps$2(element, props) {
var node = element;
- if (!(props.dangerouslySetInnerHTML == null)) {
- {
- throw Error("`dangerouslySetInnerHTML` does not make sense on <textarea>.");
- }
+ if (props.dangerouslySetInnerHTML != null) {
+ throw new Error("`dangerouslySetInnerHTML` does not make sense on <textarea>.");
}
- var hostProps = _assign({}, props, {
+ var hostProps = assign({}, props, {
value: void 0,
defaultValue: void 0,
children: toString(node._wrapperState.initialValue)
@@ -4182,16 +4171,12 @@
error("Use the `defaultValue` or `value` props instead of setting children on <textarea>.");
}
{
- if (!(defaultValue == null)) {
- {
- throw Error("If you supply `defaultValue` on a <textarea>, do not pass children.");
- }
+ if (defaultValue != null) {
+ throw new Error("If you supply `defaultValue` on a <textarea>, do not pass children.");
}
- if (Array.isArray(children)) {
- if (!(children.length <= 1)) {
- {
- throw Error("<textarea> can only have at most one child.");
- }
+ if (isArray(children)) {
+ if (children.length > 1) {
+ throw new Error("<textarea> can only have at most one child.");
}
children = children[0];
}
@@ -4239,11 +4224,6 @@
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
var MATH_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
- var Namespaces = {
- html: HTML_NAMESPACE,
- mathml: MATH_NAMESPACE,
- svg: SVG_NAMESPACE
- };
function getIntrinsicNamespace(type) {
switch (type) {
case "svg":
@@ -4276,7 +4256,7 @@
};
var reusableSVGContainer;
var setInnerHTML = createMicrosoftUnsafeLocalFunction(function(node, html) {
- if (node.namespaceURI === Namespaces.svg) {
+ if (node.namespaceURI === SVG_NAMESPACE) {
if (!("innerHTML" in node)) {
reusableSVGContainer = reusableSVGContainer || document.createElement("div");
reusableSVGContainer.innerHTML = "<svg>" + html.valueOf().toString() + "</svg>";
@@ -4358,6 +4338,7 @@
};
var isUnitlessNumber = {
animationIterationCount: true,
+ aspectRatio: true,
borderImageOutset: true,
borderImageSlice: true,
borderImageWidth: true,
@@ -4418,6 +4399,9 @@
if (!isCustomProperty && typeof value === "number" && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
return value + "px";
}
+ {
+ checkCSSPropertyStringCoercion(value, name);
+ }
return ("" + value).trim();
}
var uppercasePattern = /([A-Z])/g;
@@ -4596,7 +4580,7 @@
wbr: true
// NOTE: menuitem's close tag should be omitted, but that causes problems.
};
- var voidElementTags = _assign({
+ var voidElementTags = assign({
menuitem: true
}, omittedCloseTags);
var HTML = "__html";
@@ -4605,22 +4589,16 @@
return;
}
if (voidElementTags[tag]) {
- if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
- {
- throw Error(tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.");
- }
+ if (props.children != null || props.dangerouslySetInnerHTML != null) {
+ throw new Error(tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.");
}
}
if (props.dangerouslySetInnerHTML != null) {
- if (!(props.children == null)) {
- {
- throw Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
- }
+ if (props.children != null) {
+ throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
}
- if (!(typeof props.dangerouslySetInnerHTML === "object" && HTML in props.dangerouslySetInnerHTML)) {
- {
- throw Error("`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://reactjs.org/link/dangerously-set-inner-html for more information.");
- }
+ if (typeof props.dangerouslySetInnerHTML !== "object" || !(HTML in props.dangerouslySetInnerHTML)) {
+ throw new Error("`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://reactjs.org/link/dangerously-set-inner-html for more information.");
}
}
{
@@ -4628,10 +4606,8 @@
error("A component is `contentEditable` and contains `children` managed by React. It is now your responsibility to guarantee that none of those nodes are unexpectedly modified or duplicated. This is probably not intentional.");
}
}
- if (!(props.style == null || typeof props.style === "object")) {
- {
- throw Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");
- }
+ if (props.style != null && typeof props.style !== "object") {
+ throw new Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");
}
}
function isCustomComponent(tagName, props) {
@@ -4723,6 +4699,8 @@
"http-equiv": "httpEquiv",
icon: "icon",
id: "id",
+ imagesizes: "imageSizes",
+ imagesrcset: "imageSrcSet",
innerhtml: "innerHTML",
inputmode: "inputMode",
integrity: "integrity",
@@ -5142,6 +5120,7 @@
var ariaProperties = {
"aria-current": 0,
// state
+ "aria-description": 0,
"aria-details": 0,
"aria-disabled": 0,
// state
@@ -5200,10 +5179,9 @@
var warnedProperties = {};
var rARIA = new RegExp("^(aria)-[" + ATTRIBUTE_NAME_CHAR + "]*$");
var rARIACamel = new RegExp("^(aria)[A-Z][" + ATTRIBUTE_NAME_CHAR + "]*$");
- var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
function validateProperty(tagName, name) {
{
- if (hasOwnProperty$1.call(warnedProperties, name) && warnedProperties[name]) {
+ if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
return true;
}
if (rARIACamel.test(name)) {
@@ -5281,13 +5259,12 @@
};
{
var warnedProperties$1 = {};
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
var EVENT_NAME_REGEX = /^on./;
var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
var rARIA$1 = new RegExp("^(aria)-[" + ATTRIBUTE_NAME_CHAR + "]*$");
var rARIACamel$1 = new RegExp("^(aria)[A-Z][" + ATTRIBUTE_NAME_CHAR + "]*$");
validateProperty$1 = function(tagName, name, value, eventRegistry) {
- if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
+ if (hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
return true;
}
var lowerCasedName = name.toLowerCase();
@@ -5408,8 +5385,27 @@
var IS_EVENT_HANDLE_NON_MANAGED_NODE = 1;
var IS_NON_DELEGATED = 1 << 1;
var IS_CAPTURE_PHASE = 1 << 2;
- var IS_REPLAYED = 1 << 4;
var SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS = IS_EVENT_HANDLE_NON_MANAGED_NODE | IS_NON_DELEGATED | IS_CAPTURE_PHASE;
+ var currentReplayingEvent = null;
+ function setReplayingEvent(event) {
+ {
+ if (currentReplayingEvent !== null) {
+ error("Expected currently replaying event to be null. This error is likely caused by a bug in React. Please file an issue.");
+ }
+ }
+ currentReplayingEvent = event;
+ }
+ function resetReplayingEvent() {
+ {
+ if (currentReplayingEvent === null) {
+ error("Expected currently replaying event to not be null. This error is likely caused by a bug in React. Please file an issue.");
+ }
+ }
+ currentReplayingEvent = null;
+ }
+ function isReplayingEvent(event) {
+ return event === currentReplayingEvent;
+ }
function getEventTarget(nativeEvent) {
var target = nativeEvent.target || nativeEvent.srcElement || window;
if (target.correspondingUseElement) {
@@ -5425,10 +5421,8 @@
if (!internalInstance) {
return;
}
- if (!(typeof restoreImpl === "function")) {
- {
- throw Error("setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.");
- }
+ if (typeof restoreImpl !== "function") {
+ throw new Error("setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.");
}
var stateNode = internalInstance.stateNode;
if (stateNode) {
@@ -5471,69 +5465,31 @@
var batchedUpdatesImpl = function(fn, bookkeeping) {
return fn(bookkeeping);
};
- var discreteUpdatesImpl = function(fn, a, b, c, d) {
- return fn(a, b, c, d);
+ var flushSyncImpl = function() {
};
- var flushDiscreteUpdatesImpl = function() {
- };
- var batchedEventUpdatesImpl = batchedUpdatesImpl;
var isInsideEventHandler = false;
- var isBatchingEventUpdates = false;
function finishEventHandler() {
var controlledComponentsHavePendingUpdates = needsStateRestore();
if (controlledComponentsHavePendingUpdates) {
- flushDiscreteUpdatesImpl();
+ flushSyncImpl();
restoreStateIfNeeded();
}
}
- function batchedUpdates(fn, bookkeeping) {
+ function batchedUpdates(fn, a, b) {
if (isInsideEventHandler) {
- return fn(bookkeeping);
+ return fn(a, b);
}
isInsideEventHandler = true;
try {
- return batchedUpdatesImpl(fn, bookkeeping);
+ return batchedUpdatesImpl(fn, a, b);
} finally {
isInsideEventHandler = false;
finishEventHandler();
}
}
- function batchedEventUpdates(fn, a, b) {
- if (isBatchingEventUpdates) {
- return fn(a, b);
- }
- isBatchingEventUpdates = true;
- try {
- return batchedEventUpdatesImpl(fn, a, b);
- } finally {
- isBatchingEventUpdates = false;
- finishEventHandler();
- }
- }
- function discreteUpdates(fn, a, b, c, d) {
- var prevIsInsideEventHandler = isInsideEventHandler;
- isInsideEventHandler = true;
- try {
- return discreteUpdatesImpl(fn, a, b, c, d);
- } finally {
- isInsideEventHandler = prevIsInsideEventHandler;
- if (!isInsideEventHandler) {
- finishEventHandler();
- }
- }
- }
- function flushDiscreteUpdatesIfNeeded(timeStamp) {
- {
- if (!isInsideEventHandler) {
- flushDiscreteUpdatesImpl();
- }
- }
- }
- function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl) {
+ function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushSyncImpl) {
batchedUpdatesImpl = _batchedUpdatesImpl;
- discreteUpdatesImpl = _discreteUpdatesImpl;
- flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl;
- batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
+ flushSyncImpl = _flushSyncImpl;
}
function isInteractive(tag) {
return tag === "button" || tag === "input" || tag === "select" || tag === "textarea";
@@ -5569,10 +5525,8 @@
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
return null;
}
- if (!(!listener || typeof listener === "function")) {
- {
- throw Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type.");
- }
+ if (listener && typeof listener !== "function") {
+ throw new Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type.");
}
return listener;
}
@@ -5604,10 +5558,8 @@
if (typeof window !== "undefined" && typeof window.dispatchEvent === "function" && typeof document !== "undefined" && typeof document.createEvent === "function") {
var fakeNode = document.createElement("react");
invokeGuardedCallbackImpl = function invokeGuardedCallbackDev(name, func, context, a, b, c, d, e, f) {
- if (!(typeof document !== "undefined")) {
- {
- throw Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.");
- }
+ if (typeof document === "undefined" || document === null) {
+ throw new Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.");
}
var evt = document.createEvent("Event");
var didCall = false;
@@ -5713,11 +5665,7 @@
caughtError = null;
return error2;
} else {
- {
- {
- throw Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
- }
- }
+ throw new Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
}
}
function get(key) {
@@ -5745,70 +5693,100 @@
/* */
4
);
- var PlacementAndUpdate = (
- /* */
- 6
- );
- var Deletion = (
- /* */
- 8
+ var ChildDeletion = (
+ /* */
+ 16
);
var ContentReset = (
/* */
- 16
+ 32
);
var Callback = (
/* */
- 32
+ 64
);
var DidCapture = (
/* */
- 64
+ 128
+ );
+ var ForceClientRender = (
+ /* */
+ 256
);
var Ref = (
/* */
- 128
+ 512
);
var Snapshot = (
/* */
- 256
+ 1024
);
var Passive = (
/* */
- 512
- );
- var PassiveUnmountPendingDev = (
- /* */
- 8192
+ 2048
);
var Hydrating = (
/* */
- 1024
+ 4096
);
- var HydratingAndUpdate = (
- /* */
- 1028
+ var Visibility = (
+ /* */
+ 8192
);
- var LifecycleEffectMask = (
- /* */
- 932
+ var StoreConsistency = (
+ /* */
+ 16384
);
+ var LifecycleEffectMask = Passive | Update | Callback | Ref | Snapshot | StoreConsistency;
var HostEffectMask = (
/* */
- 2047
+ 32767
);
var Incomplete = (
/* */
- 2048
+ 32768
);
var ShouldCapture = (
/* */
- 4096
+ 65536
);
var ForceUpdateForLegacySuspense = (
/* */
- 16384
+ 131072
+ );
+ var Forked = (
+ /* */
+ 1048576
+ );
+ var RefStatic = (
+ /* */
+ 2097152
);
+ var LayoutStatic = (
+ /* */
+ 4194304
+ );
+ var PassiveStatic = (
+ /* */
+ 8388608
+ );
+ var MountLayoutDev = (
+ /* */
+ 16777216
+ );
+ var MountPassiveDev = (
+ /* */
+ 33554432
+ );
+ var BeforeMutationMask = (
+ // TODO: Remove Update flag from before mutation phase by re-landing Visibility
+ // flag logic (see #20043)
+ Update | Snapshot | 0
+ );
+ var MutationMask = Placement | Update | ChildDeletion | ContentReset | Ref | Hydrating | Visibility;
+ var LayoutMask = Update | Callback | Ref | Visibility;
+ var PassiveMask = Passive | ChildDeletion;
+ var StaticMask = LayoutStatic | PassiveStatic | RefStatic;
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
function getNearestMountedFiber(fiber) {
var node = fiber;
@@ -5860,7 +5838,7 @@
var ownerFiber = owner;
var instance = ownerFiber.stateNode;
if (!instance._warnedAboutRefsInRender) {
- error("%s is accessing isMounted inside its render() function. render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.", getComponentName(ownerFiber.type) || "A component");
+ error("%s is accessing isMounted inside its render() function. render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.", getComponentNameFromFiber(ownerFiber) || "A component");
}
instance._warnedAboutRefsInRender = true;
}
@@ -5872,20 +5850,16 @@
return getNearestMountedFiber(fiber) === fiber;
}
function assertIsMounted(fiber) {
- if (!(getNearestMountedFiber(fiber) === fiber)) {
- {
- throw Error("Unable to find node on an unmounted component.");
- }
+ if (getNearestMountedFiber(fiber) !== fiber) {
+ throw new Error("Unable to find node on an unmounted component.");
}
}
function findCurrentFiberUsingSlowPath(fiber) {
var alternate = fiber.alternate;
if (!alternate) {
var nearestMounted = getNearestMountedFiber(fiber);
- if (!(nearestMounted !== null)) {
- {
- throw Error("Unable to find node on an unmounted component.");
- }
+ if (nearestMounted === null) {
+ throw new Error("Unable to find node on an unmounted component.");
}
if (nearestMounted !== fiber) {
return null;
@@ -5921,11 +5895,7 @@
}
child = child.sibling;
}
- {
- {
- throw Error("Unable to find node on an unmounted component.");
- }
- }
+ throw new Error("Unable to find node on an unmounted component.");
}
if (a.return !== b.return) {
a = parentA;
@@ -5966,22 +5936,16 @@
_child = _child.sibling;
}
if (!didFindChild) {
- {
- throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.");
- }
+ throw new Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.");
}
}
}
- if (!(a.alternate === b)) {
- {
- throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.");
- }
+ if (a.alternate !== b) {
+ throw new Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.");
}
}
- if (!(a.tag === HostRoot)) {
- {
- throw Error("Unable to find node on an unmounted component.");
- }
+ if (a.tag !== HostRoot) {
+ throw new Error("Unable to find node on an unmounted component.");
}
if (a.stateNode.current === a) {
return fiber;
@@ -5990,546 +5954,406 @@
}
function findCurrentHostFiber(parent) {
var currentParent = findCurrentFiberUsingSlowPath(parent);
- if (!currentParent) {
- return null;
+ return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null;
+ }
+ function findCurrentHostFiberImpl(node) {
+ if (node.tag === HostComponent || node.tag === HostText) {
+ return node;
}
- var node = currentParent;
- while (true) {
- if (node.tag === HostComponent || node.tag === HostText) {
- return node;
- } else if (node.child) {
- node.child.return = node;
- node = node.child;
- continue;
- }
- if (node === currentParent) {
- return null;
- }
- while (!node.sibling) {
- if (!node.return || node.return === currentParent) {
- return null;
- }
- node = node.return;
+ var child = node.child;
+ while (child !== null) {
+ var match = findCurrentHostFiberImpl(child);
+ if (match !== null) {
+ return match;
}
- node.sibling.return = node.return;
- node = node.sibling;
+ child = child.sibling;
}
return null;
}
function findCurrentHostFiberWithNoPortals(parent) {
var currentParent = findCurrentFiberUsingSlowPath(parent);
- if (!currentParent) {
- return null;
+ return currentParent !== null ? findCurrentHostFiberWithNoPortalsImpl(currentParent) : null;
+ }
+ function findCurrentHostFiberWithNoPortalsImpl(node) {
+ if (node.tag === HostComponent || node.tag === HostText) {
+ return node;
}
- var node = currentParent;
- while (true) {
- if (node.tag === HostComponent || node.tag === HostText || enableFundamentalAPI) {
- return node;
- } else if (node.child && node.tag !== HostPortal) {
- node.child.return = node;
- node = node.child;
- continue;
- }
- if (node === currentParent) {
- return null;
- }
- while (!node.sibling) {
- if (!node.return || node.return === currentParent) {
- return null;
+ var child = node.child;
+ while (child !== null) {
+ if (child.tag !== HostPortal) {
+ var match = findCurrentHostFiberWithNoPortalsImpl(child);
+ if (match !== null) {
+ return match;
}
- node = node.return;
}
- node.sibling.return = node.return;
- node = node.sibling;
+ child = child.sibling;
}
return null;
}
- function doesFiberContain(parentFiber, childFiber) {
- var node = childFiber;
- var parentFiberAlternate = parentFiber.alternate;
- while (node !== null) {
- if (node === parentFiber || node === parentFiberAlternate) {
- return true;
+ var scheduleCallback = Scheduler.unstable_scheduleCallback;
+ var cancelCallback = Scheduler.unstable_cancelCallback;
+ var shouldYield = Scheduler.unstable_shouldYield;
+ var requestPaint = Scheduler.unstable_requestPaint;
+ var now = Scheduler.unstable_now;
+ var getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel;
+ var ImmediatePriority = Scheduler.unstable_ImmediatePriority;
+ var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority;
+ var NormalPriority = Scheduler.unstable_NormalPriority;
+ var LowPriority = Scheduler.unstable_LowPriority;
+ var IdlePriority = Scheduler.unstable_IdlePriority;
+ var unstable_yieldValue = Scheduler.unstable_yieldValue;
+ var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue;
+ var rendererID = null;
+ var injectedHook = null;
+ var injectedProfilingHooks = null;
+ var hasLoggedError = false;
+ var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined";
+ function injectInternals(internals) {
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined") {
+ return false;
+ }
+ var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
+ if (hook.isDisabled) {
+ return true;
+ }
+ if (!hook.supportsFiber) {
+ {
+ error("The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://reactjs.org/link/react-devtools");
}
- node = node.return;
+ return true;
}
- return false;
- }
- var attemptUserBlockingHydration;
- function setAttemptUserBlockingHydration(fn) {
- attemptUserBlockingHydration = fn;
- }
- var attemptContinuousHydration;
- function setAttemptContinuousHydration(fn) {
- attemptContinuousHydration = fn;
- }
- var attemptHydrationAtCurrentPriority;
- function setAttemptHydrationAtCurrentPriority(fn) {
- attemptHydrationAtCurrentPriority = fn;
- }
- var attemptHydrationAtPriority;
- function setAttemptHydrationAtPriority(fn) {
- attemptHydrationAtPriority = fn;
- }
- var hasScheduledReplayAttempt = false;
- var queuedDiscreteEvents = [];
- var queuedFocus = null;
- var queuedDrag = null;
- var queuedMouse = null;
- var queuedPointers = /* @__PURE__ */ new Map();
- var queuedPointerCaptures = /* @__PURE__ */ new Map();
- var queuedExplicitHydrationTargets = [];
- function hasQueuedDiscreteEvents() {
- return queuedDiscreteEvents.length > 0;
- }
- var discreteReplayableEvents = [
- "mousedown",
- "mouseup",
- "touchcancel",
- "touchend",
- "touchstart",
- "auxclick",
- "dblclick",
- "pointercancel",
- "pointerdown",
- "pointerup",
- "dragend",
- "dragstart",
- "drop",
- "compositionend",
- "compositionstart",
- "keydown",
- "keypress",
- "keyup",
- "input",
- "textInput",
- // Intentionally camelCase
- "copy",
- "cut",
- "paste",
- "click",
- "change",
- "contextmenu",
- "reset",
- "submit"
- ];
- function isReplayableDiscreteEvent(eventType) {
- return discreteReplayableEvents.indexOf(eventType) > -1;
- }
- function createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
- return {
- blockedOn,
- domEventName,
- eventSystemFlags: eventSystemFlags | IS_REPLAYED,
- nativeEvent,
- targetContainers: [targetContainer]
- };
- }
- function queueDiscreteEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
- var queuedEvent = createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent);
- queuedDiscreteEvents.push(queuedEvent);
- }
- function clearIfContinuousEvent(domEventName, nativeEvent) {
- switch (domEventName) {
- case "focusin":
- case "focusout":
- queuedFocus = null;
- break;
- case "dragenter":
- case "dragleave":
- queuedDrag = null;
- break;
- case "mouseover":
- case "mouseout":
- queuedMouse = null;
- break;
- case "pointerover":
- case "pointerout": {
- var pointerId = nativeEvent.pointerId;
- queuedPointers.delete(pointerId);
- break;
+ try {
+ if (enableSchedulingProfiler) {
+ internals = assign({}, internals, {
+ getLaneLabelMap,
+ injectProfilingHooks
+ });
}
- case "gotpointercapture":
- case "lostpointercapture": {
- var _pointerId = nativeEvent.pointerId;
- queuedPointerCaptures.delete(_pointerId);
- break;
+ rendererID = hook.inject(internals);
+ injectedHook = hook;
+ } catch (err) {
+ {
+ error("React instrumentation encountered an error: %s.", err);
}
}
+ if (hook.checkDCE) {
+ return true;
+ } else {
+ return false;
+ }
}
- function accumulateOrCreateContinuousQueuedReplayableEvent(existingQueuedEvent, blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
- if (existingQueuedEvent === null || existingQueuedEvent.nativeEvent !== nativeEvent) {
- var queuedEvent = createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent);
- if (blockedOn !== null) {
- var _fiber2 = getInstanceFromNode(blockedOn);
- if (_fiber2 !== null) {
- attemptContinuousHydration(_fiber2);
+ function onScheduleRoot(root2, children) {
+ {
+ if (injectedHook && typeof injectedHook.onScheduleFiberRoot === "function") {
+ try {
+ injectedHook.onScheduleFiberRoot(rendererID, root2, children);
+ } catch (err) {
+ if (!hasLoggedError) {
+ hasLoggedError = true;
+ error("React instrumentation encountered an error: %s", err);
+ }
}
}
- return queuedEvent;
- }
- existingQueuedEvent.eventSystemFlags |= eventSystemFlags;
- var targetContainers = existingQueuedEvent.targetContainers;
- if (targetContainer !== null && targetContainers.indexOf(targetContainer) === -1) {
- targetContainers.push(targetContainer);
}
- return existingQueuedEvent;
}
- function queueIfContinuousEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
- switch (domEventName) {
- case "focusin": {
- var focusEvent = nativeEvent;
- queuedFocus = accumulateOrCreateContinuousQueuedReplayableEvent(queuedFocus, blockedOn, domEventName, eventSystemFlags, targetContainer, focusEvent);
- return true;
- }
- case "dragenter": {
- var dragEvent = nativeEvent;
- queuedDrag = accumulateOrCreateContinuousQueuedReplayableEvent(queuedDrag, blockedOn, domEventName, eventSystemFlags, targetContainer, dragEvent);
- return true;
- }
- case "mouseover": {
- var mouseEvent = nativeEvent;
- queuedMouse = accumulateOrCreateContinuousQueuedReplayableEvent(queuedMouse, blockedOn, domEventName, eventSystemFlags, targetContainer, mouseEvent);
- return true;
- }
- case "pointerover": {
- var pointerEvent = nativeEvent;
- var pointerId = pointerEvent.pointerId;
- queuedPointers.set(pointerId, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointers.get(pointerId) || null, blockedOn, domEventName, eventSystemFlags, targetContainer, pointerEvent));
- return true;
+ function onCommitRoot(root2, eventPriority) {
+ if (injectedHook && typeof injectedHook.onCommitFiberRoot === "function") {
+ try {
+ var didError = (root2.current.flags & DidCapture) === DidCapture;
+ if (enableProfilerTimer) {
+ var schedulerPriority;
+ switch (eventPriority) {
+ case DiscreteEventPriority:
+ schedulerPriority = ImmediatePriority;
+ break;
+ case ContinuousEventPriority:
+ schedulerPriority = UserBlockingPriority;
+ break;
+ case DefaultEventPriority:
+ schedulerPriority = NormalPriority;
+ break;
+ case IdleEventPriority:
+ schedulerPriority = IdlePriority;
+ break;
+ default:
+ schedulerPriority = NormalPriority;
+ break;
+ }
+ injectedHook.onCommitFiberRoot(rendererID, root2, schedulerPriority, didError);
+ } else {
+ injectedHook.onCommitFiberRoot(rendererID, root2, void 0, didError);
+ }
+ } catch (err) {
+ {
+ if (!hasLoggedError) {
+ hasLoggedError = true;
+ error("React instrumentation encountered an error: %s", err);
+ }
+ }
}
- case "gotpointercapture": {
- var _pointerEvent = nativeEvent;
- var _pointerId2 = _pointerEvent.pointerId;
- queuedPointerCaptures.set(_pointerId2, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointerCaptures.get(_pointerId2) || null, blockedOn, domEventName, eventSystemFlags, targetContainer, _pointerEvent));
- return true;
+ }
+ }
+ function onPostCommitRoot(root2) {
+ if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === "function") {
+ try {
+ injectedHook.onPostCommitFiberRoot(rendererID, root2);
+ } catch (err) {
+ {
+ if (!hasLoggedError) {
+ hasLoggedError = true;
+ error("React instrumentation encountered an error: %s", err);
+ }
+ }
}
}
- return false;
}
- function attemptExplicitHydrationTarget(queuedTarget) {
- var targetInst = getClosestInstanceFromNode(queuedTarget.target);
- if (targetInst !== null) {
- var nearestMounted = getNearestMountedFiber(targetInst);
- if (nearestMounted !== null) {
- var tag = nearestMounted.tag;
- if (tag === SuspenseComponent) {
- var instance = getSuspenseInstanceFromFiber(nearestMounted);
- if (instance !== null) {
- queuedTarget.blockedOn = instance;
- attemptHydrationAtPriority(queuedTarget.lanePriority, function() {
- Scheduler.unstable_runWithPriority(queuedTarget.priority, function() {
- attemptHydrationAtCurrentPriority(nearestMounted);
- });
- });
- return;
+ function onCommitUnmount(fiber) {
+ if (injectedHook && typeof injectedHook.onCommitFiberUnmount === "function") {
+ try {
+ injectedHook.onCommitFiberUnmount(rendererID, fiber);
+ } catch (err) {
+ {
+ if (!hasLoggedError) {
+ hasLoggedError = true;
+ error("React instrumentation encountered an error: %s", err);
}
- } else if (tag === HostRoot) {
- var root2 = nearestMounted.stateNode;
- if (root2.hydrate) {
- queuedTarget.blockedOn = getContainerFromFiber(nearestMounted);
- return;
+ }
+ }
+ }
+ }
+ function setIsStrictModeForDevtools(newIsStrictMode) {
+ {
+ if (typeof unstable_yieldValue === "function") {
+ unstable_setDisableYieldValue(newIsStrictMode);
+ setSuppressWarning(newIsStrictMode);
+ }
+ if (injectedHook && typeof injectedHook.setStrictMode === "function") {
+ try {
+ injectedHook.setStrictMode(rendererID, newIsStrictMode);
+ } catch (err) {
+ {
+ if (!hasLoggedError) {
+ hasLoggedError = true;
+ error("React instrumentation encountered an error: %s", err);
+ }
}
}
}
}
- queuedTarget.blockedOn = null;
}
- function attemptReplayContinuousQueuedEvent(queuedEvent) {
- if (queuedEvent.blockedOn !== null) {
- return false;
+ function injectProfilingHooks(profilingHooks) {
+ injectedProfilingHooks = profilingHooks;
+ }
+ function getLaneLabelMap() {
+ {
+ var map = /* @__PURE__ */ new Map();
+ var lane = 1;
+ for (var index2 = 0; index2 < TotalLanes; index2++) {
+ var label = getLabelForLane(lane);
+ map.set(lane, label);
+ lane *= 2;
+ }
+ return map;
}
- var targetContainers = queuedEvent.targetContainers;
- while (targetContainers.length > 0) {
- var targetContainer = targetContainers[0];
- var nextBlockedOn = attemptToDispatchEvent(queuedEvent.domEventName, queuedEvent.eventSystemFlags, targetContainer, queuedEvent.nativeEvent);
- if (nextBlockedOn !== null) {
- var _fiber3 = getInstanceFromNode(nextBlockedOn);
- if (_fiber3 !== null) {
- attemptContinuousHydration(_fiber3);
- }
- queuedEvent.blockedOn = nextBlockedOn;
- return false;
+ }
+ function markCommitStarted(lanes) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStarted === "function") {
+ injectedProfilingHooks.markCommitStarted(lanes);
}
- targetContainers.shift();
}
- return true;
}
- function attemptReplayContinuousQueuedEventInMap(queuedEvent, key, map) {
- if (attemptReplayContinuousQueuedEvent(queuedEvent)) {
- map.delete(key);
+ function markCommitStopped() {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStopped === "function") {
+ injectedProfilingHooks.markCommitStopped();
+ }
}
}
- function replayUnblockedEvents() {
- hasScheduledReplayAttempt = false;
- while (queuedDiscreteEvents.length > 0) {
- var nextDiscreteEvent = queuedDiscreteEvents[0];
- if (nextDiscreteEvent.blockedOn !== null) {
- var _fiber4 = getInstanceFromNode(nextDiscreteEvent.blockedOn);
- if (_fiber4 !== null) {
- attemptUserBlockingHydration(_fiber4);
- }
- break;
+ function markComponentRenderStarted(fiber) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStarted === "function") {
+ injectedProfilingHooks.markComponentRenderStarted(fiber);
}
- var targetContainers = nextDiscreteEvent.targetContainers;
- while (targetContainers.length > 0) {
- var targetContainer = targetContainers[0];
- var nextBlockedOn = attemptToDispatchEvent(nextDiscreteEvent.domEventName, nextDiscreteEvent.eventSystemFlags, targetContainer, nextDiscreteEvent.nativeEvent);
- if (nextBlockedOn !== null) {
- nextDiscreteEvent.blockedOn = nextBlockedOn;
- break;
- }
- targetContainers.shift();
+ }
+ }
+ function markComponentRenderStopped() {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStopped === "function") {
+ injectedProfilingHooks.markComponentRenderStopped();
}
- if (nextDiscreteEvent.blockedOn === null) {
- queuedDiscreteEvents.shift();
+ }
+ }
+ function markComponentPassiveEffectMountStarted(fiber) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted === "function") {
+ injectedProfilingHooks.markComponentPassiveEffectMountStarted(fiber);
}
}
- if (queuedFocus !== null && attemptReplayContinuousQueuedEvent(queuedFocus)) {
- queuedFocus = null;
+ }
+ function markComponentPassiveEffectMountStopped() {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped === "function") {
+ injectedProfilingHooks.markComponentPassiveEffectMountStopped();
+ }
}
- if (queuedDrag !== null && attemptReplayContinuousQueuedEvent(queuedDrag)) {
- queuedDrag = null;
+ }
+ function markComponentPassiveEffectUnmountStarted(fiber) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted === "function") {
+ injectedProfilingHooks.markComponentPassiveEffectUnmountStarted(fiber);
+ }
}
- if (queuedMouse !== null && attemptReplayContinuousQueuedEvent(queuedMouse)) {
- queuedMouse = null;
+ }
+ function markComponentPassiveEffectUnmountStopped() {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped === "function") {
+ injectedProfilingHooks.markComponentPassiveEffectUnmountStopped();
+ }
}
- queuedPointers.forEach(attemptReplayContinuousQueuedEventInMap);
- queuedPointerCaptures.forEach(attemptReplayContinuousQueuedEventInMap);
}
- function scheduleCallbackIfUnblocked(queuedEvent, unblocked) {
- if (queuedEvent.blockedOn === unblocked) {
- queuedEvent.blockedOn = null;
- if (!hasScheduledReplayAttempt) {
- hasScheduledReplayAttempt = true;
- Scheduler.unstable_scheduleCallback(Scheduler.unstable_NormalPriority, replayUnblockedEvents);
+ function markComponentLayoutEffectMountStarted(fiber) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted === "function") {
+ injectedProfilingHooks.markComponentLayoutEffectMountStarted(fiber);
}
}
}
- function retryIfBlockedOn(unblocked) {
- if (queuedDiscreteEvents.length > 0) {
- scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked);
- for (var i = 1; i < queuedDiscreteEvents.length; i++) {
- var queuedEvent = queuedDiscreteEvents[i];
- if (queuedEvent.blockedOn === unblocked) {
- queuedEvent.blockedOn = null;
- }
+ function markComponentLayoutEffectMountStopped() {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped === "function") {
+ injectedProfilingHooks.markComponentLayoutEffectMountStopped();
}
}
- if (queuedFocus !== null) {
- scheduleCallbackIfUnblocked(queuedFocus, unblocked);
+ }
+ function markComponentLayoutEffectUnmountStarted(fiber) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted === "function") {
+ injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber);
+ }
}
- if (queuedDrag !== null) {
- scheduleCallbackIfUnblocked(queuedDrag, unblocked);
+ }
+ function markComponentLayoutEffectUnmountStopped() {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped === "function") {
+ injectedProfilingHooks.markComponentLayoutEffectUnmountStopped();
+ }
}
- if (queuedMouse !== null) {
- scheduleCallbackIfUnblocked(queuedMouse, unblocked);
+ }
+ function markComponentErrored(fiber, thrownValue, lanes) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentErrored === "function") {
+ injectedProfilingHooks.markComponentErrored(fiber, thrownValue, lanes);
+ }
}
- var unblock = function(queuedEvent2) {
- return scheduleCallbackIfUnblocked(queuedEvent2, unblocked);
- };
- queuedPointers.forEach(unblock);
- queuedPointerCaptures.forEach(unblock);
- for (var _i = 0; _i < queuedExplicitHydrationTargets.length; _i++) {
- var queuedTarget = queuedExplicitHydrationTargets[_i];
- if (queuedTarget.blockedOn === unblocked) {
- queuedTarget.blockedOn = null;
+ }
+ function markComponentSuspended(fiber, wakeable, lanes) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentSuspended === "function") {
+ injectedProfilingHooks.markComponentSuspended(fiber, wakeable, lanes);
}
}
- while (queuedExplicitHydrationTargets.length > 0) {
- var nextExplicitTarget = queuedExplicitHydrationTargets[0];
- if (nextExplicitTarget.blockedOn !== null) {
- break;
- } else {
- attemptExplicitHydrationTarget(nextExplicitTarget);
- if (nextExplicitTarget.blockedOn === null) {
- queuedExplicitHydrationTargets.shift();
- }
+ }
+ function markLayoutEffectsStarted(lanes) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStarted === "function") {
+ injectedProfilingHooks.markLayoutEffectsStarted(lanes);
}
}
}
- var DiscreteEvent = 0;
- var UserBlockingEvent = 1;
- var ContinuousEvent = 2;
- function makePrefixMap(styleProp, eventName) {
- var prefixes2 = {};
- prefixes2[styleProp.toLowerCase()] = eventName.toLowerCase();
- prefixes2["Webkit" + styleProp] = "webkit" + eventName;
- prefixes2["Moz" + styleProp] = "moz" + eventName;
- return prefixes2;
+ function markLayoutEffectsStopped() {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStopped === "function") {
+ injectedProfilingHooks.markLayoutEffectsStopped();
+ }
+ }
}
- var vendorPrefixes = {
- animationend: makePrefixMap("Animation", "AnimationEnd"),
- animationiteration: makePrefixMap("Animation", "AnimationIteration"),
- animationstart: makePrefixMap("Animation", "AnimationStart"),
- transitionend: makePrefixMap("Transition", "TransitionEnd")
- };
- var prefixedEventNames = {};
- var style = {};
- if (canUseDOM2) {
- style = document.createElement("div").style;
- if (!("AnimationEvent" in window)) {
- delete vendorPrefixes.animationend.animation;
- delete vendorPrefixes.animationiteration.animation;
- delete vendorPrefixes.animationstart.animation;
+ function markPassiveEffectsStarted(lanes) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStarted === "function") {
+ injectedProfilingHooks.markPassiveEffectsStarted(lanes);
+ }
}
- if (!("TransitionEvent" in window)) {
- delete vendorPrefixes.transitionend.transition;
+ }
+ function markPassiveEffectsStopped() {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStopped === "function") {
+ injectedProfilingHooks.markPassiveEffectsStopped();
+ }
}
}
- function getVendorPrefixedEventName(eventName) {
- if (prefixedEventNames[eventName]) {
- return prefixedEventNames[eventName];
- } else if (!vendorPrefixes[eventName]) {
- return eventName;
+ function markRenderStarted(lanes) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStarted === "function") {
+ injectedProfilingHooks.markRenderStarted(lanes);
+ }
}
- var prefixMap = vendorPrefixes[eventName];
- for (var styleProp in prefixMap) {
- if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
- return prefixedEventNames[eventName] = prefixMap[styleProp];
+ }
+ function markRenderYielded() {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderYielded === "function") {
+ injectedProfilingHooks.markRenderYielded();
}
}
- return eventName;
}
- var ANIMATION_END = getVendorPrefixedEventName("animationend");
- var ANIMATION_ITERATION = getVendorPrefixedEventName("animationiteration");
- var ANIMATION_START = getVendorPrefixedEventName("animationstart");
- var TRANSITION_END = getVendorPrefixedEventName("transitionend");
- var topLevelEventsToReactNames = /* @__PURE__ */ new Map();
- var eventPriorities = /* @__PURE__ */ new Map();
- var discreteEventPairsForSimpleEventPlugin = [
- "cancel",
- "cancel",
- "click",
- "click",
- "close",
- "close",
- "contextmenu",
- "contextMenu",
- "copy",
- "copy",
- "cut",
- "cut",
- "auxclick",
- "auxClick",
- "dblclick",
- "doubleClick",
- // Careful!
- "dragend",
- "dragEnd",
- "dragstart",
- "dragStart",
- "drop",
- "drop",
- "focusin",
- "focus",
- // Careful!
- "focusout",
- "blur",
- // Careful!
- "input",
- "input",
- "invalid",
- "invalid",
- "keydown",
- "keyDown",
- "keypress",
- "keyPress",
- "keyup",
- "keyUp",
- "mousedown",
- "mouseDown",
- "mouseup",
- "mouseUp",
- "paste",
- "paste",
- "pause",
- "pause",
- "play",
- "play",
- "pointercancel",
- "pointerCancel",
- "pointerdown",
- "pointerDown",
- "pointerup",
- "pointerUp",
- "ratechange",
- "rateChange",
- "reset",
- "reset",
- "seeked",
- "seeked",
- "submit",
- "submit",
- "touchcancel",
- "touchCancel",
- "touchend",
- "touchEnd",
- "touchstart",
- "touchStart",
- "volumechange",
- "volumeChange"
- ];
- var otherDiscreteEvents = ["change", "selectionchange", "textInput", "compositionstart", "compositionend", "compositionupdate"];
- var userBlockingPairsForSimpleEventPlugin = ["drag", "drag", "dragenter", "dragEnter", "dragexit", "dragExit", "dragleave", "dragLeave", "dragover", "dragOver", "mousemove", "mouseMove", "mouseout", "mouseOut", "mouseover", "mouseOver", "pointermove", "pointerMove", "pointerout", "pointerOut", "pointerover", "pointerOver", "scroll", "scroll", "toggle", "toggle", "touchmove", "touchMove", "wheel", "wheel"];
- var continuousPairsForSimpleEventPlugin = ["abort", "abort", ANIMATION_END, "animationEnd", ANIMATION_ITERATION, "animationIteration", ANIMATION_START, "animationStart", "canplay", "canPlay", "canplaythrough", "canPlayThrough", "durationchange", "durationChange", "emptied", "emptied", "encrypted", "encrypted", "ended", "ended", "error", "error", "gotpointercapture", "gotPointerCapture", "load", "load", "loadeddata", "loadedData", "loadedmetadata", "loadedMetadata", "loadstart", "loadStart", "lostpointercapture", "lostPointerCapture", "playing", "playing", "progress", "progress", "seeking", "seeking", "stalled", "stalled", "suspend", "suspend", "timeupdate", "timeUpdate", TRANSITION_END, "transitionEnd", "waiting", "waiting"];
- function registerSimplePluginEventsAndSetTheirPriorities(eventTypes, priority) {
- for (var i = 0; i < eventTypes.length; i += 2) {
- var topEvent = eventTypes[i];
- var event = eventTypes[i + 1];
- var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
- var reactName = "on" + capitalizedEvent;
- eventPriorities.set(topEvent, priority);
- topLevelEventsToReactNames.set(topEvent, reactName);
- registerTwoPhaseEvent(reactName, [topEvent]);
+ function markRenderStopped() {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStopped === "function") {
+ injectedProfilingHooks.markRenderStopped();
+ }
}
}
- function setEventPriorities(eventTypes, priority) {
- for (var i = 0; i < eventTypes.length; i++) {
- eventPriorities.set(eventTypes[i], priority);
+ function markRenderScheduled(lane) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === "function") {
+ injectedProfilingHooks.markRenderScheduled(lane);
+ }
}
}
- function getEventPriorityForPluginSystem(domEventName) {
- var priority = eventPriorities.get(domEventName);
- return priority === void 0 ? ContinuousEvent : priority;
+ function markForceUpdateScheduled(fiber, lane) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === "function") {
+ injectedProfilingHooks.markForceUpdateScheduled(fiber, lane);
+ }
+ }
}
- function registerSimpleEvents() {
- registerSimplePluginEventsAndSetTheirPriorities(discreteEventPairsForSimpleEventPlugin, DiscreteEvent);
- registerSimplePluginEventsAndSetTheirPriorities(userBlockingPairsForSimpleEventPlugin, UserBlockingEvent);
- registerSimplePluginEventsAndSetTheirPriorities(continuousPairsForSimpleEventPlugin, ContinuousEvent);
- setEventPriorities(otherDiscreteEvents, DiscreteEvent);
+ function markStateUpdateScheduled(fiber, lane) {
+ {
+ if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === "function") {
+ injectedProfilingHooks.markStateUpdateScheduled(fiber, lane);
+ }
+ }
+ }
+ var NoMode = (
+ /* */
+ 0
+ );
+ var ConcurrentMode = (
+ /* */
+ 1
+ );
+ var ProfileMode = (
+ /* */
+ 2
+ );
+ var StrictLegacyMode = (
+ /* */
+ 8
+ );
+ var StrictEffectsMode = (
+ /* */
+ 16
+ );
+ var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback;
+ var log = Math.log;
+ var LN2 = Math.LN2;
+ function clz32Fallback(x) {
+ var asUint = x >>> 0;
+ if (asUint === 0) {
+ return 32;
+ }
+ return 31 - (log(asUint) / LN2 | 0) | 0;
}
- var Scheduler_now = Scheduler.unstable_now;
- {
- if (!(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null)) {
- {
- throw Error("It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling");
- }
- }
- }
- var ImmediatePriority = 99;
- var UserBlockingPriority = 98;
- var NormalPriority = 97;
- var LowPriority = 96;
- var IdlePriority = 95;
- var NoPriority = 90;
- var initialTimeMs = Scheduler_now();
- var SyncLanePriority = 15;
- var SyncBatchedLanePriority = 14;
- var InputDiscreteHydrationLanePriority = 13;
- var InputDiscreteLanePriority = 12;
- var InputContinuousHydrationLanePriority = 11;
- var InputContinuousLanePriority = 10;
- var DefaultHydrationLanePriority = 9;
- var DefaultLanePriority = 8;
- var TransitionHydrationPriority = 7;
- var TransitionPriority = 6;
- var RetryLanePriority = 5;
- var SelectiveHydrationLanePriority = 4;
- var IdleHydrationLanePriority = 3;
- var IdleLanePriority = 2;
- var OffscreenLanePriority = 1;
- var NoLanePriority = 0;
var TotalLanes = 31;
var NoLanes = (
/* */
@@ -6543,248 +6367,285 @@
/* */
1
);
- var SyncBatchedLane = (
- /* */
+ var InputContinuousHydrationLane = (
+ /* */
2
);
- var InputDiscreteHydrationLane = (
- /* */
+ var InputContinuousLane = (
+ /* */
4
);
- var InputDiscreteLanes = (
- /* */
- 24
+ var DefaultHydrationLane = (
+ /* */
+ 8
);
- var InputContinuousHydrationLane = (
- /* */
+ var DefaultLane = (
+ /* */
+ 16
+ );
+ var TransitionHydrationLane = (
+ /* */
32
);
- var InputContinuousLanes = (
- /* */
- 192
+ var TransitionLanes = (
+ /* */
+ 4194240
);
- var DefaultHydrationLane = (
- /* */
+ var TransitionLane1 = (
+ /* */
+ 64
+ );
+ var TransitionLane2 = (
+ /* */
+ 128
+ );
+ var TransitionLane3 = (
+ /* */
256
);
- var DefaultLanes = (
- /* */
- 3584
+ var TransitionLane4 = (
+ /* */
+ 512
);
- var TransitionHydrationLane = (
- /* */
+ var TransitionLane5 = (
+ /* */
+ 1024
+ );
+ var TransitionLane6 = (
+ /* */
+ 2048
+ );
+ var TransitionLane7 = (
+ /* */
4096
);
- var TransitionLanes = (
+ var TransitionLane8 = (
+ /* */
+ 8192
+ );
+ var TransitionLane9 = (
+ /* */
+ 16384
+ );
+ var TransitionLane10 = (
/* */
- 4186112
+ 32768
+ );
+ var TransitionLane11 = (
+ /* */
+ 65536
+ );
+ var TransitionLane12 = (
+ /* */
+ 131072
+ );
+ var TransitionLane13 = (
+ /* */
+ 262144
+ );
+ var TransitionLane14 = (
+ /* */
+ 524288
+ );
+ var TransitionLane15 = (
+ /* */
+ 1048576
+ );
+ var TransitionLane16 = (
+ /* */
+ 2097152
);
var RetryLanes = (
/* */
- 62914560
+ 130023424
);
- var SomeRetryLane = (
- /* */
+ var RetryLane1 = (
+ /* */
+ 4194304
+ );
+ var RetryLane2 = (
+ /* */
+ 8388608
+ );
+ var RetryLane3 = (
+ /* */
+ 16777216
+ );
+ var RetryLane4 = (
+ /* */
33554432
);
+ var RetryLane5 = (
+ /* */
+ 67108864
+ );
+ var SomeRetryLane = RetryLane1;
var SelectiveHydrationLane = (
/* */
- 67108864
+ 134217728
);
var NonIdleLanes = (
- /* */
- 134217727
+ /* */
+ 268435455
);
var IdleHydrationLane = (
/* */
- 134217728
+ 268435456
);
- var IdleLanes = (
- /* */
- 805306368
+ var IdleLane = (
+ /* */
+ 536870912
);
var OffscreenLane = (
/* */
1073741824
);
- var NoTimestamp = -1;
- function setCurrentUpdateLanePriority(newLanePriority) {
- }
- var return_highestLanePriority = DefaultLanePriority;
- function getHighestPriorityLanes(lanes) {
- if ((SyncLane & lanes) !== NoLanes) {
- return_highestLanePriority = SyncLanePriority;
- return SyncLane;
- }
- if ((SyncBatchedLane & lanes) !== NoLanes) {
- return_highestLanePriority = SyncBatchedLanePriority;
- return SyncBatchedLane;
- }
- if ((InputDiscreteHydrationLane & lanes) !== NoLanes) {
- return_highestLanePriority = InputDiscreteHydrationLanePriority;
- return InputDiscreteHydrationLane;
- }
- var inputDiscreteLanes = InputDiscreteLanes & lanes;
- if (inputDiscreteLanes !== NoLanes) {
- return_highestLanePriority = InputDiscreteLanePriority;
- return inputDiscreteLanes;
- }
- if ((lanes & InputContinuousHydrationLane) !== NoLanes) {
- return_highestLanePriority = InputContinuousHydrationLanePriority;
- return InputContinuousHydrationLane;
- }
- var inputContinuousLanes = InputContinuousLanes & lanes;
- if (inputContinuousLanes !== NoLanes) {
- return_highestLanePriority = InputContinuousLanePriority;
- return inputContinuousLanes;
- }
- if ((lanes & DefaultHydrationLane) !== NoLanes) {
- return_highestLanePriority = DefaultHydrationLanePriority;
- return DefaultHydrationLane;
- }
- var defaultLanes = DefaultLanes & lanes;
- if (defaultLanes !== NoLanes) {
- return_highestLanePriority = DefaultLanePriority;
- return defaultLanes;
- }
- if ((lanes & TransitionHydrationLane) !== NoLanes) {
- return_highestLanePriority = TransitionHydrationPriority;
- return TransitionHydrationLane;
- }
- var transitionLanes = TransitionLanes & lanes;
- if (transitionLanes !== NoLanes) {
- return_highestLanePriority = TransitionPriority;
- return transitionLanes;
- }
- var retryLanes = RetryLanes & lanes;
- if (retryLanes !== NoLanes) {
- return_highestLanePriority = RetryLanePriority;
- return retryLanes;
- }
- if (lanes & SelectiveHydrationLane) {
- return_highestLanePriority = SelectiveHydrationLanePriority;
- return SelectiveHydrationLane;
- }
- if ((lanes & IdleHydrationLane) !== NoLanes) {
- return_highestLanePriority = IdleHydrationLanePriority;
- return IdleHydrationLane;
- }
- var idleLanes = IdleLanes & lanes;
- if (idleLanes !== NoLanes) {
- return_highestLanePriority = IdleLanePriority;
- return idleLanes;
- }
- if ((OffscreenLane & lanes) !== NoLanes) {
- return_highestLanePriority = OffscreenLanePriority;
- return OffscreenLane;
- }
+ function getLabelForLane(lane) {
{
- error("Should have found matching lanes. This is a bug in React.");
+ if (lane & SyncLane) {
+ return "Sync";
+ }
+ if (lane & InputContinuousHydrationLane) {
+ return "InputContinuousHydration";
+ }
+ if (lane & InputContinuousLane) {
+ return "InputContinuous";
+ }
+ if (lane & DefaultHydrationLane) {
+ return "DefaultHydration";
+ }
+ if (lane & DefaultLane) {
+ return "Default";
+ }
+ if (lane & TransitionHydrationLane) {
+ return "TransitionHydration";
+ }
+ if (lane & TransitionLanes) {
+ return "Transition";
+ }
+ if (lane & RetryLanes) {
+ return "Retry";
+ }
+ if (lane & SelectiveHydrationLane) {
+ return "SelectiveHydration";
+ }
+ if (lane & IdleHydrationLane) {
+ return "IdleHydration";
+ }
+ if (lane & IdleLane) {
+ return "Idle";
+ }
+ if (lane & OffscreenLane) {
+ return "Offscreen";
+ }
}
- return_highestLanePriority = DefaultLanePriority;
- return lanes;
}
- function schedulerPriorityToLanePriority(schedulerPriorityLevel) {
- switch (schedulerPriorityLevel) {
- case ImmediatePriority:
- return SyncLanePriority;
- case UserBlockingPriority:
- return InputContinuousLanePriority;
- case NormalPriority:
- case LowPriority:
- return DefaultLanePriority;
- case IdlePriority:
- return IdleLanePriority;
+ var NoTimestamp = -1;
+ var nextTransitionLane = TransitionLane1;
+ var nextRetryLane = RetryLane1;
+ function getHighestPriorityLanes(lanes) {
+ switch (getHighestPriorityLane(lanes)) {
+ case SyncLane:
+ return SyncLane;
+ case InputContinuousHydrationLane:
+ return InputContinuousHydrationLane;
+ case InputContinuousLane:
+ return InputContinuousLane;
+ case DefaultHydrationLane:
+ return DefaultHydrationLane;
+ case DefaultLane:
+ return DefaultLane;
+ case TransitionHydrationLane:
+ return TransitionHydrationLane;
+ case TransitionLane1:
+ case TransitionLane2:
+ case TransitionLane3:
+ case TransitionLane4:
+ case TransitionLane5:
+ case TransitionLane6:
+ case TransitionLane7:
+ case TransitionLane8:
+ case TransitionLane9:
+ case TransitionLane10:
+ case TransitionLane11:
+ case TransitionLane12:
+ case TransitionLane13:
+ case TransitionLane14:
+ case TransitionLane15:
+ case TransitionLane16:
+ return lanes & TransitionLanes;
+ case RetryLane1:
+ case RetryLane2:
+ case RetryLane3:
+ case RetryLane4:
+ case RetryLane5:
+ return lanes & RetryLanes;
+ case SelectiveHydrationLane:
+ return SelectiveHydrationLane;
+ case IdleHydrationLane:
+ return IdleHydrationLane;
+ case IdleLane:
+ return IdleLane;
+ case OffscreenLane:
+ return OffscreenLane;
default:
- return NoLanePriority;
- }
- }
- function lanePriorityToSchedulerPriority(lanePriority) {
- switch (lanePriority) {
- case SyncLanePriority:
- case SyncBatchedLanePriority:
- return ImmediatePriority;
- case InputDiscreteHydrationLanePriority:
- case InputDiscreteLanePriority:
- case InputContinuousHydrationLanePriority:
- case InputContinuousLanePriority:
- return UserBlockingPriority;
- case DefaultHydrationLanePriority:
- case DefaultLanePriority:
- case TransitionHydrationPriority:
- case TransitionPriority:
- case SelectiveHydrationLanePriority:
- case RetryLanePriority:
- return NormalPriority;
- case IdleHydrationLanePriority:
- case IdleLanePriority:
- case OffscreenLanePriority:
- return IdlePriority;
- case NoLanePriority:
- return NoPriority;
- default: {
{
- throw Error("Invalid update priority: " + lanePriority + ". This is a bug in React.");
+ error("Should have found matching lanes. This is a bug in React.");
}
- }
+ return lanes;
}
}
function getNextLanes(root2, wipLanes) {
var pendingLanes = root2.pendingLanes;
if (pendingLanes === NoLanes) {
- return_highestLanePriority = NoLanePriority;
return NoLanes;
}
var nextLanes = NoLanes;
- var nextLanePriority = NoLanePriority;
- var expiredLanes = root2.expiredLanes;
var suspendedLanes = root2.suspendedLanes;
var pingedLanes = root2.pingedLanes;
- if (expiredLanes !== NoLanes) {
- nextLanes = expiredLanes;
- nextLanePriority = return_highestLanePriority = SyncLanePriority;
- } else {
- var nonIdlePendingLanes = pendingLanes & NonIdleLanes;
- if (nonIdlePendingLanes !== NoLanes) {
- var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes;
- if (nonIdleUnblockedLanes !== NoLanes) {
- nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes);
- nextLanePriority = return_highestLanePriority;
- } else {
- var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes;
- if (nonIdlePingedLanes !== NoLanes) {
- nextLanes = getHighestPriorityLanes(nonIdlePingedLanes);
- nextLanePriority = return_highestLanePriority;
- }
+ var nonIdlePendingLanes = pendingLanes & NonIdleLanes;
+ if (nonIdlePendingLanes !== NoLanes) {
+ var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes;
+ if (nonIdleUnblockedLanes !== NoLanes) {
+ nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes);
+ } else {
+ var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes;
+ if (nonIdlePingedLanes !== NoLanes) {
+ nextLanes = getHighestPriorityLanes(nonIdlePingedLanes);
}
+ }
+ } else {
+ var unblockedLanes = pendingLanes & ~suspendedLanes;
+ if (unblockedLanes !== NoLanes) {
+ nextLanes = getHighestPriorityLanes(unblockedLanes);
} else {
- var unblockedLanes = pendingLanes & ~suspendedLanes;
- if (unblockedLanes !== NoLanes) {
- nextLanes = getHighestPriorityLanes(unblockedLanes);
- nextLanePriority = return_highestLanePriority;
- } else {
- if (pingedLanes !== NoLanes) {
- nextLanes = getHighestPriorityLanes(pingedLanes);
- nextLanePriority = return_highestLanePriority;
- }
+ if (pingedLanes !== NoLanes) {
+ nextLanes = getHighestPriorityLanes(pingedLanes);
}
}
}
if (nextLanes === NoLanes) {
return NoLanes;
}
- nextLanes = pendingLanes & getEqualOrHigherPriorityLanes(nextLanes);
if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't
// bother waiting until the root is complete.
(wipLanes & suspendedLanes) === NoLanes) {
- getHighestPriorityLanes(wipLanes);
- var wipLanePriority = return_highestLanePriority;
- if (nextLanePriority <= wipLanePriority) {
+ var nextLane = getHighestPriorityLane(nextLanes);
+ var wipLane = getHighestPriorityLane(wipLanes);
+ if (
+ // Tests whether the next lane is equal or lower priority than the wip
+ // one. This works because the bits decrease in priority as you go left.
+ nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The
+ // only difference between default updates and transition updates is that
+ // default updates do not support refresh transitions.
+ nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes
+ ) {
return wipLanes;
- } else {
- return_highestLanePriority = nextLanePriority;
}
}
+ if ((nextLanes & InputContinuousLane) !== NoLanes) {
+ nextLanes |= pendingLanes & DefaultLane;
+ }
var entangledLanes = root2.entangledLanes;
if (entangledLanes !== NoLanes) {
var entanglements = root2.entanglements;
@@ -6813,14 +6674,47 @@
return mostRecentEventTime;
}
function computeExpirationTime(lane, currentTime) {
- getHighestPriorityLanes(lane);
- var priority = return_highestLanePriority;
- if (priority >= InputContinuousLanePriority) {
- return currentTime + 250;
- } else if (priority >= TransitionPriority) {
- return currentTime + 5e3;
- } else {
- return NoTimestamp;
+ switch (lane) {
+ case SyncLane:
+ case InputContinuousHydrationLane:
+ case InputContinuousLane:
+ return currentTime + 250;
+ case DefaultHydrationLane:
+ case DefaultLane:
+ case TransitionHydrationLane:
+ case TransitionLane1:
+ case TransitionLane2:
+ case TransitionLane3:
+ case TransitionLane4:
+ case TransitionLane5:
+ case TransitionLane6:
+ case TransitionLane7:
+ case TransitionLane8:
+ case TransitionLane9:
+ case TransitionLane10:
+ case TransitionLane11:
+ case TransitionLane12:
+ case TransitionLane13:
+ case TransitionLane14:
+ case TransitionLane15:
+ case TransitionLane16:
+ return currentTime + 5e3;
+ case RetryLane1:
+ case RetryLane2:
+ case RetryLane3:
+ case RetryLane4:
+ case RetryLane5:
+ return NoTimestamp;
+ case SelectiveHydrationLane:
+ case IdleHydrationLane:
+ case IdleLane:
+ case OffscreenLane:
+ return NoTimestamp;
+ default:
+ {
+ error("Should have found matching lanes. This is a bug in React.");
+ }
+ return NoTimestamp;
}
}
function markStarvedLanesAsExpired(root2, currentTime) {
@@ -6843,6 +6737,9 @@
lanes &= ~lane;
}
}
+ function getHighestPriorityPendingLanes(root2) {
+ return getHighestPriorityLanes(root2.pendingLanes);
+ }
function getLanesToRetrySynchronouslyOnError(root2) {
var everythingButOffscreen = root2.pendingLanes & ~OffscreenLane;
if (everythingButOffscreen !== NoLanes) {
@@ -6853,8 +6750,8 @@
}
return NoLanes;
}
- function returnNextLanesPriority() {
- return return_highestLanePriority;
+ function includesSyncLane(lanes) {
+ return (lanes & SyncLane) !== NoLanes;
}
function includesNonIdleWork(lanes) {
return (lanes & NonIdleLanes) !== NoLanes;
@@ -6862,84 +6759,42 @@
function includesOnlyRetries(lanes) {
return (lanes & RetryLanes) === lanes;
}
+ function includesOnlyNonUrgentLanes(lanes) {
+ var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane;
+ return (lanes & UrgentLanes) === NoLanes;
+ }
function includesOnlyTransitions(lanes) {
return (lanes & TransitionLanes) === lanes;
}
- function findUpdateLane(lanePriority, wipLanes) {
- switch (lanePriority) {
- case NoLanePriority:
- break;
- case SyncLanePriority:
- return SyncLane;
- case SyncBatchedLanePriority:
- return SyncBatchedLane;
- case InputDiscreteLanePriority: {
- var _lane = pickArbitraryLane(InputDiscreteLanes & ~wipLanes);
- if (_lane === NoLane) {
- return findUpdateLane(InputContinuousLanePriority, wipLanes);
- }
- return _lane;
- }
- case InputContinuousLanePriority: {
- var _lane2 = pickArbitraryLane(InputContinuousLanes & ~wipLanes);
- if (_lane2 === NoLane) {
- return findUpdateLane(DefaultLanePriority, wipLanes);
- }
- return _lane2;
- }
- case DefaultLanePriority: {
- var _lane3 = pickArbitraryLane(DefaultLanes & ~wipLanes);
- if (_lane3 === NoLane) {
- _lane3 = pickArbitraryLane(TransitionLanes & ~wipLanes);
- if (_lane3 === NoLane) {
- _lane3 = pickArbitraryLane(DefaultLanes);
- }
- }
- return _lane3;
- }
- case TransitionPriority:
- case RetryLanePriority:
- break;
- case IdleLanePriority:
- var lane = pickArbitraryLane(IdleLanes & ~wipLanes);
- if (lane === NoLane) {
- lane = pickArbitraryLane(IdleLanes);
- }
- return lane;
- }
- {
- {
- throw Error("Invalid update priority: " + lanePriority + ". This is a bug in React.");
- }
- }
+ function includesBlockingLane(root2, lanes) {
+ var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane;
+ return (lanes & SyncDefaultLanes) !== NoLanes;
}
- function findTransitionLane(wipLanes, pendingLanes) {
- var lane = pickArbitraryLane(TransitionLanes & ~pendingLanes);
- if (lane === NoLane) {
- lane = pickArbitraryLane(TransitionLanes & ~wipLanes);
- if (lane === NoLane) {
- lane = pickArbitraryLane(TransitionLanes);
- }
+ function includesExpiredLane(root2, lanes) {
+ return (lanes & root2.expiredLanes) !== NoLanes;
+ }
+ function isTransitionLane(lane) {
+ return (lane & TransitionLanes) !== NoLanes;
+ }
+ function claimNextTransitionLane() {
+ var lane = nextTransitionLane;
+ nextTransitionLane <<= 1;
+ if ((nextTransitionLane & TransitionLanes) === NoLanes) {
+ nextTransitionLane = TransitionLane1;
}
return lane;
}
- function findRetryLane(wipLanes) {
- var lane = pickArbitraryLane(RetryLanes & ~wipLanes);
- if (lane === NoLane) {
- lane = pickArbitraryLane(RetryLanes);
+ function claimNextRetryLane() {
+ var lane = nextRetryLane;
+ nextRetryLane <<= 1;
+ if ((nextRetryLane & RetryLanes) === NoLanes) {
+ nextRetryLane = RetryLane1;
}
return lane;
}
function getHighestPriorityLane(lanes) {
return lanes & -lanes;
}
- function getLowestPriorityLane(lanes) {
- var index2 = 31 - clz32(lanes);
- return index2 < 0 ? NoLanes : 1 << index2;
- }
- function getEqualOrHigherPriorityLanes(lanes) {
- return (getLowestPriorityLane(lanes) << 1) - 1;
- }
function pickArbitraryLane(lanes) {
return getHighestPriorityLane(lanes);
}
@@ -6961,6 +6816,9 @@
function removeLanes(set2, subset) {
return set2 & ~subset;
}
+ function intersectLanes(a, b) {
+ return a & b;
+ }
function laneToLanes(lane) {
return lane;
}
@@ -6976,9 +6834,10 @@
}
function markRootUpdated(root2, updateLane, eventTime) {
root2.pendingLanes |= updateLane;
- var higherPriorityLanes = updateLane - 1;
- root2.suspendedLanes &= higherPriorityLanes;
- root2.pingedLanes &= higherPriorityLanes;
+ if (updateLane !== IdleLane) {
+ root2.suspendedLanes = NoLanes;
+ root2.pingedLanes = NoLanes;
+ }
var eventTimes = root2.eventTimes;
var index2 = laneToIndex(updateLane);
eventTimes[index2] = eventTime;
@@ -6998,20 +6857,11 @@
function markRootPinged(root2, pingedLanes, eventTime) {
root2.pingedLanes |= root2.suspendedLanes & pingedLanes;
}
- function markDiscreteUpdatesExpired(root2) {
- root2.expiredLanes |= InputDiscreteLanes & root2.pendingLanes;
- }
- function hasDiscreteLanes(lanes) {
- return (lanes & InputDiscreteLanes) !== NoLanes;
- }
- function markRootMutableRead(root2, updateLane) {
- root2.mutableReadLanes |= updateLane & root2.pendingLanes;
- }
function markRootFinished(root2, remainingLanes) {
var noLongerPendingLanes = root2.pendingLanes & ~remainingLanes;
root2.pendingLanes = remainingLanes;
- root2.suspendedLanes = 0;
- root2.pingedLanes = 0;
+ root2.suspendedLanes = NoLanes;
+ root2.pingedLanes = NoLanes;
root2.expiredLanes &= remainingLanes;
root2.mutableReadLanes &= remainingLanes;
root2.entangledLanes &= remainingLanes;
@@ -7029,26 +6879,448 @@
}
}
function markRootEntangled(root2, entangledLanes) {
- root2.entangledLanes |= entangledLanes;
+ var rootEntangledLanes = root2.entangledLanes |= entangledLanes;
var entanglements = root2.entanglements;
- var lanes = entangledLanes;
- while (lanes > 0) {
+ var lanes = rootEntangledLanes;
+ while (lanes) {
var index2 = pickArbitraryLaneIndex(lanes);
var lane = 1 << index2;
- entanglements[index2] |= entangledLanes;
+ if (
+ // Is this one of the newly entangled lanes?
+ lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes?
+ entanglements[index2] & entangledLanes
+ ) {
+ entanglements[index2] |= entangledLanes;
+ }
lanes &= ~lane;
}
}
- var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback;
- var log = Math.log;
- var LN2 = Math.LN2;
- function clz32Fallback(lanes) {
- if (lanes === 0) {
- return 32;
+ function getBumpedLaneForHydration(root2, renderLanes2) {
+ var renderLane = getHighestPriorityLane(renderLanes2);
+ var lane;
+ switch (renderLane) {
+ case InputContinuousLane:
+ lane = InputContinuousHydrationLane;
+ break;
+ case DefaultLane:
+ lane = DefaultHydrationLane;
+ break;
+ case TransitionLane1:
+ case TransitionLane2:
+ case TransitionLane3:
+ case TransitionLane4:
+ case TransitionLane5:
+ case TransitionLane6:
+ case TransitionLane7:
+ case TransitionLane8:
+ case TransitionLane9:
+ case TransitionLane10:
+ case TransitionLane11:
+ case TransitionLane12:
+ case TransitionLane13:
+ case TransitionLane14:
+ case TransitionLane15:
+ case TransitionLane16:
+ case RetryLane1:
+ case RetryLane2:
+ case RetryLane3:
+ case RetryLane4:
+ case RetryLane5:
+ lane = TransitionHydrationLane;
+ break;
+ case IdleLane:
+ lane = IdleHydrationLane;
+ break;
+ default:
+ lane = NoLane;
+ break;
}
- return 31 - (log(lanes) / LN2 | 0) | 0;
+ if ((lane & (root2.suspendedLanes | renderLanes2)) !== NoLane) {
+ return NoLane;
+ }
+ return lane;
}
- var UserBlockingPriority$1 = Scheduler.unstable_UserBlockingPriority, runWithPriority = Scheduler.unstable_runWithPriority;
+ function addFiberToLanesMap(root2, fiber, lanes) {
+ if (!isDevToolsPresent) {
+ return;
+ }
+ var pendingUpdatersLaneMap = root2.pendingUpdatersLaneMap;
+ while (lanes > 0) {
+ var index2 = laneToIndex(lanes);
+ var lane = 1 << index2;
+ var updaters = pendingUpdatersLaneMap[index2];
+ updaters.add(fiber);
+ lanes &= ~lane;
+ }
+ }
+ function movePendingFibersToMemoized(root2, lanes) {
+ if (!isDevToolsPresent) {
+ return;
+ }
+ var pendingUpdatersLaneMap = root2.pendingUpdatersLaneMap;
+ var memoizedUpdaters = root2.memoizedUpdaters;
+ while (lanes > 0) {
+ var index2 = laneToIndex(lanes);
+ var lane = 1 << index2;
+ var updaters = pendingUpdatersLaneMap[index2];
+ if (updaters.size > 0) {
+ updaters.forEach(function(fiber) {
+ var alternate = fiber.alternate;
+ if (alternate === null || !memoizedUpdaters.has(alternate)) {
+ memoizedUpdaters.add(fiber);
+ }
+ });
+ updaters.clear();
+ }
+ lanes &= ~lane;
+ }
+ }
+ function getTransitionsForLanes(root2, lanes) {
+ {
+ return null;
+ }
+ }
+ var DiscreteEventPriority = SyncLane;
+ var ContinuousEventPriority = InputContinuousLane;
+ var DefaultEventPriority = DefaultLane;
+ var IdleEventPriority = IdleLane;
+ var currentUpdatePriority = NoLane;
+ function getCurrentUpdatePriority() {
+ return currentUpdatePriority;
+ }
+ function setCurrentUpdatePriority(newPriority) {
+ currentUpdatePriority = newPriority;
+ }
+ function runWithPriority(priority, fn) {
+ var previousPriority = currentUpdatePriority;
+ try {
+ currentUpdatePriority = priority;
+ return fn();
+ } finally {
+ currentUpdatePriority = previousPriority;
+ }
+ }
+ function higherEventPriority(a, b) {
+ return a !== 0 && a < b ? a : b;
+ }
+ function lowerEventPriority(a, b) {
+ return a === 0 || a > b ? a : b;
+ }
+ function isHigherEventPriority(a, b) {
+ return a !== 0 && a < b;
+ }
+ function lanesToEventPriority(lanes) {
+ var lane = getHighestPriorityLane(lanes);
+ if (!isHigherEventPriority(DiscreteEventPriority, lane)) {
+ return DiscreteEventPriority;
+ }
+ if (!isHigherEventPriority(ContinuousEventPriority, lane)) {
+ return ContinuousEventPriority;
+ }
+ if (includesNonIdleWork(lane)) {
+ return DefaultEventPriority;
+ }
+ return IdleEventPriority;
+ }
+ function isRootDehydrated(root2) {
+ var currentState = root2.current.memoizedState;
+ return currentState.isDehydrated;
+ }
+ var _attemptSynchronousHydration;
+ function setAttemptSynchronousHydration(fn) {
+ _attemptSynchronousHydration = fn;
+ }
+ function attemptSynchronousHydration(fiber) {
+ _attemptSynchronousHydration(fiber);
+ }
+ var attemptContinuousHydration;
+ function setAttemptContinuousHydration(fn) {
+ attemptContinuousHydration = fn;
+ }
+ var attemptHydrationAtCurrentPriority;
+ function setAttemptHydrationAtCurrentPriority(fn) {
+ attemptHydrationAtCurrentPriority = fn;
+ }
+ var getCurrentUpdatePriority$1;
+ function setGetCurrentUpdatePriority(fn) {
+ getCurrentUpdatePriority$1 = fn;
+ }
+ var attemptHydrationAtPriority;
+ function setAttemptHydrationAtPriority(fn) {
+ attemptHydrationAtPriority = fn;
+ }
+ var hasScheduledReplayAttempt = false;
+ var queuedDiscreteEvents = [];
+ var queuedFocus = null;
+ var queuedDrag = null;
+ var queuedMouse = null;
+ var queuedPointers = /* @__PURE__ */ new Map();
+ var queuedPointerCaptures = /* @__PURE__ */ new Map();
+ var queuedExplicitHydrationTargets = [];
+ var discreteReplayableEvents = [
+ "mousedown",
+ "mouseup",
+ "touchcancel",
+ "touchend",
+ "touchstart",
+ "auxclick",
+ "dblclick",
+ "pointercancel",
+ "pointerdown",
+ "pointerup",
+ "dragend",
+ "dragstart",
+ "drop",
+ "compositionend",
+ "compositionstart",
+ "keydown",
+ "keypress",
+ "keyup",
+ "input",
+ "textInput",
+ // Intentionally camelCase
+ "copy",
+ "cut",
+ "paste",
+ "click",
+ "change",
+ "contextmenu",
+ "reset",
+ "submit"
+ ];
+ function isDiscreteEventThatRequiresHydration(eventType) {
+ return discreteReplayableEvents.indexOf(eventType) > -1;
+ }
+ function createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
+ return {
+ blockedOn,
+ domEventName,
+ eventSystemFlags,
+ nativeEvent,
+ targetContainers: [targetContainer]
+ };
+ }
+ function clearIfContinuousEvent(domEventName, nativeEvent) {
+ switch (domEventName) {
+ case "focusin":
+ case "focusout":
+ queuedFocus = null;
+ break;
+ case "dragenter":
+ case "dragleave":
+ queuedDrag = null;
+ break;
+ case "mouseover":
+ case "mouseout":
+ queuedMouse = null;
+ break;
+ case "pointerover":
+ case "pointerout": {
+ var pointerId = nativeEvent.pointerId;
+ queuedPointers.delete(pointerId);
+ break;
+ }
+ case "gotpointercapture":
+ case "lostpointercapture": {
+ var _pointerId = nativeEvent.pointerId;
+ queuedPointerCaptures.delete(_pointerId);
+ break;
+ }
+ }
+ }
+ function accumulateOrCreateContinuousQueuedReplayableEvent(existingQueuedEvent, blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
+ if (existingQueuedEvent === null || existingQueuedEvent.nativeEvent !== nativeEvent) {
+ var queuedEvent = createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent);
+ if (blockedOn !== null) {
+ var _fiber2 = getInstanceFromNode(blockedOn);
+ if (_fiber2 !== null) {
+ attemptContinuousHydration(_fiber2);
+ }
+ }
+ return queuedEvent;
+ }
+ existingQueuedEvent.eventSystemFlags |= eventSystemFlags;
+ var targetContainers = existingQueuedEvent.targetContainers;
+ if (targetContainer !== null && targetContainers.indexOf(targetContainer) === -1) {
+ targetContainers.push(targetContainer);
+ }
+ return existingQueuedEvent;
+ }
+ function queueIfContinuousEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
+ switch (domEventName) {
+ case "focusin": {
+ var focusEvent = nativeEvent;
+ queuedFocus = accumulateOrCreateContinuousQueuedReplayableEvent(queuedFocus, blockedOn, domEventName, eventSystemFlags, targetContainer, focusEvent);
+ return true;
+ }
+ case "dragenter": {
+ var dragEvent = nativeEvent;
+ queuedDrag = accumulateOrCreateContinuousQueuedReplayableEvent(queuedDrag, blockedOn, domEventName, eventSystemFlags, targetContainer, dragEvent);
+ return true;
+ }
+ case "mouseover": {
+ var mouseEvent = nativeEvent;
+ queuedMouse = accumulateOrCreateContinuousQueuedReplayableEvent(queuedMouse, blockedOn, domEventName, eventSystemFlags, targetContainer, mouseEvent);
+ return true;
+ }
+ case "pointerover": {
+ var pointerEvent = nativeEvent;
+ var pointerId = pointerEvent.pointerId;
+ queuedPointers.set(pointerId, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointers.get(pointerId) || null, blockedOn, domEventName, eventSystemFlags, targetContainer, pointerEvent));
+ return true;
+ }
+ case "gotpointercapture": {
+ var _pointerEvent = nativeEvent;
+ var _pointerId2 = _pointerEvent.pointerId;
+ queuedPointerCaptures.set(_pointerId2, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointerCaptures.get(_pointerId2) || null, blockedOn, domEventName, eventSystemFlags, targetContainer, _pointerEvent));
+ return true;
+ }
+ }
+ return false;
+ }
+ function attemptExplicitHydrationTarget(queuedTarget) {
+ var targetInst = getClosestInstanceFromNode(queuedTarget.target);
+ if (targetInst !== null) {
+ var nearestMounted = getNearestMountedFiber(targetInst);
+ if (nearestMounted !== null) {
+ var tag = nearestMounted.tag;
+ if (tag === SuspenseComponent) {
+ var instance = getSuspenseInstanceFromFiber(nearestMounted);
+ if (instance !== null) {
+ queuedTarget.blockedOn = instance;
+ attemptHydrationAtPriority(queuedTarget.priority, function() {
+ attemptHydrationAtCurrentPriority(nearestMounted);
+ });
+ return;
+ }
+ } else if (tag === HostRoot) {
+ var root2 = nearestMounted.stateNode;
+ if (isRootDehydrated(root2)) {
+ queuedTarget.blockedOn = getContainerFromFiber(nearestMounted);
+ return;
+ }
+ }
+ }
+ }
+ queuedTarget.blockedOn = null;
+ }
+ function queueExplicitHydrationTarget(target) {
+ var updatePriority = getCurrentUpdatePriority$1();
+ var queuedTarget = {
+ blockedOn: null,
+ target,
+ priority: updatePriority
+ };
+ var i = 0;
+ for (; i < queuedExplicitHydrationTargets.length; i++) {
+ if (!isHigherEventPriority(updatePriority, queuedExplicitHydrationTargets[i].priority)) {
+ break;
+ }
+ }
+ queuedExplicitHydrationTargets.splice(i, 0, queuedTarget);
+ if (i === 0) {
+ attemptExplicitHydrationTarget(queuedTarget);
+ }
+ }
+ function attemptReplayContinuousQueuedEvent(queuedEvent) {
+ if (queuedEvent.blockedOn !== null) {
+ return false;
+ }
+ var targetContainers = queuedEvent.targetContainers;
+ while (targetContainers.length > 0) {
+ var targetContainer = targetContainers[0];
+ var nextBlockedOn = findInstanceBlockingEvent(queuedEvent.domEventName, queuedEvent.eventSystemFlags, targetContainer, queuedEvent.nativeEvent);
+ if (nextBlockedOn === null) {
+ {
+ var nativeEvent = queuedEvent.nativeEvent;
+ var nativeEventClone = new nativeEvent.constructor(nativeEvent.type, nativeEvent);
+ setReplayingEvent(nativeEventClone);
+ nativeEvent.target.dispatchEvent(nativeEventClone);
+ resetReplayingEvent();
+ }
+ } else {
+ var _fiber3 = getInstanceFromNode(nextBlockedOn);
+ if (_fiber3 !== null) {
+ attemptContinuousHydration(_fiber3);
+ }
+ queuedEvent.blockedOn = nextBlockedOn;
+ return false;
+ }
+ targetContainers.shift();
+ }
+ return true;
+ }
+ function attemptReplayContinuousQueuedEventInMap(queuedEvent, key, map) {
+ if (attemptReplayContinuousQueuedEvent(queuedEvent)) {
+ map.delete(key);
+ }
+ }
+ function replayUnblockedEvents() {
+ hasScheduledReplayAttempt = false;
+ if (queuedFocus !== null && attemptReplayContinuousQueuedEvent(queuedFocus)) {
+ queuedFocus = null;
+ }
+ if (queuedDrag !== null && attemptReplayContinuousQueuedEvent(queuedDrag)) {
+ queuedDrag = null;
+ }
+ if (queuedMouse !== null && attemptReplayContinuousQueuedEvent(queuedMouse)) {
+ queuedMouse = null;
+ }
+ queuedPointers.forEach(attemptReplayContinuousQueuedEventInMap);
+ queuedPointerCaptures.forEach(attemptReplayContinuousQueuedEventInMap);
+ }
+ function scheduleCallbackIfUnblocked(queuedEvent, unblocked) {
+ if (queuedEvent.blockedOn === unblocked) {
+ queuedEvent.blockedOn = null;
+ if (!hasScheduledReplayAttempt) {
+ hasScheduledReplayAttempt = true;
+ Scheduler.unstable_scheduleCallback(Scheduler.unstable_NormalPriority, replayUnblockedEvents);
+ }
+ }
+ }
+ function retryIfBlockedOn(unblocked) {
+ if (queuedDiscreteEvents.length > 0) {
+ scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked);
+ for (var i = 1; i < queuedDiscreteEvents.length; i++) {
+ var queuedEvent = queuedDiscreteEvents[i];
+ if (queuedEvent.blockedOn === unblocked) {
+ queuedEvent.blockedOn = null;
+ }
+ }
+ }
+ if (queuedFocus !== null) {
+ scheduleCallbackIfUnblocked(queuedFocus, unblocked);
+ }
+ if (queuedDrag !== null) {
+ scheduleCallbackIfUnblocked(queuedDrag, unblocked);
+ }
+ if (queuedMouse !== null) {
+ scheduleCallbackIfUnblocked(queuedMouse, unblocked);
+ }
+ var unblock = function(queuedEvent2) {
+ return scheduleCallbackIfUnblocked(queuedEvent2, unblocked);
+ };
+ queuedPointers.forEach(unblock);
+ queuedPointerCaptures.forEach(unblock);
+ for (var _i = 0; _i < queuedExplicitHydrationTargets.length; _i++) {
+ var queuedTarget = queuedExplicitHydrationTargets[_i];
+ if (queuedTarget.blockedOn === unblocked) {
+ queuedTarget.blockedOn = null;
+ }
+ }
+ while (queuedExplicitHydrationTargets.length > 0) {
+ var nextExplicitTarget = queuedExplicitHydrationTargets[0];
+ if (nextExplicitTarget.blockedOn !== null) {
+ break;
+ } else {
+ attemptExplicitHydrationTarget(nextExplicitTarget);
+ if (nextExplicitTarget.blockedOn === null) {
+ queuedExplicitHydrationTargets.shift();
+ }
+ }
+ }
+ }
+ var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
var _enabled = true;
function setEnabled(enabled) {
_enabled = !!enabled;
@@ -7057,16 +7329,16 @@
return _enabled;
}
function createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags) {
- var eventPriority = getEventPriorityForPluginSystem(domEventName);
+ var eventPriority = getEventPriority(domEventName);
var listenerWrapper;
switch (eventPriority) {
- case DiscreteEvent:
+ case DiscreteEventPriority:
listenerWrapper = dispatchDiscreteEvent;
break;
- case UserBlockingEvent:
- listenerWrapper = dispatchUserBlockingUpdate;
+ case ContinuousEventPriority:
+ listenerWrapper = dispatchContinuousEvent;
break;
- case ContinuousEvent:
+ case DefaultEventPriority:
default:
listenerWrapper = dispatchEvent;
break;
@@ -7074,55 +7346,74 @@
return listenerWrapper.bind(null, domEventName, eventSystemFlags, targetContainer);
}
function dispatchDiscreteEvent(domEventName, eventSystemFlags, container, nativeEvent) {
- {
- flushDiscreteUpdatesIfNeeded(nativeEvent.timeStamp);
+ var previousPriority = getCurrentUpdatePriority();
+ var prevTransition = ReactCurrentBatchConfig.transition;
+ ReactCurrentBatchConfig.transition = null;
+ try {
+ setCurrentUpdatePriority(DiscreteEventPriority);
+ dispatchEvent(domEventName, eventSystemFlags, container, nativeEvent);
+ } finally {
+ setCurrentUpdatePriority(previousPriority);
+ ReactCurrentBatchConfig.transition = prevTransition;
}
- discreteUpdates(dispatchEvent, domEventName, eventSystemFlags, container, nativeEvent);
}
- function dispatchUserBlockingUpdate(domEventName, eventSystemFlags, container, nativeEvent) {
- {
- runWithPriority(UserBlockingPriority$1, dispatchEvent.bind(null, domEventName, eventSystemFlags, container, nativeEvent));
+ function dispatchContinuousEvent(domEventName, eventSystemFlags, container, nativeEvent) {
+ var previousPriority = getCurrentUpdatePriority();
+ var prevTransition = ReactCurrentBatchConfig.transition;
+ ReactCurrentBatchConfig.transition = null;
+ try {
+ setCurrentUpdatePriority(ContinuousEventPriority);
+ dispatchEvent(domEventName, eventSystemFlags, container, nativeEvent);
+ } finally {
+ setCurrentUpdatePriority(previousPriority);
+ ReactCurrentBatchConfig.transition = prevTransition;
}
}
function dispatchEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent) {
if (!_enabled) {
return;
}
- var allowReplay = true;
{
- allowReplay = (eventSystemFlags & IS_CAPTURE_PHASE) === 0;
+ dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay(domEventName, eventSystemFlags, targetContainer, nativeEvent);
}
- if (allowReplay && hasQueuedDiscreteEvents() && isReplayableDiscreteEvent(domEventName)) {
- queueDiscreteEvent(
- null,
- // Flags that we're not actually blocked on anything as far as we know.
- domEventName,
- eventSystemFlags,
- targetContainer,
- nativeEvent
- );
+ }
+ function dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay(domEventName, eventSystemFlags, targetContainer, nativeEvent) {
+ var blockedOn = findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent);
+ if (blockedOn === null) {
+ dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, return_targetInst, targetContainer);
+ clearIfContinuousEvent(domEventName, nativeEvent);
return;
}
- var blockedOn = attemptToDispatchEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent);
- if (blockedOn === null) {
- if (allowReplay) {
- clearIfContinuousEvent(domEventName, nativeEvent);
- }
+ if (queueIfContinuousEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent)) {
+ nativeEvent.stopPropagation();
return;
}
- if (allowReplay) {
- if (isReplayableDiscreteEvent(domEventName)) {
- queueDiscreteEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent);
- return;
+ clearIfContinuousEvent(domEventName, nativeEvent);
+ if (eventSystemFlags & IS_CAPTURE_PHASE && isDiscreteEventThatRequiresHydration(domEventName)) {
+ while (blockedOn !== null) {
+ var fiber = getInstanceFromNode(blockedOn);
+ if (fiber !== null) {
+ attemptSynchronousHydration(fiber);
+ }
+ var nextBlockedOn = findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent);
+ if (nextBlockedOn === null) {
+ dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, return_targetInst, targetContainer);
+ }
+ if (nextBlockedOn === blockedOn) {
+ break;
+ }
+ blockedOn = nextBlockedOn;
}
- if (queueIfContinuousEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent)) {
- return;
+ if (blockedOn !== null) {
+ nativeEvent.stopPropagation();
}
- clearIfContinuousEvent(domEventName, nativeEvent);
+ return;
}
dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, null, targetContainer);
}
- function attemptToDispatchEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent) {
+ var return_targetInst = null;
+ function findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent) {
+ return_targetInst = null;
var nativeEventTarget = getEventTarget(nativeEvent);
var targetInst = getClosestInstanceFromNode(nativeEventTarget);
if (targetInst !== null) {
@@ -7139,7 +7430,7 @@
targetInst = null;
} else if (tag === HostRoot) {
var root2 = nearestMounted.stateNode;
- if (root2.hydrate) {
+ if (isRootDehydrated(root2)) {
return getContainerFromFiber(nearestMounted);
}
targetInst = null;
@@ -7148,9 +7439,103 @@
}
}
}
- dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, targetInst, targetContainer);
+ return_targetInst = targetInst;
return null;
}
+ function getEventPriority(domEventName) {
+ switch (domEventName) {
+ case "cancel":
+ case "click":
+ case "close":
+ case "contextmenu":
+ case "copy":
+ case "cut":
+ case "auxclick":
+ case "dblclick":
+ case "dragend":
+ case "dragstart":
+ case "drop":
+ case "focusin":
+ case "focusout":
+ case "input":
+ case "invalid":
+ case "keydown":
+ case "keypress":
+ case "keyup":
+ case "mousedown":
+ case "mouseup":
+ case "paste":
+ case "pause":
+ case "play":
+ case "pointercancel":
+ case "pointerdown":
+ case "pointerup":
+ case "ratechange":
+ case "reset":
+ case "resize":
+ case "seeked":
+ case "submit":
+ case "touchcancel":
+ case "touchend":
+ case "touchstart":
+ case "volumechange":
+ case "change":
+ case "selectionchange":
+ case "textInput":
+ case "compositionstart":
+ case "compositionend":
+ case "compositionupdate":
+ case "beforeblur":
+ case "afterblur":
+ case "beforeinput":
+ case "blur":
+ case "fullscreenchange":
+ case "focus":
+ case "hashchange":
+ case "popstate":
+ case "select":
+ case "selectstart":
+ return DiscreteEventPriority;
+ case "drag":
+ case "dragenter":
+ case "dragexit":
+ case "dragleave":
+ case "dragover":
+ case "mousemove":
+ case "mouseout":
+ case "mouseover":
+ case "pointermove":
+ case "pointerout":
+ case "pointerover":
+ case "scroll":
+ case "toggle":
+ case "touchmove":
+ case "wheel":
+ case "mouseenter":
+ case "mouseleave":
+ case "pointerenter":
+ case "pointerleave":
+ return ContinuousEventPriority;
+ case "message": {
+ var schedulerPriority = getCurrentPriorityLevel();
+ switch (schedulerPriority) {
+ case ImmediatePriority:
+ return DiscreteEventPriority;
+ case UserBlockingPriority:
+ return ContinuousEventPriority;
+ case NormalPriority:
+ case LowPriority:
+ return DefaultEventPriority;
+ case IdlePriority:
+ return IdleEventPriority;
+ default:
+ return DefaultEventPriority;
+ }
+ }
+ default:
+ return DefaultEventPriority;
+ }
+ }
function addEventBubbleListener(target, eventType, listener) {
target.addEventListener(eventType, listener, false);
return listener;
@@ -7269,7 +7654,7 @@
this.isPropagationStopped = functionThatReturnsFalse;
return this;
}
- _assign(SyntheticBaseEvent.prototype, {
+ assign(SyntheticBaseEvent.prototype, {
preventDefault: function() {
this.defaultPrevented = true;
var event = this.nativeEvent;
@@ -7322,7 +7707,7 @@
isTrusted: 0
};
var SyntheticEvent = createSyntheticEvent(EventInterface);
- var UIEventInterface = _assign({}, EventInterface, {
+ var UIEventInterface = assign({}, EventInterface, {
view: 0,
detail: 0
});
@@ -7342,7 +7727,7 @@
lastMouseEvent = event;
}
}
- var MouseEventInterface = _assign({}, UIEventInterface, {
+ var MouseEventInterface = assign({}, UIEventInterface, {
screenX: 0,
screenY: 0,
clientX: 0,
@@ -7376,27 +7761,27 @@
}
});
var SyntheticMouseEvent = createSyntheticEvent(MouseEventInterface);
- var DragEventInterface = _assign({}, MouseEventInterface, {
+ var DragEventInterface = assign({}, MouseEventInterface, {
dataTransfer: 0
});
var SyntheticDragEvent = createSyntheticEvent(DragEventInterface);
- var FocusEventInterface = _assign({}, UIEventInterface, {
+ var FocusEventInterface = assign({}, UIEventInterface, {
relatedTarget: 0
});
var SyntheticFocusEvent = createSyntheticEvent(FocusEventInterface);
- var AnimationEventInterface = _assign({}, EventInterface, {
+ var AnimationEventInterface = assign({}, EventInterface, {
animationName: 0,
elapsedTime: 0,
pseudoElement: 0
});
var SyntheticAnimationEvent = createSyntheticEvent(AnimationEventInterface);
- var ClipboardEventInterface = _assign({}, EventInterface, {
+ var ClipboardEventInterface = assign({}, EventInterface, {
clipboardData: function(event) {
return "clipboardData" in event ? event.clipboardData : window.clipboardData;
}
});
var SyntheticClipboardEvent = createSyntheticEvent(ClipboardEventInterface);
- var CompositionEventInterface = _assign({}, EventInterface, {
+ var CompositionEventInterface = assign({}, EventInterface, {
data: 0
});
var SyntheticCompositionEvent = createSyntheticEvent(CompositionEventInterface);
@@ -7487,7 +7872,7 @@
function getEventModifierState(nativeEvent) {
return modifierStateGetter;
}
- var KeyboardEventInterface = _assign({}, UIEventInterface, {
+ var KeyboardEventInterface = assign({}, UIEventInterface, {
key: getEventKey,
code: 0,
location: 0,
@@ -7522,7 +7907,7 @@
}
});
var SyntheticKeyboardEvent = createSyntheticEvent(KeyboardEventInterface);
- var PointerEventInterface = _assign({}, MouseEventInterface, {
+ var PointerEventInterface = assign({}, MouseEventInterface, {
pointerId: 0,
width: 0,
height: 0,
@@ -7535,7 +7920,7 @@
isPrimary: 0
});
var SyntheticPointerEvent = createSyntheticEvent(PointerEventInterface);
- var TouchEventInterface = _assign({}, UIEventInterface, {
+ var TouchEventInterface = assign({}, UIEventInterface, {
touches: 0,
targetTouches: 0,
changedTouches: 0,
@@ -7546,13 +7931,13 @@
getModifierState: getEventModifierState
});
var SyntheticTouchEvent = createSyntheticEvent(TouchEventInterface);
- var TransitionEventInterface = _assign({}, EventInterface, {
+ var TransitionEventInterface = assign({}, EventInterface, {
propertyName: 0,
elapsedTime: 0,
pseudoElement: 0
});
var SyntheticTransitionEvent = createSyntheticEvent(TransitionEventInterface);
- var WheelEventInterface = _assign({}, MouseEventInterface, {
+ var WheelEventInterface = assign({}, MouseEventInterface, {
deltaX: function(event) {
return "deltaX" in event ? event.deltaX : (
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
@@ -7928,7 +8313,7 @@
function extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
var isOverEvent = domEventName === "mouseover" || domEventName === "pointerover";
var isOutEvent = domEventName === "mouseout" || domEventName === "pointerout";
- if (isOverEvent && (eventSystemFlags & IS_REPLAYED) === 0) {
+ if (isOverEvent && !isReplayingEvent(nativeEvent)) {
var related = nativeEvent.relatedTarget || nativeEvent.fromElement;
if (related) {
if (getClosestInstanceFromNode(related) || isContainerMarkedAsRoot(related)) {
@@ -7998,7 +8383,6 @@
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
}
var objectIs = typeof Object.is === "function" ? Object.is : is;
- var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
function shallowEqual(objA, objB) {
if (objectIs(objA, objB)) {
return true;
@@ -8012,7 +8396,8 @@
return false;
}
for (var i = 0; i < keysA.length; i++) {
- if (!hasOwnProperty$2.call(objB, keysA[i]) || !objectIs(objA[keysA[i]], objB[keysA[i]])) {
+ var currentKey = keysA[i];
+ if (!hasOwnProperty.call(objB, currentKey) || !objectIs(objA[currentKey], objB[currentKey])) {
return false;
}
}
@@ -8343,6 +8728,71 @@
constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget);
}
}
+ function makePrefixMap(styleProp, eventName) {
+ var prefixes2 = {};
+ prefixes2[styleProp.toLowerCase()] = eventName.toLowerCase();
+ prefixes2["Webkit" + styleProp] = "webkit" + eventName;
+ prefixes2["Moz" + styleProp] = "moz" + eventName;
+ return prefixes2;
+ }
+ var vendorPrefixes = {
+ animationend: makePrefixMap("Animation", "AnimationEnd"),
+ animationiteration: makePrefixMap("Animation", "AnimationIteration"),
+ animationstart: makePrefixMap("Animation", "AnimationStart"),
+ transitionend: makePrefixMap("Transition", "TransitionEnd")
+ };
+ var prefixedEventNames = {};
+ var style = {};
+ if (canUseDOM2) {
+ style = document.createElement("div").style;
+ if (!("AnimationEvent" in window)) {
+ delete vendorPrefixes.animationend.animation;
+ delete vendorPrefixes.animationiteration.animation;
+ delete vendorPrefixes.animationstart.animation;
+ }
+ if (!("TransitionEvent" in window)) {
+ delete vendorPrefixes.transitionend.transition;
+ }
+ }
+ function getVendorPrefixedEventName(eventName) {
+ if (prefixedEventNames[eventName]) {
+ return prefixedEventNames[eventName];
+ } else if (!vendorPrefixes[eventName]) {
+ return eventName;
+ }
+ var prefixMap = vendorPrefixes[eventName];
+ for (var styleProp in prefixMap) {
+ if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
+ return prefixedEventNames[eventName] = prefixMap[styleProp];
+ }
+ }
+ return eventName;
+ }
+ var ANIMATION_END = getVendorPrefixedEventName("animationend");
+ var ANIMATION_ITERATION = getVendorPrefixedEventName("animationiteration");
+ var ANIMATION_START = getVendorPrefixedEventName("animationstart");
+ var TRANSITION_END = getVendorPrefixedEventName("transitionend");
+ var topLevelEventsToReactNames = /* @__PURE__ */ new Map();
+ var simpleEventPluginEvents = ["abort", "auxClick", "cancel", "canPlay", "canPlayThrough", "click", "close", "contextMenu", "copy", "cut", "drag", "dragEnd", "dragEnter", "dragExit", "dragLeave", "dragOver", "dragStart", "drop", "durationChange", "emptied", "encrypted", "ended", "error", "gotPointerCapture", "input", "invalid", "keyDown", "keyPress", "keyUp", "load", "loadedData", "loadedMetadata", "loadStart", "lostPointerCapture", "mouseDown", "mouseMove", "mouseOut", "mouseOver", "mouseUp", "paste", "pause", "play", "playing", "pointerCancel", "pointerDown", "pointerMove", "pointerOut", "pointerOver", "pointerUp", "progress", "rateChange", "reset", "resize", "seeked", "seeking", "stalled", "submit", "suspend", "timeUpdate", "touchCancel", "touchEnd", "touchStart", "volumeChange", "scroll", "toggle", "touchMove", "waiting", "wheel"];
+ function registerSimpleEvent(domEventName, reactName) {
+ topLevelEventsToReactNames.set(domEventName, reactName);
+ registerTwoPhaseEvent(reactName, [domEventName]);
+ }
+ function registerSimpleEvents() {
+ for (var i = 0; i < simpleEventPluginEvents.length; i++) {
+ var eventName = simpleEventPluginEvents[i];
+ var domEventName = eventName.toLowerCase();
+ var capitalizedEvent = eventName[0].toUpperCase() + eventName.slice(1);
+ registerSimpleEvent(domEventName, "on" + capitalizedEvent);
+ }
+ registerSimpleEvent(ANIMATION_END, "onAnimationEnd");
+ registerSimpleEvent(ANIMATION_ITERATION, "onAnimationIteration");
+ registerSimpleEvent(ANIMATION_START, "onAnimationStart");
+ registerSimpleEvent("dblclick", "onDoubleClick");
+ registerSimpleEvent("focusin", "onFocus");
+ registerSimpleEvent("focusout", "onBlur");
+ registerSimpleEvent(TRANSITION_END, "onTransitionEnd");
+ }
function extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
var reactName = topLevelEventsToReactNames.get(domEventName);
if (reactName === void 0) {
@@ -8457,13 +8907,13 @@
extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
var shouldProcessPolyfillPlugins = (eventSystemFlags & SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS) === 0;
if (shouldProcessPolyfillPlugins) {
- extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
+ extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
extractEvents$1(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
extractEvents$3(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
extractEvents(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
}
}
- var mediaEventTypes = ["abort", "canplay", "canplaythrough", "durationchange", "emptied", "encrypted", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting"];
+ var mediaEventTypes = ["abort", "canplay", "canplaythrough", "durationchange", "emptied", "encrypted", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "resize", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting"];
var nonDelegatedEvents = new Set(["cancel", "close", "invalid", "load", "scroll", "toggle"].concat(mediaEventTypes));
function executeDispatch(event, listener, currentTarget) {
var type = event.type || "unknown-event";
@@ -8508,6 +8958,11 @@
processDispatchQueue(dispatchQueue, eventSystemFlags);
}
function listenToNonDelegatedEvent(domEventName, targetElement) {
+ {
+ if (!nonDelegatedEvents.has(domEventName)) {
+ error('Did not expect a listenToNonDelegatedEvent() call for "%s". This is a bug in React. Please file an issue.', domEventName);
+ }
+ }
var isCapturePhaseListener = false;
var listenerSet = getEventListenerSet(targetElement);
var listenerSetKey = getListenerSetKey(domEventName, isCapturePhaseListener);
@@ -8516,42 +8971,37 @@
listenerSet.add(listenerSetKey);
}
}
- var listeningMarker = "_reactListening" + Math.random().toString(36).slice(2);
- function listenToAllSupportedEvents(rootContainerElement) {
+ function listenToNativeEvent(domEventName, isCapturePhaseListener, target) {
{
- if (rootContainerElement[listeningMarker]) {
- return;
+ if (nonDelegatedEvents.has(domEventName) && !isCapturePhaseListener) {
+ error('Did not expect a listenToNativeEvent() call for "%s" in the bubble phase. This is a bug in React. Please file an issue.', domEventName);
}
+ }
+ var eventSystemFlags = 0;
+ if (isCapturePhaseListener) {
+ eventSystemFlags |= IS_CAPTURE_PHASE;
+ }
+ addTrappedEventListener(target, domEventName, eventSystemFlags, isCapturePhaseListener);
+ }
+ var listeningMarker = "_reactListening" + Math.random().toString(36).slice(2);
+ function listenToAllSupportedEvents(rootContainerElement) {
+ if (!rootContainerElement[listeningMarker]) {
rootContainerElement[listeningMarker] = true;
allNativeEvents.forEach(function(domEventName) {
- if (!nonDelegatedEvents.has(domEventName)) {
- listenToNativeEvent(domEventName, false, rootContainerElement, null);
+ if (domEventName !== "selectionchange") {
+ if (!nonDelegatedEvents.has(domEventName)) {
+ listenToNativeEvent(domEventName, false, rootContainerElement);
+ }
+ listenToNativeEvent(domEventName, true, rootContainerElement);
}
- listenToNativeEvent(domEventName, true, rootContainerElement, null);
});
- }
- }
- function listenToNativeEvent(domEventName, isCapturePhaseListener, rootContainerElement, targetElement) {
- var eventSystemFlags = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0;
- var target = rootContainerElement;
- if (domEventName === "selectionchange" && rootContainerElement.nodeType !== DOCUMENT_NODE) {
- target = rootContainerElement.ownerDocument;
- }
- if (targetElement !== null && !isCapturePhaseListener && nonDelegatedEvents.has(domEventName)) {
- if (domEventName !== "scroll") {
- return;
- }
- eventSystemFlags |= IS_NON_DELEGATED;
- target = targetElement;
- }
- var listenerSet = getEventListenerSet(target);
- var listenerSetKey = getListenerSetKey(domEventName, isCapturePhaseListener);
- if (!listenerSet.has(listenerSetKey)) {
- if (isCapturePhaseListener) {
- eventSystemFlags |= IS_CAPTURE_PHASE;
+ var ownerDocument = rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
+ if (ownerDocument !== null) {
+ if (!ownerDocument[listeningMarker]) {
+ ownerDocument[listeningMarker] = true;
+ listenToNativeEvent("selectionchange", false, ownerDocument);
+ }
}
- addTrappedEventListener(target, domEventName, eventSystemFlags, isCapturePhaseListener);
- listenerSet.add(listenerSetKey);
}
}
function addTrappedEventListener(targetContainer, domEventName, eventSystemFlags, isCapturePhaseListener, isDeferredListenerForLegacyFBSupport) {
@@ -8628,7 +9078,7 @@
}
}
}
- batchedEventUpdates(function() {
+ batchedUpdates(function() {
return dispatchEventsForPlugins(domEventName, eventSystemFlags, nativeEvent, ancestorInst);
});
}
@@ -8639,7 +9089,7 @@
currentTarget
};
}
- function accumulateSinglePhaseListeners(targetFiber, reactName, nativeEventType, inCapturePhase, accumulateTargetOnly) {
+ function accumulateSinglePhaseListeners(targetFiber, reactName, nativeEventType, inCapturePhase, accumulateTargetOnly, nativeEvent) {
var captureName = reactName !== null ? reactName + "Capture" : null;
var reactEventName = inCapturePhase ? captureName : reactName;
var listeners = [];
@@ -8780,16 +9230,12 @@
var CHILDREN = "children";
var STYLE = "style";
var HTML$1 = "__html";
- var HTML_NAMESPACE$1 = Namespaces.html;
var warnedUnknownTags;
- var suppressHydrationWarning;
var validatePropertiesInDevelopment;
- var warnForTextDifference;
var warnForPropDifference;
var warnForExtraAttributes;
var warnForInvalidEventListener;
var canDiffStyleForHydrationWarning;
- var normalizeMarkupForTextOrAttribute;
var normalizeHTML;
{
warnedUnknownTags = {
@@ -8811,24 +9257,6 @@
});
};
canDiffStyleForHydrationWarning = canUseDOM2 && !document.documentMode;
- var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
- var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
- normalizeMarkupForTextOrAttribute = function(markup) {
- var markupString = typeof markup === "string" ? markup : "" + markup;
- return markupString.replace(NORMALIZE_NEWLINES_REGEX, "\n").replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, "");
- };
- warnForTextDifference = function(serverText, clientText) {
- if (didWarnInvalidHydration) {
- return;
- }
- var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
- var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
- if (normalizedServerText === normalizedClientText) {
- return;
- }
- didWarnInvalidHydration = true;
- error('Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
- };
warnForPropDifference = function(propName, serverValue, clientValue) {
if (didWarnInvalidHydration) {
return;
@@ -8860,11 +9288,38 @@
}
};
normalizeHTML = function(parent, html) {
- var testElement = parent.namespaceURI === HTML_NAMESPACE$1 ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
+ var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
testElement.innerHTML = html;
return testElement.innerHTML;
};
}
+ var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
+ var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
+ function normalizeMarkupForTextOrAttribute(markup) {
+ {
+ checkHtmlStringCoercion(markup);
+ }
+ var markupString = typeof markup === "string" ? markup : "" + markup;
+ return markupString.replace(NORMALIZE_NEWLINES_REGEX, "\n").replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, "");
+ }
+ function checkForUnmatchedText(serverText, clientText, isConcurrentMode, shouldWarnDev) {
+ var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
+ var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
+ if (normalizedServerText === normalizedClientText) {
+ return;
+ }
+ if (shouldWarnDev) {
+ {
+ if (!didWarnInvalidHydration) {
+ didWarnInvalidHydration = true;
+ error('Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
+ }
+ }
+ }
+ if (isConcurrentMode && enableClientRenderFallbackOnTextMismatch) {
+ throw new Error("Text content does not match server-rendered HTML.");
+ }
+ }
function getOwnerDocumentFromRootContainer(rootContainerElement) {
return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
}
@@ -8938,10 +9393,10 @@
var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement);
var domElement;
var namespaceURI = parentNamespace;
- if (namespaceURI === HTML_NAMESPACE$1) {
+ if (namespaceURI === HTML_NAMESPACE) {
namespaceURI = getIntrinsicNamespace(type);
}
- if (namespaceURI === HTML_NAMESPACE$1) {
+ if (namespaceURI === HTML_NAMESPACE) {
{
isCustomComponentTag = isCustomComponent(type, props);
if (!isCustomComponentTag && type !== type.toLowerCase()) {
@@ -8972,8 +9427,8 @@
domElement = ownerDocument.createElementNS(namespaceURI, type);
}
{
- if (namespaceURI === HTML_NAMESPACE$1) {
- if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === "[object HTMLUnknownElement]" && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) {
+ if (namespaceURI === HTML_NAMESPACE) {
+ if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === "[object HTMLUnknownElement]" && !hasOwnProperty.call(warnedUnknownTags, type)) {
warnedUnknownTags[type] = true;
error("The tag <%s> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.", type);
}
@@ -9031,16 +9486,16 @@
break;
case "option":
validateProps(domElement, rawProps);
- props = getHostProps$1(domElement, rawProps);
+ props = rawProps;
break;
case "select":
initWrapperState$1(domElement, rawProps);
- props = getHostProps$2(domElement, rawProps);
+ props = getHostProps$1(domElement, rawProps);
listenToNonDelegatedEvent("invalid", domElement);
break;
case "textarea":
initWrapperState$2(domElement, rawProps);
- props = getHostProps$3(domElement, rawProps);
+ props = getHostProps$2(domElement, rawProps);
listenToNonDelegatedEvent("invalid", domElement);
break;
default:
@@ -9083,21 +9538,16 @@
nextProps = getHostProps(domElement, nextRawProps);
updatePayload = [];
break;
- case "option":
+ case "select":
lastProps = getHostProps$1(domElement, lastRawProps);
nextProps = getHostProps$1(domElement, nextRawProps);
updatePayload = [];
break;
- case "select":
+ case "textarea":
lastProps = getHostProps$2(domElement, lastRawProps);
nextProps = getHostProps$2(domElement, nextRawProps);
updatePayload = [];
break;
- case "textarea":
- lastProps = getHostProps$3(domElement, lastRawProps);
- nextProps = getHostProps$3(domElement, nextRawProps);
- updatePayload = [];
- break;
default:
lastProps = lastRawProps;
nextProps = nextRawProps;
@@ -9202,8 +9652,6 @@
if (!updatePayload && lastProp !== nextProp) {
updatePayload = [];
}
- } else if (typeof nextProp === "object" && nextProp !== null && nextProp.$$typeof === REACT_OPAQUE_ID_TYPE) {
- nextProp.toString();
} else {
(updatePayload = updatePayload || []).push(propKey, nextProp);
}
@@ -9244,11 +9692,10 @@
return possibleStandardNames[lowerCasedName] || null;
}
}
- function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement) {
+ function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement, isConcurrentMode, shouldWarnDev) {
var isCustomComponentTag;
var extraAttributeNames;
{
- suppressHydrationWarning = rawProps[SUPPRESS_HYDRATION_WARNING] === true;
isCustomComponentTag = isCustomComponent(tag, rawProps);
validatePropertiesInDevelopment(tag, rawProps);
}
@@ -9303,8 +9750,6 @@
for (var _i = 0; _i < attributes.length; _i++) {
var name = attributes[_i].name.toLowerCase();
switch (name) {
- case "data-reactroot":
- break;
case "value":
break;
case "checked":
@@ -9325,15 +9770,15 @@
if (propKey === CHILDREN) {
if (typeof nextProp === "string") {
if (domElement.textContent !== nextProp) {
- if (!suppressHydrationWarning) {
- warnForTextDifference(domElement.textContent, nextProp);
+ if (rawProps[SUPPRESS_HYDRATION_WARNING] !== true) {
+ checkForUnmatchedText(domElement.textContent, nextProp, isConcurrentMode, shouldWarnDev);
}
updatePayload = [CHILDREN, nextProp];
}
} else if (typeof nextProp === "number") {
if (domElement.textContent !== "" + nextProp) {
- if (!suppressHydrationWarning) {
- warnForTextDifference(domElement.textContent, nextProp);
+ if (rawProps[SUPPRESS_HYDRATION_WARNING] !== true) {
+ checkForUnmatchedText(domElement.textContent, nextProp, isConcurrentMode, shouldWarnDev);
}
updatePayload = [CHILDREN, "" + nextProp];
}
@@ -9347,13 +9792,11 @@
listenToNonDelegatedEvent("scroll", domElement);
}
}
- } else if (
- // Convince Flow we've calculated it (it's DEV-only in this method.)
- typeof isCustomComponentTag === "boolean"
- ) {
+ } else if (shouldWarnDev && true && // Convince Flow we've calculated it (it's DEV-only in this method.)
+ typeof isCustomComponentTag === "boolean") {
var serverValue = void 0;
- var propertyInfo = getPropertyInfo(propKey);
- if (suppressHydrationWarning)
+ var propertyInfo = isCustomComponentTag && enableCustomElementPropertySupport ? null : getPropertyInfo(propKey);
+ if (rawProps[SUPPRESS_HYDRATION_WARNING] === true)
;
else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING || // Controlled attributes are not validated
// TODO: Only ignore them on controlled tags.
@@ -9377,7 +9820,7 @@
warnForPropDifference(propKey, serverValue, expectedStyle);
}
}
- } else if (isCustomComponentTag) {
+ } else if (isCustomComponentTag && !enableCustomElementPropertySupport) {
extraAttributeNames.delete(propKey.toLowerCase());
serverValue = getValueForAttribute(domElement, propKey, nextProp);
if (nextProp !== serverValue) {
@@ -9390,10 +9833,10 @@
serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo);
} else {
var ownNamespace = parentNamespace;
- if (ownNamespace === HTML_NAMESPACE$1) {
+ if (ownNamespace === HTML_NAMESPACE) {
ownNamespace = getIntrinsicNamespace(tag);
}
- if (ownNamespace === HTML_NAMESPACE$1) {
+ if (ownNamespace === HTML_NAMESPACE) {
extraAttributeNames.delete(propKey.toLowerCase());
} else {
var standardName = getPossibleStandardName(propKey);
@@ -9405,15 +9848,21 @@
}
serverValue = getValueForAttribute(domElement, propKey, nextProp);
}
- if (nextProp !== serverValue && !isMismatchDueToBadCasing) {
+ var dontWarnCustomElement = enableCustomElementPropertySupport;
+ if (!dontWarnCustomElement && nextProp !== serverValue && !isMismatchDueToBadCasing) {
warnForPropDifference(propKey, serverValue, nextProp);
}
}
}
}
{
- if (extraAttributeNames.size > 0 && !suppressHydrationWarning) {
- warnForExtraAttributes(extraAttributeNames);
+ if (shouldWarnDev) {
+ if (
+ // $FlowFixMe - Should be inferred as not undefined.
+ extraAttributeNames.size > 0 && rawProps[SUPPRESS_HYDRATION_WARNING] !== true
+ ) {
+ warnForExtraAttributes(extraAttributeNames);
+ }
}
}
switch (tag) {
@@ -9436,15 +9885,10 @@
}
return updatePayload;
}
- function diffHydratedText(textNode, text) {
+ function diffHydratedText(textNode, text, isConcurrentMode) {
var isDifferent = textNode.nodeValue !== text;
return isDifferent;
}
- function warnForUnmatchedText(textNode, text) {
- {
- warnForTextDifference(textNode.nodeValue, text);
- }
- }
function warnForDeletedHydratableElement(parentNode, child) {
{
if (didWarnInvalidHydration) {
@@ -9533,7 +9977,7 @@
dlItemTagAutoclosing: null
};
updatedAncestorInfo = function(oldInfo, tag) {
- var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
+ var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
var info = {
tag
};
@@ -9729,10 +10173,7 @@
}
};
}
- var SUPPRESS_HYDRATION_WARNING$1;
- {
- SUPPRESS_HYDRATION_WARNING$1 = "suppressHydrationWarning";
- }
+ var SUPPRESS_HYDRATION_WARNING$1 = "suppressHydrationWarning";
var SUSPENSE_START_DATA = "$";
var SUSPENSE_END_DATA = "/$";
var SUSPENSE_PENDING_START_DATA = "$?";
@@ -9740,16 +10181,6 @@
var STYLE$1 = "style";
var eventsEnabled = null;
var selectionInformation = null;
- function shouldAutoFocusHostComponent(type, props) {
- switch (type) {
- case "button":
- case "input":
- case "select":
- case "textarea":
- return !!props.autoFocus;
- }
- return false;
- }
function getRootHostContext(rootContainerInstance) {
var type;
var namespace;
@@ -9828,7 +10259,17 @@
}
function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) {
setInitialProperties(domElement, type, props, rootContainerInstance);
- return shouldAutoFocusHostComponent(type, props);
+ switch (type) {
+ case "button":
+ case "input":
+ case "select":
+ case "textarea":
+ return !!props.autoFocus;
+ case "img":
+ return true;
+ default:
+ return false;
+ }
}
function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) {
{
@@ -9842,7 +10283,7 @@
return diffProperties(domElement, type, oldProps, newProps);
}
function shouldSetTextContent(type, props) {
- return type === "textarea" || type === "option" || type === "noscript" || typeof props.children === "string" || typeof props.children === "number" || typeof props.dangerouslySetInnerHTML === "object" && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null;
+ return type === "textarea" || type === "noscript" || typeof props.children === "string" || typeof props.children === "number" || typeof props.dangerouslySetInnerHTML === "object" && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null;
}
function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
{
@@ -9853,17 +10294,46 @@
precacheFiberNode(internalInstanceHandle, textNode);
return textNode;
}
+ function getCurrentEventPriority() {
+ var currentEvent = window.event;
+ if (currentEvent === void 0) {
+ return DefaultEventPriority;
+ }
+ return getEventPriority(currentEvent.type);
+ }
var scheduleTimeout = typeof setTimeout === "function" ? setTimeout : void 0;
var cancelTimeout = typeof clearTimeout === "function" ? clearTimeout : void 0;
var noTimeout = -1;
+ var localPromise = typeof Promise === "function" ? Promise : void 0;
+ var scheduleMicrotask = typeof queueMicrotask === "function" ? queueMicrotask : typeof localPromise !== "undefined" ? function(callback) {
+ return localPromise.resolve(null).then(callback).catch(handleErrorInNextTick);
+ } : scheduleTimeout;
+ function handleErrorInNextTick(error2) {
+ setTimeout(function() {
+ throw error2;
+ });
+ }
function commitMount(domElement, type, newProps, internalInstanceHandle) {
- if (shouldAutoFocusHostComponent(type, newProps)) {
- domElement.focus();
+ switch (type) {
+ case "button":
+ case "input":
+ case "select":
+ case "textarea":
+ if (newProps.autoFocus) {
+ domElement.focus();
+ }
+ return;
+ case "img": {
+ if (newProps.src) {
+ domElement.src = newProps.src;
+ }
+ return;
+ }
}
}
function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
- updateFiberProps(domElement, newProps);
updateProperties(domElement, updatePayload, type, oldProps, newProps);
+ updateFiberProps(domElement, newProps);
}
function resetTextContent(domElement) {
setTextContent(domElement, "");
@@ -9908,6 +10378,38 @@
container.removeChild(child);
}
}
+ function clearSuspenseBoundary(parentInstance, suspenseInstance) {
+ var node = suspenseInstance;
+ var depth = 0;
+ do {
+ var nextNode = node.nextSibling;
+ parentInstance.removeChild(node);
+ if (nextNode && nextNode.nodeType === COMMENT_NODE) {
+ var data = nextNode.data;
+ if (data === SUSPENSE_END_DATA) {
+ if (depth === 0) {
+ parentInstance.removeChild(nextNode);
+ retryIfBlockedOn(suspenseInstance);
+ return;
+ } else {
+ depth--;
+ }
+ } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_PENDING_START_DATA || data === SUSPENSE_FALLBACK_START_DATA) {
+ depth++;
+ }
+ }
+ node = nextNode;
+ } while (node);
+ retryIfBlockedOn(suspenseInstance);
+ }
+ function clearSuspenseBoundaryFromContainer(container, suspenseInstance) {
+ if (container.nodeType === COMMENT_NODE) {
+ clearSuspenseBoundary(container.parentNode, suspenseInstance);
+ } else if (container.nodeType === ELEMENT_NODE) {
+ clearSuspenseBoundary(container, suspenseInstance);
+ }
+ retryIfBlockedOn(container);
+ }
function hideInstance(instance) {
instance = instance;
var style2 = instance.style;
@@ -9933,9 +10435,8 @@
if (container.nodeType === ELEMENT_NODE) {
container.textContent = "";
} else if (container.nodeType === DOCUMENT_NODE) {
- var body = container.body;
- if (body != null) {
- body.textContent = "";
+ if (container.documentElement) {
+ container.removeChild(container.documentElement);
}
}
}
@@ -9951,18 +10452,54 @@
}
return instance;
}
+ function canHydrateSuspenseInstance(instance) {
+ if (instance.nodeType !== COMMENT_NODE) {
+ return null;
+ }
+ return instance;
+ }
function isSuspenseInstancePending(instance) {
return instance.data === SUSPENSE_PENDING_START_DATA;
}
function isSuspenseInstanceFallback(instance) {
return instance.data === SUSPENSE_FALLBACK_START_DATA;
}
+ function getSuspenseInstanceFallbackErrorDetails(instance) {
+ var dataset = instance.nextSibling && instance.nextSibling.dataset;
+ var digest, message, stack;
+ if (dataset) {
+ digest = dataset.dgst;
+ {
+ message = dataset.msg;
+ stack = dataset.stck;
+ }
+ }
+ {
+ return {
+ message,
+ digest,
+ stack
+ };
+ }
+ }
+ function registerSuspenseInstanceRetry(instance, callback) {
+ instance._reactRetry = callback;
+ }
function getNextHydratable(node) {
for (; node != null; node = node.nextSibling) {
var nodeType = node.nodeType;
if (nodeType === ELEMENT_NODE || nodeType === TEXT_NODE) {
break;
}
+ if (nodeType === COMMENT_NODE) {
+ var nodeData = node.data;
+ if (nodeData === SUSPENSE_START_DATA || nodeData === SUSPENSE_FALLBACK_START_DATA || nodeData === SUSPENSE_PENDING_START_DATA) {
+ break;
+ }
+ if (nodeData === SUSPENSE_END_DATA) {
+ return null;
+ }
+ }
}
return node;
}
@@ -9972,7 +10509,13 @@
function getFirstHydratableChild(parentInstance) {
return getNextHydratable(parentInstance.firstChild);
}
- function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
+ function getFirstHydratableChildWithinContainer(parentContainer) {
+ return getNextHydratable(parentContainer.firstChild);
+ }
+ function getFirstHydratableChildWithinSuspenseInstance(parentInstance) {
+ return getNextHydratable(parentInstance.nextSibling);
+ }
+ function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle, shouldWarnDev) {
precacheFiberNode(internalInstanceHandle, instance);
updateFiberProps(instance, props);
var parentNamespace;
@@ -9980,12 +10523,17 @@
var hostContextDev = hostContext;
parentNamespace = hostContextDev.namespace;
}
- return diffHydratedProperties(instance, type, props, parentNamespace);
+ var isConcurrentMode = (internalInstanceHandle.mode & ConcurrentMode) !== NoMode;
+ return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance, isConcurrentMode, shouldWarnDev);
}
- function hydrateTextInstance(textInstance, text, internalInstanceHandle) {
+ function hydrateTextInstance(textInstance, text, internalInstanceHandle, shouldWarnDev) {
precacheFiberNode(internalInstanceHandle, textInstance);
+ var isConcurrentMode = (internalInstanceHandle.mode & ConcurrentMode) !== NoMode;
return diffHydratedText(textInstance, text);
}
+ function hydrateSuspenseInstance(suspenseInstance, internalInstanceHandle) {
+ precacheFiberNode(internalInstanceHandle, suspenseInstance);
+ }
function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) {
var node = suspenseInstance.nextSibling;
var depth = 0;
@@ -10032,17 +10580,20 @@
function commitHydratedSuspenseInstance(suspenseInstance) {
retryIfBlockedOn(suspenseInstance);
}
- function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) {
- {
- warnForUnmatchedText(textInstance, text);
- }
+ function shouldDeleteUnhydratedTailInstances(parentType) {
+ return parentType !== "head" && parentType !== "body";
+ }
+ function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text, isConcurrentMode) {
+ var shouldWarnDev = true;
+ checkForUnmatchedText(textInstance.nodeValue, text, isConcurrentMode, shouldWarnDev);
}
- function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text) {
+ function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text, isConcurrentMode) {
if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
- warnForUnmatchedText(textInstance, text);
+ var shouldWarnDev = true;
+ checkForUnmatchedText(textInstance.nodeValue, text, isConcurrentMode, shouldWarnDev);
}
}
- function didNotHydrateContainerInstance(parentContainer, instance) {
+ function didNotHydrateInstanceWithinContainer(parentContainer, instance) {
{
if (instance.nodeType === ELEMENT_NODE) {
warnForDeletedHydratableElement(parentContainer, instance);
@@ -10053,75 +10604,93 @@
}
}
}
- function didNotHydrateInstance(parentType, parentProps, parentInstance, instance) {
- if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
- if (instance.nodeType === ELEMENT_NODE) {
- warnForDeletedHydratableElement(parentInstance, instance);
- } else if (instance.nodeType === COMMENT_NODE)
- ;
- else {
- warnForDeletedHydratableText(parentInstance, instance);
+ function didNotHydrateInstanceWithinSuspenseInstance(parentInstance, instance) {
+ {
+ var parentNode = parentInstance.parentNode;
+ if (parentNode !== null) {
+ if (instance.nodeType === ELEMENT_NODE) {
+ warnForDeletedHydratableElement(parentNode, instance);
+ } else if (instance.nodeType === COMMENT_NODE)
+ ;
+ else {
+ warnForDeletedHydratableText(parentNode, instance);
+ }
+ }
+ }
+ }
+ function didNotHydrateInstance(parentType, parentProps, parentInstance, instance, isConcurrentMode) {
+ {
+ if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
+ if (instance.nodeType === ELEMENT_NODE) {
+ warnForDeletedHydratableElement(parentInstance, instance);
+ } else if (instance.nodeType === COMMENT_NODE)
+ ;
+ else {
+ warnForDeletedHydratableText(parentInstance, instance);
+ }
}
}
}
- function didNotFindHydratableContainerInstance(parentContainer, type, props) {
+ function didNotFindHydratableInstanceWithinContainer(parentContainer, type, props) {
{
warnForInsertedHydratedElement(parentContainer, type);
}
}
- function didNotFindHydratableContainerTextInstance(parentContainer, text) {
+ function didNotFindHydratableTextInstanceWithinContainer(parentContainer, text) {
{
warnForInsertedHydratedText(parentContainer, text);
}
}
- function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) {
- if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
- warnForInsertedHydratedElement(parentInstance, type);
+ function didNotFindHydratableInstanceWithinSuspenseInstance(parentInstance, type, props) {
+ {
+ var parentNode = parentInstance.parentNode;
+ if (parentNode !== null)
+ warnForInsertedHydratedElement(parentNode, type);
}
}
- function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text) {
- if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
- warnForInsertedHydratedText(parentInstance, text);
+ function didNotFindHydratableTextInstanceWithinSuspenseInstance(parentInstance, text) {
+ {
+ var parentNode = parentInstance.parentNode;
+ if (parentNode !== null)
+ warnForInsertedHydratedText(parentNode, text);
}
}
- function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) {
- if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true)
- ;
- }
- var clientId = 0;
- function makeClientIdInDEV(warnOnAccessInDEV) {
- var id = "r:" + (clientId++).toString(36);
- return {
- toString: function() {
- warnOnAccessInDEV();
- return id;
- },
- valueOf: function() {
- warnOnAccessInDEV();
- return id;
+ function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props, isConcurrentMode) {
+ {
+ if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
+ warnForInsertedHydratedElement(parentInstance, type);
}
- };
- }
- function isOpaqueHydratingObject(value) {
- return value !== null && typeof value === "object" && value.$$typeof === REACT_OPAQUE_ID_TYPE;
+ }
}
- function makeOpaqueHydratingObject(attemptToReadValue) {
- return {
- $$typeof: REACT_OPAQUE_ID_TYPE,
- toString: attemptToReadValue,
- valueOf: attemptToReadValue
- };
+ function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text, isConcurrentMode) {
+ {
+ if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
+ warnForInsertedHydratedText(parentInstance, text);
+ }
+ }
}
- function preparePortalMount(portalInstance) {
+ function errorHydratingContainer(parentContainer) {
{
- listenToAllSupportedEvents(portalInstance);
+ error("An error occurred during hydration. The server HTML was replaced with client content in <%s>.", parentContainer.nodeName.toLowerCase());
}
}
+ function preparePortalMount(portalInstance) {
+ listenToAllSupportedEvents(portalInstance);
+ }
var randomKey = Math.random().toString(36).slice(2);
var internalInstanceKey = "__reactFiber$" + randomKey;
var internalPropsKey = "__reactProps$" + randomKey;
var internalContainerInstanceKey = "__reactContainer$" + randomKey;
var internalEventHandlersKey = "__reactEvents$" + randomKey;
+ var internalEventHandlerListenersKey = "__reactListeners$" + randomKey;
+ var internalEventHandlesSetKey = "__reactHandles$" + randomKey;
+ function detachDeletedInstance(node) {
+ delete node[internalInstanceKey];
+ delete node[internalPropsKey];
+ delete node[internalEventHandlersKey];
+ delete node[internalEventHandlerListenersKey];
+ delete node[internalEventHandlesSetKey];
+ }
function precacheFiberNode(hostInst, node) {
node[internalInstanceKey] = hostInst;
}
@@ -10176,11 +10745,7 @@
if (inst.tag === HostComponent || inst.tag === HostText) {
return inst.stateNode;
}
- {
- {
- throw Error("getNodeFromInstance: Invalid argument.");
- }
- }
+ throw new Error("getNodeFromInstance: Invalid argument.");
}
function getFiberCurrentPropsFromNode(node) {
return node[internalPropsKey] || null;
@@ -10210,7 +10775,7 @@
}
function checkPropTypes(typeSpecs, values, location, componentName, element) {
{
- var has2 = Function.call.bind(Object.prototype.hasOwnProperty);
+ var has2 = Function.call.bind(hasOwnProperty);
for (var typeSpecName in typeSpecs) {
if (has2(typeSpecs, typeSpecName)) {
var error$1 = void 0;
@@ -10319,7 +10884,7 @@
context[key] = unmaskedContext[key];
}
{
- var name = getComponentName(type) || "Unknown";
+ var name = getComponentNameFromFiber(workInProgress2) || "Unknown";
checkPropTypes(contextTypes, context, "context", name);
}
if (instance) {
@@ -10353,10 +10918,8 @@
}
function pushTopLevelContextObject(fiber, context, didChange) {
{
- if (!(contextStackCursor.current === emptyContextObject)) {
- {
- throw Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");
- }
+ if (contextStackCursor.current !== emptyContextObject) {
+ throw new Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");
}
push(contextStackCursor, context, fiber);
push(didPerformWorkStackCursor, didChange, fiber);
@@ -10368,7 +10931,7 @@
var childContextTypes = type.childContextTypes;
if (typeof instance.getChildContext !== "function") {
{
- var componentName = getComponentName(type) || "Unknown";
+ var componentName = getComponentNameFromFiber(fiber) || "Unknown";
if (!warnedAboutMissingGetChildContext[componentName]) {
warnedAboutMissingGetChildContext[componentName] = true;
error("%s.childContextTypes is specified but there is no getChildContext() method on the instance. You can either define getChildContext() on %s or remove childContextTypes from it.", componentName, componentName);
@@ -10379,16 +10942,14 @@
var childContext = instance.getChildContext();
for (var contextKey in childContext) {
if (!(contextKey in childContextTypes)) {
- {
- throw Error((getComponentName(type) || "Unknown") + '.getChildContext(): key "' + contextKey + '" is not defined in childContextTypes.');
- }
+ throw new Error((getComponentNameFromFiber(fiber) || "Unknown") + '.getChildContext(): key "' + contextKey + '" is not defined in childContextTypes.');
}
}
{
- var name = getComponentName(type) || "Unknown";
+ var name = getComponentNameFromFiber(fiber) || "Unknown";
checkPropTypes(childContextTypes, childContext, "child context", name);
}
- return _assign({}, parentContext, childContext);
+ return assign({}, parentContext, childContext);
}
}
function pushContextProvider(workInProgress2) {
@@ -10405,9 +10966,7 @@
{
var instance = workInProgress2.stateNode;
if (!instance) {
- {
- throw Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");
- }
+ throw new Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");
}
if (didChange) {
var mergedContext = processChildContext(workInProgress2, type, previousContext);
@@ -10424,10 +10983,8 @@
}
function findCurrentUnmaskedContext(fiber) {
{
- if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) {
- {
- throw Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.");
- }
+ if (!isFiberMounted(fiber) || fiber.tag !== ClassComponent) {
+ throw new Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.");
}
var node = fiber;
do {
@@ -10444,227 +11001,573 @@
}
node = node.return;
} while (node !== null);
- {
- {
- throw Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.");
- }
- }
+ throw new Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.");
}
}
var LegacyRoot = 0;
- var BlockingRoot = 1;
- var ConcurrentRoot = 2;
- var rendererID = null;
- var injectedHook = null;
- var hasLoggedError = false;
- var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined";
- function injectInternals(internals) {
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined") {
- return false;
+ var ConcurrentRoot = 1;
+ var syncQueue = null;
+ var includesLegacySyncCallbacks = false;
+ var isFlushingSyncQueue = false;
+ function scheduleSyncCallback(callback) {
+ if (syncQueue === null) {
+ syncQueue = [callback];
+ } else {
+ syncQueue.push(callback);
}
- var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
- if (hook.isDisabled) {
- return true;
+ }
+ function scheduleLegacySyncCallback(callback) {
+ includesLegacySyncCallbacks = true;
+ scheduleSyncCallback(callback);
+ }
+ function flushSyncCallbacksOnlyInLegacyMode() {
+ if (includesLegacySyncCallbacks) {
+ flushSyncCallbacks();
}
- if (!hook.supportsFiber) {
- {
- error("The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://reactjs.org/link/react-devtools");
+ }
+ function flushSyncCallbacks() {
+ if (!isFlushingSyncQueue && syncQueue !== null) {
+ isFlushingSyncQueue = true;
+ var i = 0;
+ var previousUpdatePriority = getCurrentUpdatePriority();
+ try {
+ var isSync = true;
+ var queue = syncQueue;
+ setCurrentUpdatePriority(DiscreteEventPriority);
+ for (; i < queue.length; i++) {
+ var callback = queue[i];
+ do {
+ callback = callback(isSync);
+ } while (callback !== null);
+ }
+ syncQueue = null;
+ includesLegacySyncCallbacks = false;
+ } catch (error2) {
+ if (syncQueue !== null) {
+ syncQueue = syncQueue.slice(i + 1);
+ }
+ scheduleCallback(ImmediatePriority, flushSyncCallbacks);
+ throw error2;
+ } finally {
+ setCurrentUpdatePriority(previousUpdatePriority);
+ isFlushingSyncQueue = false;
}
- return true;
}
- try {
- rendererID = hook.inject(internals);
- injectedHook = hook;
- } catch (err) {
- {
- error("React instrumentation encountered an error: %s.", err);
+ return null;
+ }
+ var forkStack = [];
+ var forkStackIndex = 0;
+ var treeForkProvider = null;
+ var treeForkCount = 0;
+ var idStack = [];
+ var idStackIndex = 0;
+ var treeContextProvider = null;
+ var treeContextId = 1;
+ var treeContextOverflow = "";
+ function isForkedChild(workInProgress2) {
+ warnIfNotHydrating();
+ return (workInProgress2.flags & Forked) !== NoFlags;
+ }
+ function getForksAtLevel(workInProgress2) {
+ warnIfNotHydrating();
+ return treeForkCount;
+ }
+ function getTreeId() {
+ var overflow = treeContextOverflow;
+ var idWithLeadingBit = treeContextId;
+ var id = idWithLeadingBit & ~getLeadingBit(idWithLeadingBit);
+ return id.toString(32) + overflow;
+ }
+ function pushTreeFork(workInProgress2, totalChildren) {
+ warnIfNotHydrating();
+ forkStack[forkStackIndex++] = treeForkCount;
+ forkStack[forkStackIndex++] = treeForkProvider;
+ treeForkProvider = workInProgress2;
+ treeForkCount = totalChildren;
+ }
+ function pushTreeId(workInProgress2, totalChildren, index2) {
+ warnIfNotHydrating();
+ idStack[idStackIndex++] = treeContextId;
+ idStack[idStackIndex++] = treeContextOverflow;
+ idStack[idStackIndex++] = treeContextProvider;
+ treeContextProvider = workInProgress2;
+ var baseIdWithLeadingBit = treeContextId;
+ var baseOverflow = treeContextOverflow;
+ var baseLength = getBitLength(baseIdWithLeadingBit) - 1;
+ var baseId = baseIdWithLeadingBit & ~(1 << baseLength);
+ var slot = index2 + 1;
+ var length = getBitLength(totalChildren) + baseLength;
+ if (length > 30) {
+ var numberOfOverflowBits = baseLength - baseLength % 5;
+ var newOverflowBits = (1 << numberOfOverflowBits) - 1;
+ var newOverflow = (baseId & newOverflowBits).toString(32);
+ var restOfBaseId = baseId >> numberOfOverflowBits;
+ var restOfBaseLength = baseLength - numberOfOverflowBits;
+ var restOfLength = getBitLength(totalChildren) + restOfBaseLength;
+ var restOfNewBits = slot << restOfBaseLength;
+ var id = restOfNewBits | restOfBaseId;
+ var overflow = newOverflow + baseOverflow;
+ treeContextId = 1 << restOfLength | id;
+ treeContextOverflow = overflow;
+ } else {
+ var newBits = slot << baseLength;
+ var _id = newBits | baseId;
+ var _overflow = baseOverflow;
+ treeContextId = 1 << length | _id;
+ treeContextOverflow = _overflow;
+ }
+ }
+ function pushMaterializedTreeId(workInProgress2) {
+ warnIfNotHydrating();
+ var returnFiber = workInProgress2.return;
+ if (returnFiber !== null) {
+ var numberOfForks = 1;
+ var slotIndex = 0;
+ pushTreeFork(workInProgress2, numberOfForks);
+ pushTreeId(workInProgress2, numberOfForks, slotIndex);
+ }
+ }
+ function getBitLength(number) {
+ return 32 - clz32(number);
+ }
+ function getLeadingBit(id) {
+ return 1 << getBitLength(id) - 1;
+ }
+ function popTreeContext(workInProgress2) {
+ while (workInProgress2 === treeForkProvider) {
+ treeForkProvider = forkStack[--forkStackIndex];
+ forkStack[forkStackIndex] = null;
+ treeForkCount = forkStack[--forkStackIndex];
+ forkStack[forkStackIndex] = null;
+ }
+ while (workInProgress2 === treeContextProvider) {
+ treeContextProvider = idStack[--idStackIndex];
+ idStack[idStackIndex] = null;
+ treeContextOverflow = idStack[--idStackIndex];
+ idStack[idStackIndex] = null;
+ treeContextId = idStack[--idStackIndex];
+ idStack[idStackIndex] = null;
+ }
+ }
+ function getSuspendedTreeContext() {
+ warnIfNotHydrating();
+ if (treeContextProvider !== null) {
+ return {
+ id: treeContextId,
+ overflow: treeContextOverflow
+ };
+ } else {
+ return null;
+ }
+ }
+ function restoreSuspendedTreeContext(workInProgress2, suspendedContext) {
+ warnIfNotHydrating();
+ idStack[idStackIndex++] = treeContextId;
+ idStack[idStackIndex++] = treeContextOverflow;
+ idStack[idStackIndex++] = treeContextProvider;
+ treeContextId = suspendedContext.id;
+ treeContextOverflow = suspendedContext.overflow;
+ treeContextProvider = workInProgress2;
+ }
+ function warnIfNotHydrating() {
+ {
+ if (!getIsHydrating()) {
+ error("Expected to be hydrating. This is a bug in React. Please file an issue.");
+ }
+ }
+ }
+ var hydrationParentFiber = null;
+ var nextHydratableInstance = null;
+ var isHydrating = false;
+ var didSuspendOrErrorDEV = false;
+ var hydrationErrors = null;
+ function warnIfHydrating() {
+ {
+ if (isHydrating) {
+ error("We should not be hydrating here. This is a bug in React. Please file a bug.");
}
}
+ }
+ function markDidThrowWhileHydratingDEV() {
+ {
+ didSuspendOrErrorDEV = true;
+ }
+ }
+ function didSuspendOrErrorWhileHydratingDEV() {
+ {
+ return didSuspendOrErrorDEV;
+ }
+ }
+ function enterHydrationState(fiber) {
+ var parentInstance = fiber.stateNode.containerInfo;
+ nextHydratableInstance = getFirstHydratableChildWithinContainer(parentInstance);
+ hydrationParentFiber = fiber;
+ isHydrating = true;
+ hydrationErrors = null;
+ didSuspendOrErrorDEV = false;
return true;
}
- function onScheduleRoot(root2, children) {
+ function reenterHydrationStateFromDehydratedSuspenseInstance(fiber, suspenseInstance, treeContext) {
+ nextHydratableInstance = getFirstHydratableChildWithinSuspenseInstance(suspenseInstance);
+ hydrationParentFiber = fiber;
+ isHydrating = true;
+ hydrationErrors = null;
+ didSuspendOrErrorDEV = false;
+ if (treeContext !== null) {
+ restoreSuspendedTreeContext(fiber, treeContext);
+ }
+ return true;
+ }
+ function warnUnhydratedInstance(returnFiber, instance) {
{
- if (injectedHook && typeof injectedHook.onScheduleFiberRoot === "function") {
- try {
- injectedHook.onScheduleFiberRoot(rendererID, root2, children);
- } catch (err) {
- if (!hasLoggedError) {
- hasLoggedError = true;
- error("React instrumentation encountered an error: %s", err);
- }
+ switch (returnFiber.tag) {
+ case HostRoot: {
+ didNotHydrateInstanceWithinContainer(returnFiber.stateNode.containerInfo, instance);
+ break;
+ }
+ case HostComponent: {
+ var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode;
+ didNotHydrateInstance(
+ returnFiber.type,
+ returnFiber.memoizedProps,
+ returnFiber.stateNode,
+ instance,
+ // TODO: Delete this argument when we remove the legacy root API.
+ isConcurrentMode
+ );
+ break;
+ }
+ case SuspenseComponent: {
+ var suspenseState = returnFiber.memoizedState;
+ if (suspenseState.dehydrated !== null)
+ didNotHydrateInstanceWithinSuspenseInstance(suspenseState.dehydrated, instance);
+ break;
}
}
}
}
- function onCommitRoot(root2, priorityLevel) {
- if (injectedHook && typeof injectedHook.onCommitFiberRoot === "function") {
- try {
- var didError = (root2.current.flags & DidCapture) === DidCapture;
- if (enableProfilerTimer) {
- injectedHook.onCommitFiberRoot(rendererID, root2, priorityLevel, didError);
- } else {
- injectedHook.onCommitFiberRoot(rendererID, root2, void 0, didError);
+ function deleteHydratableInstance(returnFiber, instance) {
+ warnUnhydratedInstance(returnFiber, instance);
+ var childToDelete = createFiberFromHostInstanceForDeletion();
+ childToDelete.stateNode = instance;
+ childToDelete.return = returnFiber;
+ var deletions = returnFiber.deletions;
+ if (deletions === null) {
+ returnFiber.deletions = [childToDelete];
+ returnFiber.flags |= ChildDeletion;
+ } else {
+ deletions.push(childToDelete);
+ }
+ }
+ function warnNonhydratedInstance(returnFiber, fiber) {
+ {
+ if (didSuspendOrErrorDEV) {
+ return;
+ }
+ switch (returnFiber.tag) {
+ case HostRoot: {
+ var parentContainer = returnFiber.stateNode.containerInfo;
+ switch (fiber.tag) {
+ case HostComponent:
+ var type = fiber.type;
+ var props = fiber.pendingProps;
+ didNotFindHydratableInstanceWithinContainer(parentContainer, type);
+ break;
+ case HostText:
+ var text = fiber.pendingProps;
+ didNotFindHydratableTextInstanceWithinContainer(parentContainer, text);
+ break;
+ }
+ break;
}
- } catch (err) {
- {
- if (!hasLoggedError) {
- hasLoggedError = true;
- error("React instrumentation encountered an error: %s", err);
+ case HostComponent: {
+ var parentType = returnFiber.type;
+ var parentProps = returnFiber.memoizedProps;
+ var parentInstance = returnFiber.stateNode;
+ switch (fiber.tag) {
+ case HostComponent: {
+ var _type = fiber.type;
+ var _props = fiber.pendingProps;
+ var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode;
+ didNotFindHydratableInstance(
+ parentType,
+ parentProps,
+ parentInstance,
+ _type,
+ _props,
+ // TODO: Delete this argument when we remove the legacy root API.
+ isConcurrentMode
+ );
+ break;
+ }
+ case HostText: {
+ var _text = fiber.pendingProps;
+ var _isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode;
+ didNotFindHydratableTextInstance(
+ parentType,
+ parentProps,
+ parentInstance,
+ _text,
+ // TODO: Delete this argument when we remove the legacy root API.
+ _isConcurrentMode
+ );
+ break;
+ }
}
+ break;
}
+ case SuspenseComponent: {
+ var suspenseState = returnFiber.memoizedState;
+ var _parentInstance = suspenseState.dehydrated;
+ if (_parentInstance !== null)
+ switch (fiber.tag) {
+ case HostComponent:
+ var _type2 = fiber.type;
+ var _props2 = fiber.pendingProps;
+ didNotFindHydratableInstanceWithinSuspenseInstance(_parentInstance, _type2);
+ break;
+ case HostText:
+ var _text2 = fiber.pendingProps;
+ didNotFindHydratableTextInstanceWithinSuspenseInstance(_parentInstance, _text2);
+ break;
+ }
+ break;
+ }
+ default:
+ return;
}
}
}
- function onCommitUnmount(fiber) {
- if (injectedHook && typeof injectedHook.onCommitFiberUnmount === "function") {
- try {
- injectedHook.onCommitFiberUnmount(rendererID, fiber);
- } catch (err) {
- {
- if (!hasLoggedError) {
- hasLoggedError = true;
- error("React instrumentation encountered an error: %s", err);
- }
+ function insertNonHydratedInstance(returnFiber, fiber) {
+ fiber.flags = fiber.flags & ~Hydrating | Placement;
+ warnNonhydratedInstance(returnFiber, fiber);
+ }
+ function tryHydrate(fiber, nextInstance) {
+ switch (fiber.tag) {
+ case HostComponent: {
+ var type = fiber.type;
+ var props = fiber.pendingProps;
+ var instance = canHydrateInstance(nextInstance, type);
+ if (instance !== null) {
+ fiber.stateNode = instance;
+ hydrationParentFiber = fiber;
+ nextHydratableInstance = getFirstHydratableChild(instance);
+ return true;
}
+ return false;
}
+ case HostText: {
+ var text = fiber.pendingProps;
+ var textInstance = canHydrateTextInstance(nextInstance, text);
+ if (textInstance !== null) {
+ fiber.stateNode = textInstance;
+ hydrationParentFiber = fiber;
+ nextHydratableInstance = null;
+ return true;
+ }
+ return false;
+ }
+ case SuspenseComponent: {
+ var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
+ if (suspenseInstance !== null) {
+ var suspenseState = {
+ dehydrated: suspenseInstance,
+ treeContext: getSuspendedTreeContext(),
+ retryLane: OffscreenLane
+ };
+ fiber.memoizedState = suspenseState;
+ var dehydratedFragment = createFiberFromDehydratedFragment(suspenseInstance);
+ dehydratedFragment.return = fiber;
+ fiber.child = dehydratedFragment;
+ hydrationParentFiber = fiber;
+ nextHydratableInstance = null;
+ return true;
+ }
+ return false;
+ }
+ default:
+ return false;
}
}
- var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, Scheduler_shouldYield = Scheduler.unstable_shouldYield, Scheduler_requestPaint = Scheduler.unstable_requestPaint, Scheduler_now$1 = Scheduler.unstable_now, Scheduler_getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel, Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, Scheduler_LowPriority = Scheduler.unstable_LowPriority, Scheduler_IdlePriority = Scheduler.unstable_IdlePriority;
- {
- if (!(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null)) {
- {
- throw Error("It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling");
+ function shouldClientRenderOnMismatch(fiber) {
+ return (fiber.mode & ConcurrentMode) !== NoMode && (fiber.flags & DidCapture) === NoFlags;
+ }
+ function throwOnHydrationMismatch(fiber) {
+ throw new Error("Hydration failed because the initial UI does not match what was rendered on the server.");
+ }
+ function tryToClaimNextHydratableInstance(fiber) {
+ if (!isHydrating) {
+ return;
+ }
+ var nextInstance = nextHydratableInstance;
+ if (!nextInstance) {
+ if (shouldClientRenderOnMismatch(fiber)) {
+ warnNonhydratedInstance(hydrationParentFiber, fiber);
+ throwOnHydrationMismatch();
}
+ insertNonHydratedInstance(hydrationParentFiber, fiber);
+ isHydrating = false;
+ hydrationParentFiber = fiber;
+ return;
+ }
+ var firstAttemptedInstance = nextInstance;
+ if (!tryHydrate(fiber, nextInstance)) {
+ if (shouldClientRenderOnMismatch(fiber)) {
+ warnNonhydratedInstance(hydrationParentFiber, fiber);
+ throwOnHydrationMismatch();
+ }
+ nextInstance = getNextHydratableSibling(firstAttemptedInstance);
+ var prevHydrationParentFiber = hydrationParentFiber;
+ if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
+ insertNonHydratedInstance(hydrationParentFiber, fiber);
+ isHydrating = false;
+ hydrationParentFiber = fiber;
+ return;
+ }
+ deleteHydratableInstance(prevHydrationParentFiber, firstAttemptedInstance);
}
}
- var fakeCallbackNode = {};
- var ImmediatePriority$1 = 99;
- var UserBlockingPriority$2 = 98;
- var NormalPriority$1 = 97;
- var LowPriority$1 = 96;
- var IdlePriority$1 = 95;
- var NoPriority$1 = 90;
- var shouldYield = Scheduler_shouldYield;
- var requestPaint = (
- // Fall back gracefully if we're running an older version of Scheduler.
- Scheduler_requestPaint !== void 0 ? Scheduler_requestPaint : function() {
+ function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
+ var instance = fiber.stateNode;
+ var shouldWarnIfMismatchDev = !didSuspendOrErrorDEV;
+ var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber, shouldWarnIfMismatchDev);
+ fiber.updateQueue = updatePayload;
+ if (updatePayload !== null) {
+ return true;
}
- );
- var syncQueue = null;
- var immediateQueueCallbackNode = null;
- var isFlushingSyncQueue = false;
- var initialTimeMs$1 = Scheduler_now$1();
- var now = initialTimeMs$1 < 1e4 ? Scheduler_now$1 : function() {
- return Scheduler_now$1() - initialTimeMs$1;
- };
- function getCurrentPriorityLevel() {
- switch (Scheduler_getCurrentPriorityLevel()) {
- case Scheduler_ImmediatePriority:
- return ImmediatePriority$1;
- case Scheduler_UserBlockingPriority:
- return UserBlockingPriority$2;
- case Scheduler_NormalPriority:
- return NormalPriority$1;
- case Scheduler_LowPriority:
- return LowPriority$1;
- case Scheduler_IdlePriority:
- return IdlePriority$1;
- default: {
- {
- throw Error("Unknown priority level.");
+ return false;
+ }
+ function prepareToHydrateHostTextInstance(fiber) {
+ var textInstance = fiber.stateNode;
+ var textContent = fiber.memoizedProps;
+ var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
+ if (shouldUpdate) {
+ var returnFiber = hydrationParentFiber;
+ if (returnFiber !== null) {
+ switch (returnFiber.tag) {
+ case HostRoot: {
+ var parentContainer = returnFiber.stateNode.containerInfo;
+ var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode;
+ didNotMatchHydratedContainerTextInstance(
+ parentContainer,
+ textInstance,
+ textContent,
+ // TODO: Delete this argument when we remove the legacy root API.
+ isConcurrentMode
+ );
+ break;
+ }
+ case HostComponent: {
+ var parentType = returnFiber.type;
+ var parentProps = returnFiber.memoizedProps;
+ var parentInstance = returnFiber.stateNode;
+ var _isConcurrentMode2 = (returnFiber.mode & ConcurrentMode) !== NoMode;
+ didNotMatchHydratedTextInstance(
+ parentType,
+ parentProps,
+ parentInstance,
+ textInstance,
+ textContent,
+ // TODO: Delete this argument when we remove the legacy root API.
+ _isConcurrentMode2
+ );
+ break;
+ }
}
}
}
+ return shouldUpdate;
}
- function reactPriorityToSchedulerPriority(reactPriorityLevel) {
- switch (reactPriorityLevel) {
- case ImmediatePriority$1:
- return Scheduler_ImmediatePriority;
- case UserBlockingPriority$2:
- return Scheduler_UserBlockingPriority;
- case NormalPriority$1:
- return Scheduler_NormalPriority;
- case LowPriority$1:
- return Scheduler_LowPriority;
- case IdlePriority$1:
- return Scheduler_IdlePriority;
- default: {
- {
- throw Error("Unknown priority level.");
- }
- }
+ function prepareToHydrateHostSuspenseInstance(fiber) {
+ var suspenseState = fiber.memoizedState;
+ var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
+ if (!suspenseInstance) {
+ throw new Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
}
+ hydrateSuspenseInstance(suspenseInstance, fiber);
}
- function runWithPriority$1(reactPriorityLevel, fn) {
- var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
- return Scheduler_runWithPriority(priorityLevel, fn);
+ function skipPastDehydratedSuspenseInstance(fiber) {
+ var suspenseState = fiber.memoizedState;
+ var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
+ if (!suspenseInstance) {
+ throw new Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
+ }
+ return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
}
- function scheduleCallback(reactPriorityLevel, callback, options2) {
- var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
- return Scheduler_scheduleCallback(priorityLevel, callback, options2);
+ function popToNextHostParent(fiber) {
+ var parent = fiber.return;
+ while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== SuspenseComponent) {
+ parent = parent.return;
+ }
+ hydrationParentFiber = parent;
}
- function scheduleSyncCallback(callback) {
- if (syncQueue === null) {
- syncQueue = [callback];
- immediateQueueCallbackNode = Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueueImpl);
+ function popHydrationState(fiber) {
+ if (fiber !== hydrationParentFiber) {
+ return false;
+ }
+ if (!isHydrating) {
+ popToNextHostParent(fiber);
+ isHydrating = true;
+ return false;
+ }
+ if (fiber.tag !== HostRoot && (fiber.tag !== HostComponent || shouldDeleteUnhydratedTailInstances(fiber.type) && !shouldSetTextContent(fiber.type, fiber.memoizedProps))) {
+ var nextInstance = nextHydratableInstance;
+ if (nextInstance) {
+ if (shouldClientRenderOnMismatch(fiber)) {
+ warnIfUnhydratedTailNodes(fiber);
+ throwOnHydrationMismatch();
+ } else {
+ while (nextInstance) {
+ deleteHydratableInstance(fiber, nextInstance);
+ nextInstance = getNextHydratableSibling(nextInstance);
+ }
+ }
+ }
+ }
+ popToNextHostParent(fiber);
+ if (fiber.tag === SuspenseComponent) {
+ nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber);
} else {
- syncQueue.push(callback);
+ nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
}
- return fakeCallbackNode;
+ return true;
+ }
+ function hasUnhydratedTailNodes() {
+ return isHydrating && nextHydratableInstance !== null;
}
- function cancelCallback(callbackNode) {
- if (callbackNode !== fakeCallbackNode) {
- Scheduler_cancelCallback(callbackNode);
+ function warnIfUnhydratedTailNodes(fiber) {
+ var nextInstance = nextHydratableInstance;
+ while (nextInstance) {
+ warnUnhydratedInstance(fiber, nextInstance);
+ nextInstance = getNextHydratableSibling(nextInstance);
}
}
- function flushSyncCallbackQueue() {
- if (immediateQueueCallbackNode !== null) {
- var node = immediateQueueCallbackNode;
- immediateQueueCallbackNode = null;
- Scheduler_cancelCallback(node);
+ function resetHydrationState() {
+ hydrationParentFiber = null;
+ nextHydratableInstance = null;
+ isHydrating = false;
+ didSuspendOrErrorDEV = false;
+ }
+ function upgradeHydrationErrorsToRecoverable() {
+ if (hydrationErrors !== null) {
+ queueRecoverableErrors(hydrationErrors);
+ hydrationErrors = null;
}
- flushSyncCallbackQueueImpl();
}
- function flushSyncCallbackQueueImpl() {
- if (!isFlushingSyncQueue && syncQueue !== null) {
- isFlushingSyncQueue = true;
- var i = 0;
- {
- try {
- var _isSync2 = true;
- var _queue = syncQueue;
- runWithPriority$1(ImmediatePriority$1, function() {
- for (; i < _queue.length; i++) {
- var callback = _queue[i];
- do {
- callback = callback(_isSync2);
- } while (callback !== null);
- }
- });
- syncQueue = null;
- } catch (error2) {
- if (syncQueue !== null) {
- syncQueue = syncQueue.slice(i + 1);
- }
- Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueue);
- throw error2;
- } finally {
- isFlushingSyncQueue = false;
- }
- }
+ function getIsHydrating() {
+ return isHydrating;
+ }
+ function queueHydrationError(error2) {
+ if (hydrationErrors === null) {
+ hydrationErrors = [error2];
+ } else {
+ hydrationErrors.push(error2);
}
}
- var ReactVersion = "17.0.2";
- var NoMode = 0;
- var StrictMode = 1;
- var BlockingMode = 2;
- var ConcurrentMode = 4;
- var ProfileMode = 8;
- var DebugTracingMode = 16;
- var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
- var NoTransition = 0;
+ var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig;
+ var NoTransition = null;
function requestCurrentTransition() {
- return ReactCurrentBatchConfig.transition;
+ return ReactCurrentBatchConfig$1.transition;
}
var ReactStrictModeWarnings = {
recordUnsafeLifecycleWarnings: function(fiber, instance) {
@@ -10683,7 +11586,7 @@
var maybeStrictRoot = null;
var node = fiber;
while (node !== null) {
- if (node.mode & StrictMode) {
+ if (node.mode & StrictLegacyMode) {
maybeStrictRoot = node;
}
node = node.return;
@@ -10712,19 +11615,19 @@
instance.componentWillMount.__suppressDeprecationWarning !== true) {
pendingComponentWillMountWarnings.push(fiber);
}
- if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillMount === "function") {
+ if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillMount === "function") {
pendingUNSAFE_ComponentWillMountWarnings.push(fiber);
}
if (typeof instance.componentWillReceiveProps === "function" && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
pendingComponentWillReceivePropsWarnings.push(fiber);
}
- if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillReceiveProps === "function") {
+ if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillReceiveProps === "function") {
pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber);
}
if (typeof instance.componentWillUpdate === "function" && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
pendingComponentWillUpdateWarnings.push(fiber);
}
- if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillUpdate === "function") {
+ if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillUpdate === "function") {
pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber);
}
};
@@ -10732,7 +11635,7 @@
var componentWillMountUniqueNames = /* @__PURE__ */ new Set();
if (pendingComponentWillMountWarnings.length > 0) {
pendingComponentWillMountWarnings.forEach(function(fiber) {
- componentWillMountUniqueNames.add(getComponentName(fiber.type) || "Component");
+ componentWillMountUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
didWarnAboutUnsafeLifecycles.add(fiber.type);
});
pendingComponentWillMountWarnings = [];
@@ -10740,7 +11643,7 @@
var UNSAFE_componentWillMountUniqueNames = /* @__PURE__ */ new Set();
if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) {
pendingUNSAFE_ComponentWillMountWarnings.forEach(function(fiber) {
- UNSAFE_componentWillMountUniqueNames.add(getComponentName(fiber.type) || "Component");
+ UNSAFE_componentWillMountUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
didWarnAboutUnsafeLifecycles.add(fiber.type);
});
pendingUNSAFE_ComponentWillMountWarnings = [];
@@ -10748,7 +11651,7 @@
var componentWillReceivePropsUniqueNames = /* @__PURE__ */ new Set();
if (pendingComponentWillReceivePropsWarnings.length > 0) {
pendingComponentWillReceivePropsWarnings.forEach(function(fiber) {
- componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || "Component");
+ componentWillReceivePropsUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
didWarnAboutUnsafeLifecycles.add(fiber.type);
});
pendingComponentWillReceivePropsWarnings = [];
@@ -10756,7 +11659,7 @@
var UNSAFE_componentWillReceivePropsUniqueNames = /* @__PURE__ */ new Set();
if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) {
pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function(fiber) {
- UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || "Component");
+ UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
didWarnAboutUnsafeLifecycles.add(fiber.type);
});
pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
@@ -10764,7 +11667,7 @@
var componentWillUpdateUniqueNames = /* @__PURE__ */ new Set();
if (pendingComponentWillUpdateWarnings.length > 0) {
pendingComponentWillUpdateWarnings.forEach(function(fiber) {
- componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || "Component");
+ componentWillUpdateUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
didWarnAboutUnsafeLifecycles.add(fiber.type);
});
pendingComponentWillUpdateWarnings = [];
@@ -10772,7 +11675,7 @@
var UNSAFE_componentWillUpdateUniqueNames = /* @__PURE__ */ new Set();
if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) {
pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function(fiber) {
- UNSAFE_componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || "Component");
+ UNSAFE_componentWillUpdateUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
didWarnAboutUnsafeLifecycles.add(fiber.type);
});
pendingUNSAFE_ComponentWillUpdateWarnings = [];
@@ -10830,7 +11733,7 @@
var firstFiber = fiberArray[0];
var uniqueNames = /* @__PURE__ */ new Set();
fiberArray.forEach(function(fiber) {
- uniqueNames.add(getComponentName(fiber.type) || "Component");
+ uniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
didWarnAboutLegacyContext.add(fiber.type);
});
var sortedNames = setToSortedString(uniqueNames);
@@ -10854,7 +11757,7 @@
}
function resolveDefaultProps(Component7, baseProps) {
if (Component7 && Component7.defaultProps) {
- var props = _assign({}, baseProps);
+ var props = assign({}, baseProps);
var defaultProps = Component7.defaultProps;
for (var propName in defaultProps) {
if (props[propName] === void 0) {
@@ -10865,7 +11768,6 @@
}
return baseProps;
}
- var MAX_SIGNED_31_BIT_INT = 1073741823;
var valueCursor = createCursor(null);
var rendererSigil;
{
@@ -10873,12 +11775,12 @@
}
var currentlyRenderingFiber = null;
var lastContextDependency = null;
- var lastContextWithAllBitsObserved = null;
+ var lastFullyObservedContext = null;
var isDisallowedContextReadInDEV = false;
function resetContextDependencies() {
currentlyRenderingFiber = null;
lastContextDependency = null;
- lastContextWithAllBitsObserved = null;
+ lastFullyObservedContext = null;
{
isDisallowedContextReadInDEV = false;
}
@@ -10893,8 +11795,7 @@
isDisallowedContextReadInDEV = false;
}
}
- function pushProvider(providerFiber, nextValue) {
- var context = providerFiber.type._context;
+ function pushProvider(providerFiber, context, nextValue) {
{
push(valueCursor, context._currentValue, providerFiber);
context._currentValue = nextValue;
@@ -10906,28 +11807,16 @@
}
}
}
- function popProvider(providerFiber) {
+ function popProvider(context, providerFiber) {
var currentValue = valueCursor.current;
pop(valueCursor, providerFiber);
- var context = providerFiber.type._context;
{
- context._currentValue = currentValue;
- }
- }
- function calculateChangedBits(context, newValue, oldValue) {
- if (objectIs(oldValue, newValue)) {
- return 0;
- } else {
- var changedBits = typeof context._calculateChangedBits === "function" ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
{
- if ((changedBits & MAX_SIGNED_31_BIT_INT) !== changedBits) {
- error("calculateChangedBits: Expected the return value to be a 31-bit integer. Instead received: %s", changedBits);
- }
+ context._currentValue = currentValue;
}
- return changedBits | 0;
}
}
- function scheduleWorkOnParentPath(parent, renderLanes2) {
+ function scheduleContextWorkOnParentPath(parent, renderLanes2, propagationRoot) {
var node = parent;
while (node !== null) {
var alternate = node.alternate;
@@ -10938,13 +11827,24 @@
}
} else if (alternate !== null && !isSubsetOfLanes(alternate.childLanes, renderLanes2)) {
alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes2);
- } else {
+ }
+ if (node === propagationRoot) {
break;
}
node = node.return;
}
+ {
+ if (node !== propagationRoot) {
+ error("Expected to find the propagation root when scheduling context work. This error is likely caused by a bug in React. Please file an issue.");
+ }
+ }
+ }
+ function propagateContextChange(workInProgress2, context, renderLanes2) {
+ {
+ propagateContextChange_eager(workInProgress2, context, renderLanes2);
+ }
}
- function propagateContextChange(workInProgress2, context, changedBits, renderLanes2) {
+ function propagateContextChange_eager(workInProgress2, context, renderLanes2) {
var fiber = workInProgress2.child;
if (fiber !== null) {
fiber.return = workInProgress2;
@@ -10956,18 +11856,32 @@
nextFiber = fiber.child;
var dependency = list.firstContext;
while (dependency !== null) {
- if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
+ if (dependency.context === context) {
if (fiber.tag === ClassComponent) {
- var update = createUpdate(NoTimestamp, pickArbitraryLane(renderLanes2));
+ var lane = pickArbitraryLane(renderLanes2);
+ var update = createUpdate(NoTimestamp, lane);
update.tag = ForceUpdate;
- enqueueUpdate(fiber, update);
+ var updateQueue = fiber.updateQueue;
+ if (updateQueue === null)
+ ;
+ else {
+ var sharedQueue = updateQueue.shared;
+ var pending = sharedQueue.pending;
+ if (pending === null) {
+ update.next = update;
+ } else {
+ update.next = pending.next;
+ pending.next = update;
+ }
+ sharedQueue.pending = update;
+ }
}
fiber.lanes = mergeLanes(fiber.lanes, renderLanes2);
var alternate = fiber.alternate;
if (alternate !== null) {
alternate.lanes = mergeLanes(alternate.lanes, renderLanes2);
}
- scheduleWorkOnParentPath(fiber.return, renderLanes2);
+ scheduleContextWorkOnParentPath(fiber.return, renderLanes2, workInProgress2);
list.lanes = mergeLanes(list.lanes, renderLanes2);
break;
}
@@ -10975,6 +11889,18 @@
}
} else if (fiber.tag === ContextProvider) {
nextFiber = fiber.type === workInProgress2.type ? null : fiber.child;
+ } else if (fiber.tag === DehydratedFragment) {
+ var parentSuspense = fiber.return;
+ if (parentSuspense === null) {
+ throw new Error("We just came from a parent so we must have had a parent. This is a bug in React.");
+ }
+ parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes2);
+ var _alternate = parentSuspense.alternate;
+ if (_alternate !== null) {
+ _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes2);
+ }
+ scheduleContextWorkOnParentPath(parentSuspense, renderLanes2, workInProgress2);
+ nextFiber = fiber.sibling;
} else {
nextFiber = fiber.child;
}
@@ -11002,58 +11928,151 @@
function prepareToReadContext(workInProgress2, renderLanes2) {
currentlyRenderingFiber = workInProgress2;
lastContextDependency = null;
- lastContextWithAllBitsObserved = null;
+ lastFullyObservedContext = null;
var dependencies = workInProgress2.dependencies;
if (dependencies !== null) {
- var firstContext = dependencies.firstContext;
- if (firstContext !== null) {
- if (includesSomeLane(dependencies.lanes, renderLanes2)) {
- markWorkInProgressReceivedUpdate();
+ {
+ var firstContext = dependencies.firstContext;
+ if (firstContext !== null) {
+ if (includesSomeLane(dependencies.lanes, renderLanes2)) {
+ markWorkInProgressReceivedUpdate();
+ }
+ dependencies.firstContext = null;
}
- dependencies.firstContext = null;
}
}
}
- function readContext(context, observedBits) {
+ function readContext(context) {
{
if (isDisallowedContextReadInDEV) {
error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");
}
}
- if (lastContextWithAllBitsObserved === context)
- ;
- else if (observedBits === false || observedBits === 0)
+ var value = context._currentValue;
+ if (lastFullyObservedContext === context)
;
else {
- var resolvedObservedBits;
- if (typeof observedBits !== "number" || observedBits === MAX_SIGNED_31_BIT_INT) {
- lastContextWithAllBitsObserved = context;
- resolvedObservedBits = MAX_SIGNED_31_BIT_INT;
- } else {
- resolvedObservedBits = observedBits;
- }
var contextItem = {
context,
- observedBits: resolvedObservedBits,
+ memoizedValue: value,
next: null
};
if (lastContextDependency === null) {
- if (!(currentlyRenderingFiber !== null)) {
- {
- throw Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");
- }
+ if (currentlyRenderingFiber === null) {
+ throw new Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");
}
lastContextDependency = contextItem;
currentlyRenderingFiber.dependencies = {
lanes: NoLanes,
- firstContext: contextItem,
- responders: null
+ firstContext: contextItem
};
} else {
lastContextDependency = lastContextDependency.next = contextItem;
}
}
- return context._currentValue;
+ return value;
+ }
+ var concurrentQueues = null;
+ function pushConcurrentUpdateQueue(queue) {
+ if (concurrentQueues === null) {
+ concurrentQueues = [queue];
+ } else {
+ concurrentQueues.push(queue);
+ }
+ }
+ function finishQueueingConcurrentUpdates() {
+ if (concurrentQueues !== null) {
+ for (var i = 0; i < concurrentQueues.length; i++) {
+ var queue = concurrentQueues[i];
+ var lastInterleavedUpdate = queue.interleaved;
+ if (lastInterleavedUpdate !== null) {
+ queue.interleaved = null;
+ var firstInterleavedUpdate = lastInterleavedUpdate.next;
+ var lastPendingUpdate = queue.pending;
+ if (lastPendingUpdate !== null) {
+ var firstPendingUpdate = lastPendingUpdate.next;
+ lastPendingUpdate.next = firstInterleavedUpdate;
+ lastInterleavedUpdate.next = firstPendingUpdate;
+ }
+ queue.pending = lastInterleavedUpdate;
+ }
+ }
+ concurrentQueues = null;
+ }
+ }
+ function enqueueConcurrentHookUpdate(fiber, queue, update, lane) {
+ var interleaved = queue.interleaved;
+ if (interleaved === null) {
+ update.next = update;
+ pushConcurrentUpdateQueue(queue);
+ } else {
+ update.next = interleaved.next;
+ interleaved.next = update;
+ }
+ queue.interleaved = update;
+ return markUpdateLaneFromFiberToRoot(fiber, lane);
+ }
+ function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update, lane) {
+ var interleaved = queue.interleaved;
+ if (interleaved === null) {
+ update.next = update;
+ pushConcurrentUpdateQueue(queue);
+ } else {
+ update.next = interleaved.next;
+ interleaved.next = update;
+ }
+ queue.interleaved = update;
+ }
+ function enqueueConcurrentClassUpdate(fiber, queue, update, lane) {
+ var interleaved = queue.interleaved;
+ if (interleaved === null) {
+ update.next = update;
+ pushConcurrentUpdateQueue(queue);
+ } else {
+ update.next = interleaved.next;
+ interleaved.next = update;
+ }
+ queue.interleaved = update;
+ return markUpdateLaneFromFiberToRoot(fiber, lane);
+ }
+ function enqueueConcurrentRenderForLane(fiber, lane) {
+ return markUpdateLaneFromFiberToRoot(fiber, lane);
+ }
+ var unsafe_markUpdateLaneFromFiberToRoot = markUpdateLaneFromFiberToRoot;
+ function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
+ sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane);
+ var alternate = sourceFiber.alternate;
+ if (alternate !== null) {
+ alternate.lanes = mergeLanes(alternate.lanes, lane);
+ }
+ {
+ if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) {
+ warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
+ }
+ }
+ var node = sourceFiber;
+ var parent = sourceFiber.return;
+ while (parent !== null) {
+ parent.childLanes = mergeLanes(parent.childLanes, lane);
+ alternate = parent.alternate;
+ if (alternate !== null) {
+ alternate.childLanes = mergeLanes(alternate.childLanes, lane);
+ } else {
+ {
+ if ((parent.flags & (Placement | Hydrating)) !== NoFlags) {
+ warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
+ }
+ }
+ }
+ node = parent;
+ parent = parent.return;
+ }
+ if (node.tag === HostRoot) {
+ var root2 = node.stateNode;
+ return root2;
+ } else {
+ return null;
+ }
}
var UpdateState = 0;
var ReplaceState = 1;
@@ -11072,7 +12091,9 @@
firstBaseUpdate: null,
lastBaseUpdate: null,
shared: {
- pending: null
+ pending: null,
+ interleaved: null,
+ lanes: NoLanes
},
effects: null
};
@@ -11103,26 +12124,45 @@
};
return update;
}
- function enqueueUpdate(fiber, update) {
+ function enqueueUpdate(fiber, update, lane) {
var updateQueue = fiber.updateQueue;
if (updateQueue === null) {
- return;
+ return null;
}
var sharedQueue = updateQueue.shared;
- var pending = sharedQueue.pending;
- if (pending === null) {
- update.next = update;
- } else {
- update.next = pending.next;
- pending.next = update;
- }
- sharedQueue.pending = update;
{
if (currentlyProcessingQueue === sharedQueue && !didWarnUpdateInsideUpdate) {
error("An update (setState, replaceState, or forceUpdate) was scheduled from inside an update function. Update functions should be pure, with zero side-effects. Consider using componentDidUpdate or a callback.");
didWarnUpdateInsideUpdate = true;
}
}
+ if (isUnsafeClassRenderPhaseUpdate()) {
+ var pending = sharedQueue.pending;
+ if (pending === null) {
+ update.next = update;
+ } else {
+ update.next = pending.next;
+ pending.next = update;
+ }
+ sharedQueue.pending = update;
+ return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane);
+ } else {
+ return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane);
+ }
+ }
+ function entangleTransitions(root2, fiber, lane) {
+ var updateQueue = fiber.updateQueue;
+ if (updateQueue === null) {
+ return;
+ }
+ var sharedQueue = updateQueue.shared;
+ if (isTransitionLane(lane)) {
+ var queueLanes = sharedQueue.lanes;
+ queueLanes = intersectLanes(queueLanes, root2.pendingLanes);
+ var newQueueLanes = mergeLanes(queueLanes, lane);
+ sharedQueue.lanes = newQueueLanes;
+ markRootEntangled(root2, newQueueLanes);
+ }
}
function enqueueCapturedUpdate(workInProgress2, capturedUpdate) {
var queue = workInProgress2.updateQueue;
@@ -11190,12 +12230,12 @@
}
var nextState = payload.call(instance, prevState, nextProps);
{
- if (workInProgress2.mode & StrictMode) {
- disableLogs();
+ if (workInProgress2.mode & StrictLegacyMode) {
+ setIsStrictModeForDevtools(true);
try {
payload.call(instance, prevState, nextProps);
} finally {
- reenableLogs();
+ setIsStrictModeForDevtools(false);
}
}
exitDisallowedContextReadInDEV();
@@ -11216,12 +12256,12 @@
}
partialState = _payload.call(instance, prevState, nextProps);
{
- if (workInProgress2.mode & StrictMode) {
- disableLogs();
+ if (workInProgress2.mode & StrictLegacyMode) {
+ setIsStrictModeForDevtools(true);
try {
_payload.call(instance, prevState, nextProps);
} finally {
- reenableLogs();
+ setIsStrictModeForDevtools(false);
}
}
exitDisallowedContextReadInDEV();
@@ -11232,7 +12272,7 @@
if (partialState === null || partialState === void 0) {
return prevState;
}
- return _assign({}, prevState, partialState);
+ return assign({}, prevState, partialState);
}
case ForceUpdate: {
hasForceUpdate = true;
@@ -11318,7 +12358,9 @@
}
newState = getStateFromUpdate(workInProgress2, queue, update, newState, props, instance);
var callback = update.callback;
- if (callback !== null) {
+ if (callback !== null && // If the update was already committed, we should not queue its
+ // callback again.
+ update.lane !== NoLane) {
workInProgress2.flags |= Callback;
var effects = queue.effects;
if (effects === null) {
@@ -11349,6 +12391,16 @@
queue.baseState = newBaseState;
queue.firstBaseUpdate = newFirstBaseUpdate;
queue.lastBaseUpdate = newLastBaseUpdate;
+ var lastInterleaved = queue.shared.interleaved;
+ if (lastInterleaved !== null) {
+ var interleaved = lastInterleaved;
+ do {
+ newLanes = mergeLanes(newLanes, interleaved.lane);
+ interleaved = interleaved.next;
+ } while (interleaved !== lastInterleaved);
+ } else if (firstBaseUpdate === null) {
+ queue.shared.lanes = NoLanes;
+ }
markSkippedUpdateLanes(newLanes);
workInProgress2.lanes = newLanes;
workInProgress2.memoizedState = newState;
@@ -11358,10 +12410,8 @@
}
}
function callCallback(callback, context) {
- if (!(typeof callback === "function")) {
- {
- throw Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback);
- }
+ if (typeof callback !== "function") {
+ throw new Error("Invalid argument passed as callback. Expected a function. Instead " + ("received: " + callback));
}
callback.call(context);
}
@@ -11386,7 +12436,6 @@
}
}
var fakeInternalInstance = {};
- var isArray = Array.isArray;
var emptyRefsObject = new React25.Component().refs;
var didWarnAboutStateAssignmentForComponent;
var didWarnAboutUninitializedState;
@@ -11420,7 +12469,7 @@
};
warnOnUndefinedDerivedState = function(type, partialState) {
if (partialState === void 0) {
- var componentName = getComponentName(type) || "Component";
+ var componentName = getComponentNameFromType(type) || "Component";
if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
didWarnAboutUndefinedDerivedState.add(componentName);
error("%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. You have returned undefined.", componentName);
@@ -11430,32 +12479,26 @@
Object.defineProperty(fakeInternalInstance, "_processChildContext", {
enumerable: false,
value: function() {
- {
- {
- throw Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).");
- }
- }
+ throw new Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).");
}
});
Object.freeze(fakeInternalInstance);
}
function applyDerivedStateFromProps(workInProgress2, ctor, getDerivedStateFromProps, nextProps) {
var prevState = workInProgress2.memoizedState;
+ var partialState = getDerivedStateFromProps(nextProps, prevState);
{
- if (workInProgress2.mode & StrictMode) {
- disableLogs();
+ if (workInProgress2.mode & StrictLegacyMode) {
+ setIsStrictModeForDevtools(true);
try {
- getDerivedStateFromProps(nextProps, prevState);
+ partialState = getDerivedStateFromProps(nextProps, prevState);
} finally {
- reenableLogs();
+ setIsStrictModeForDevtools(false);
}
}
- }
- var partialState = getDerivedStateFromProps(nextProps, prevState);
- {
warnOnUndefinedDerivedState(ctor, partialState);
}
- var memoizedState = partialState === null || partialState === void 0 ? prevState : _assign({}, prevState, partialState);
+ var memoizedState = partialState === null || partialState === void 0 ? prevState : assign({}, prevState, partialState);
workInProgress2.memoizedState = memoizedState;
if (workInProgress2.lanes === NoLanes) {
var updateQueue = workInProgress2.updateQueue;
@@ -11476,8 +12519,14 @@
}
update.callback = callback;
}
- enqueueUpdate(fiber, update);
- scheduleUpdateOnFiber(fiber, lane, eventTime);
+ var root2 = enqueueUpdate(fiber, update, lane);
+ if (root2 !== null) {
+ scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
+ entangleTransitions(root2, fiber, lane);
+ }
+ {
+ markStateUpdateScheduled(fiber, lane);
+ }
},
enqueueReplaceState: function(inst, payload, callback) {
var fiber = get(inst);
@@ -11492,8 +12541,14 @@
}
update.callback = callback;
}
- enqueueUpdate(fiber, update);
- scheduleUpdateOnFiber(fiber, lane, eventTime);
+ var root2 = enqueueUpdate(fiber, update, lane);
+ if (root2 !== null) {
+ scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
+ entangleTransitions(root2, fiber, lane);
+ }
+ {
+ markStateUpdateScheduled(fiber, lane);
+ }
},
enqueueForceUpdate: function(inst, callback) {
var fiber = get(inst);
@@ -11507,27 +12562,31 @@
}
update.callback = callback;
}
- enqueueUpdate(fiber, update);
- scheduleUpdateOnFiber(fiber, lane, eventTime);
+ var root2 = enqueueUpdate(fiber, update, lane);
+ if (root2 !== null) {
+ scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
+ entangleTransitions(root2, fiber, lane);
+ }
+ {
+ markForceUpdateScheduled(fiber, lane);
+ }
}
};
function checkShouldComponentUpdate(workInProgress2, ctor, oldProps, newProps, oldState, newState, nextContext) {
var instance = workInProgress2.stateNode;
if (typeof instance.shouldComponentUpdate === "function") {
+ var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
{
- if (workInProgress2.mode & StrictMode) {
- disableLogs();
+ if (workInProgress2.mode & StrictLegacyMode) {
+ setIsStrictModeForDevtools(true);
try {
- instance.shouldComponentUpdate(newProps, newState, nextContext);
+ shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
} finally {
- reenableLogs();
+ setIsStrictModeForDevtools(false);
}
}
- }
- var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
- {
if (shouldUpdate === void 0) {
- error("%s.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.", getComponentName(ctor) || "Component");
+ error("%s.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.", getComponentNameFromType(ctor) || "Component");
}
}
return shouldUpdate;
@@ -11540,7 +12599,7 @@
function checkClassInstance(workInProgress2, ctor, newProps) {
var instance = workInProgress2.stateNode;
{
- var name = getComponentName(ctor) || "Component";
+ var name = getComponentNameFromType(ctor) || "Component";
var renderPresent = instance.render;
if (!renderPresent) {
if (ctor.prototype && typeof ctor.prototype.render === "function") {
@@ -11574,7 +12633,7 @@
error("%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.", name);
}
if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== "undefined") {
- error("%s has a method called shouldComponentUpdate(). shouldComponentUpdate should not be used when extending React.PureComponent. Please extend React.Component if shouldComponentUpdate is used.", getComponentName(ctor) || "A pure component");
+ error("%s has a method called shouldComponentUpdate(). shouldComponentUpdate should not be used when extending React.PureComponent. Please extend React.Component if shouldComponentUpdate is used.", getComponentNameFromType(ctor) || "A pure component");
}
if (typeof instance.componentDidUnmount === "function") {
error("%s has a method called componentDidUnmount(). But there is no such lifecycle method. Did you mean componentWillUnmount()?", name);
@@ -11597,7 +12656,7 @@
}
if (typeof instance.getSnapshotBeforeUpdate === "function" && typeof instance.componentDidUpdate !== "function" && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
- error("%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). This component defines getSnapshotBeforeUpdate() only.", getComponentName(ctor));
+ error("%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). This component defines getSnapshotBeforeUpdate() only.", getComponentNameFromType(ctor));
}
if (typeof instance.getDerivedStateFromProps === "function") {
error("%s: getDerivedStateFromProps() is defined as an instance method and will be ignored. Instead, declare it as a static method.", name);
@@ -11650,7 +12709,7 @@
} else {
addendum = " However, it is set to an object with keys {" + Object.keys(contextType).join(", ") + "}.";
}
- error("%s defines an invalid contextType. contextType should point to the Context object returned by React.createContext().%s", getComponentName(ctor) || "Component", addendum);
+ error("%s defines an invalid contextType. contextType should point to the Context object returned by React.createContext().%s", getComponentNameFromType(ctor) || "Component", addendum);
}
}
}
@@ -11662,22 +12721,22 @@
isLegacyContextConsumer = contextTypes !== null && contextTypes !== void 0;
context = isLegacyContextConsumer ? getMaskedContext(workInProgress2, unmaskedContext) : emptyContextObject;
}
+ var instance = new ctor(props, context);
{
- if (workInProgress2.mode & StrictMode) {
- disableLogs();
+ if (workInProgress2.mode & StrictLegacyMode) {
+ setIsStrictModeForDevtools(true);
try {
- new ctor(props, context);
+ instance = new ctor(props, context);
} finally {
- reenableLogs();
+ setIsStrictModeForDevtools(false);
}
}
}
- var instance = new ctor(props, context);
var state = workInProgress2.memoizedState = instance.state !== null && instance.state !== void 0 ? instance.state : null;
adoptClassInstance(workInProgress2, instance);
{
if (typeof ctor.getDerivedStateFromProps === "function" && state === null) {
- var componentName = getComponentName(ctor) || "Component";
+ var componentName = getComponentNameFromType(ctor) || "Component";
if (!didWarnAboutUninitializedState.has(componentName)) {
didWarnAboutUninitializedState.add(componentName);
error("`%s` uses `getDerivedStateFromProps` but its initial state is %s. This is not recommended. Instead, define the initial state by assigning an object to `this.state` in the constructor of `%s`. This ensures that `getDerivedStateFromProps` arguments have a consistent shape.", componentName, instance.state === null ? "null" : "undefined", componentName);
@@ -11703,7 +12762,7 @@
foundWillUpdateName = "UNSAFE_componentWillUpdate";
}
if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
- var _componentName = getComponentName(ctor) || "Component";
+ var _componentName = getComponentNameFromType(ctor) || "Component";
var newApiName = typeof ctor.getDerivedStateFromProps === "function" ? "getDerivedStateFromProps()" : "getSnapshotBeforeUpdate()";
if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
@@ -11727,7 +12786,7 @@
}
if (oldState !== instance.state) {
{
- error("%s.componentWillMount(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.", getComponentName(workInProgress2.type) || "Component");
+ error("%s.componentWillMount(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.", getComponentNameFromFiber(workInProgress2) || "Component");
}
classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
}
@@ -11742,7 +12801,7 @@
}
if (instance.state !== oldState) {
{
- var componentName = getComponentName(workInProgress2.type) || "Component";
+ var componentName = getComponentNameFromFiber(workInProgress2) || "Component";
if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
didWarnAboutStateAssignmentForComponent.add(componentName);
error("%s.componentWillReceiveProps(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.", componentName);
@@ -11769,20 +12828,19 @@
}
{
if (instance.state === newProps) {
- var componentName = getComponentName(ctor) || "Component";
+ var componentName = getComponentNameFromType(ctor) || "Component";
if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
didWarnAboutDirectlyAssigningPropsToState.add(componentName);
error("%s: It is not recommended to assign props directly to state because updates to props won't be reflected in state. In most cases, it is better to use props directly.", componentName);
}
}
- if (workInProgress2.mode & StrictMode) {
+ if (workInProgress2.mode & StrictLegacyMode) {
ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress2, instance);
}
{
ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress2, instance);
}
}
- processUpdateQueue(workInProgress2, newProps, instance, renderLanes2);
instance.state = workInProgress2.memoizedState;
var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
if (typeof getDerivedStateFromProps === "function") {
@@ -11795,7 +12853,14 @@
instance.state = workInProgress2.memoizedState;
}
if (typeof instance.componentDidMount === "function") {
- workInProgress2.flags |= Update;
+ var fiberFlags = Update;
+ {
+ fiberFlags |= LayoutStatic;
+ }
+ if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
+ fiberFlags |= MountLayoutDev;
+ }
+ workInProgress2.flags |= fiberFlags;
}
}
function resumeMountClassInstance(workInProgress2, ctor, newProps, renderLanes2) {
@@ -11825,7 +12890,14 @@
newState = workInProgress2.memoizedState;
if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
if (typeof instance.componentDidMount === "function") {
- workInProgress2.flags |= Update;
+ var fiberFlags = Update;
+ {
+ fiberFlags |= LayoutStatic;
+ }
+ if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
+ fiberFlags |= MountLayoutDev;
+ }
+ workInProgress2.flags |= fiberFlags;
}
return false;
}
@@ -11844,11 +12916,25 @@
}
}
if (typeof instance.componentDidMount === "function") {
- workInProgress2.flags |= Update;
+ var _fiberFlags = Update;
+ {
+ _fiberFlags |= LayoutStatic;
+ }
+ if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
+ _fiberFlags |= MountLayoutDev;
+ }
+ workInProgress2.flags |= _fiberFlags;
}
} else {
if (typeof instance.componentDidMount === "function") {
- workInProgress2.flags |= Update;
+ var _fiberFlags2 = Update;
+ {
+ _fiberFlags2 |= LayoutStatic;
+ }
+ if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
+ _fiberFlags2 |= MountLayoutDev;
+ }
+ workInProgress2.flags |= _fiberFlags2;
}
workInProgress2.memoizedProps = newProps;
workInProgress2.memoizedState = newState;
@@ -11886,7 +12972,7 @@
var newState = instance.state = oldState;
processUpdateQueue(workInProgress2, newProps, instance, renderLanes2);
newState = workInProgress2.memoizedState;
- if (unresolvedOldProps === unresolvedNewProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
+ if (unresolvedOldProps === unresolvedNewProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing() && !enableLazyContextPropagation) {
if (typeof instance.componentDidUpdate === "function") {
if (unresolvedOldProps !== current2.memoizedProps || oldState !== current2.memoizedState) {
workInProgress2.flags |= Update;
@@ -11903,7 +12989,11 @@
applyDerivedStateFromProps(workInProgress2, ctor, getDerivedStateFromProps, newProps);
newState = workInProgress2.memoizedState;
}
- var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress2, ctor, oldProps, newProps, oldState, newState, nextContext);
+ var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress2, ctor, oldProps, newProps, oldState, newState, nextContext) || // TODO: In some cases, we'll end up checking if context has changed twice,
+ // both before and after `shouldComponentUpdate` has been called. Not ideal,
+ // but I'm loath to refactor this function. This only happens for memoized
+ // components so it's not that common.
+ enableLazyContextPropagation;
if (shouldUpdate) {
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === "function" || typeof instance.componentWillUpdate === "function")) {
if (typeof instance.componentWillUpdate === "function") {
@@ -11958,13 +13048,11 @@
if (!child._store || child._store.validated || child.key != null) {
return;
}
- if (!(typeof child._store === "object")) {
- {
- throw Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.");
- }
+ if (typeof child._store !== "object") {
+ throw new Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.");
}
child._store.validated = true;
- var componentName = getComponentName(returnFiber.type) || "Component";
+ var componentName = getComponentNameFromFiber(returnFiber) || "Component";
if (ownerHasKeyUseWarning[componentName]) {
return;
}
@@ -11972,16 +13060,15 @@
error('Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.');
};
}
- var isArray$1 = Array.isArray;
function coerceRef(returnFiber, current2, element) {
var mixedRef = element.ref;
if (mixedRef !== null && typeof mixedRef !== "function" && typeof mixedRef !== "object") {
{
- if ((returnFiber.mode & StrictMode || warnAboutStringRefs) && // We warn in ReactElement.js if owner and self are equal for string refs
+ if ((returnFiber.mode & StrictLegacyMode || warnAboutStringRefs) && // We warn in ReactElement.js if owner and self are equal for string refs
// because these cannot be automatically converted to an arrow function
// using a codemod. Therefore, we don't have to warn about string refs again.
!(element._owner && element._self && element._owner.stateNode !== element._self)) {
- var componentName = getComponentName(returnFiber.type) || "Component";
+ var componentName = getComponentNameFromFiber(returnFiber) || "Component";
if (!didWarnAboutStringRefs[componentName]) {
{
error('A string ref, "%s", has been found within a strict mode tree. String refs are a source of potential bugs and should be avoided. We recommend using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', mixedRef);
@@ -11995,26 +13082,26 @@
var inst;
if (owner) {
var ownerFiber = owner;
- if (!(ownerFiber.tag === ClassComponent)) {
- {
- throw Error("Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref");
- }
+ if (ownerFiber.tag !== ClassComponent) {
+ throw new Error("Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref");
}
inst = ownerFiber.stateNode;
}
if (!inst) {
- {
- throw Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue.");
- }
+ throw new Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue.");
+ }
+ var resolvedInst = inst;
+ {
+ checkPropStringCoercion(mixedRef, "ref");
}
var stringRef = "" + mixedRef;
if (current2 !== null && current2.ref !== null && typeof current2.ref === "function" && current2.ref._stringRef === stringRef) {
return current2.ref;
}
var ref = function(value) {
- var refs = inst.refs;
+ var refs = resolvedInst.refs;
if (refs === emptyRefsObject) {
- refs = inst.refs = {};
+ refs = resolvedInst.refs = {};
}
if (value === null) {
delete refs[stringRef];
@@ -12025,32 +13112,23 @@
ref._stringRef = stringRef;
return ref;
} else {
- if (!(typeof mixedRef === "string")) {
- {
- throw Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null.");
- }
+ if (typeof mixedRef !== "string") {
+ throw new Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null.");
}
if (!element._owner) {
- {
- throw Error("Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://reactjs.org/link/refs-must-have-owner for more information.");
- }
+ throw new Error("Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://reactjs.org/link/refs-must-have-owner for more information.");
}
}
}
return mixedRef;
}
function throwOnInvalidObjectType(returnFiber, newChild) {
- if (returnFiber.type !== "textarea") {
- {
- {
- throw Error("Objects are not valid as a React child (found: " + (Object.prototype.toString.call(newChild) === "[object Object]" ? "object with keys {" + Object.keys(newChild).join(", ") + "}" : newChild) + "). If you meant to render a collection of children, use an array instead.");
- }
- }
- }
+ var childString = Object.prototype.toString.call(newChild);
+ throw new Error("Objects are not valid as a React child (found: " + (childString === "[object Object]" ? "object with keys {" + Object.keys(newChild).join(", ") + "}" : childString) + "). If you meant to render a collection of children, use an array instead.");
}
function warnOnFunctionType(returnFiber) {
{
- var componentName = getComponentName(returnFiber.type) || "Component";
+ var componentName = getComponentNameFromFiber(returnFiber) || "Component";
if (ownerHasFunctionTypeWarning[componentName]) {
return;
}
@@ -12058,20 +13136,23 @@
error("Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.");
}
}
+ function resolveLazy(lazyType) {
+ var payload = lazyType._payload;
+ var init = lazyType._init;
+ return init(payload);
+ }
function ChildReconciler(shouldTrackSideEffects) {
function deleteChild(returnFiber, childToDelete) {
if (!shouldTrackSideEffects) {
return;
}
- var last = returnFiber.lastEffect;
- if (last !== null) {
- last.nextEffect = childToDelete;
- returnFiber.lastEffect = childToDelete;
+ var deletions = returnFiber.deletions;
+ if (deletions === null) {
+ returnFiber.deletions = [childToDelete];
+ returnFiber.flags |= ChildDeletion;
} else {
- returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
+ deletions.push(childToDelete);
}
- childToDelete.nextEffect = null;
- childToDelete.flags = Deletion;
}
function deleteRemainingChildren(returnFiber, currentFirstChild) {
if (!shouldTrackSideEffects) {
@@ -12106,25 +13187,26 @@
function placeChild(newFiber, lastPlacedIndex, newIndex) {
newFiber.index = newIndex;
if (!shouldTrackSideEffects) {
+ newFiber.flags |= Forked;
return lastPlacedIndex;
}
var current2 = newFiber.alternate;
if (current2 !== null) {
var oldIndex = current2.index;
if (oldIndex < lastPlacedIndex) {
- newFiber.flags = Placement;
+ newFiber.flags |= Placement;
return lastPlacedIndex;
} else {
return oldIndex;
}
} else {
- newFiber.flags = Placement;
+ newFiber.flags |= Placement;
return lastPlacedIndex;
}
}
function placeSingleChild(newFiber) {
if (shouldTrackSideEffects && newFiber.alternate === null) {
- newFiber.flags = Placement;
+ newFiber.flags |= Placement;
}
return newFiber;
}
@@ -12140,9 +13222,17 @@
}
}
function updateElement(returnFiber, current2, element, lanes) {
+ var elementType = element.type;
+ if (elementType === REACT_FRAGMENT_TYPE) {
+ return updateFragment2(returnFiber, current2, element.props.children, lanes, element.key);
+ }
if (current2 !== null) {
- if (current2.elementType === element.type || // Keep this check inline so it only runs on the false path:
- isCompatibleFamilyForHotReloading(current2, element)) {
+ if (current2.elementType === elementType || // Keep this check inline so it only runs on the false path:
+ isCompatibleFamilyForHotReloading(current2, element) || // Lazy types should reconcile their resolved type.
+ // We need to do this after the Hot Reloading check above,
+ // because hot reloading has different semantics than prod because
+ // it doesn't resuspend. So we can't let the call below suspend.
+ typeof elementType === "object" && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === current2.type) {
var existing = useFiber(current2, element.props);
existing.ref = coerceRef(returnFiber, current2, element);
existing.return = returnFiber;
@@ -12181,7 +13271,7 @@
}
}
function createChild(returnFiber, newChild, lanes) {
- if (typeof newChild === "string" || typeof newChild === "number") {
+ if (typeof newChild === "string" && newChild !== "" || typeof newChild === "number") {
var created = createFiberFromText("" + newChild, returnFiber.mode, lanes);
created.return = returnFiber;
return created;
@@ -12199,8 +13289,13 @@
_created2.return = returnFiber;
return _created2;
}
+ case REACT_LAZY_TYPE: {
+ var payload = newChild._payload;
+ var init = newChild._init;
+ return createChild(returnFiber, init(payload), lanes);
+ }
}
- if (isArray$1(newChild) || getIteratorFn(newChild)) {
+ if (isArray(newChild) || getIteratorFn(newChild)) {
var _created3 = createFiberFromFragment(newChild, returnFiber.mode, lanes, null);
_created3.return = returnFiber;
return _created3;
@@ -12216,7 +13311,7 @@
}
function updateSlot(returnFiber, oldFiber, newChild, lanes) {
var key = oldFiber !== null ? oldFiber.key : null;
- if (typeof newChild === "string" || typeof newChild === "number") {
+ if (typeof newChild === "string" && newChild !== "" || typeof newChild === "number") {
if (key !== null) {
return null;
}
@@ -12226,9 +13321,6 @@
switch (newChild.$$typeof) {
case REACT_ELEMENT_TYPE: {
if (newChild.key === key) {
- if (newChild.type === REACT_FRAGMENT_TYPE) {
- return updateFragment2(returnFiber, oldFiber, newChild.props.children, lanes, key);
- }
return updateElement(returnFiber, oldFiber, newChild, lanes);
} else {
return null;
@@ -12241,8 +13333,13 @@
return null;
}
}
+ case REACT_LAZY_TYPE: {
+ var payload = newChild._payload;
+ var init = newChild._init;
+ return updateSlot(returnFiber, oldFiber, init(payload), lanes);
+ }
}
- if (isArray$1(newChild) || getIteratorFn(newChild)) {
+ if (isArray(newChild) || getIteratorFn(newChild)) {
if (key !== null) {
return null;
}
@@ -12258,7 +13355,7 @@
return null;
}
function updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes) {
- if (typeof newChild === "string" || typeof newChild === "number") {
+ if (typeof newChild === "string" && newChild !== "" || typeof newChild === "number") {
var matchedFiber = existingChildren.get(newIdx) || null;
return updateTextNode(returnFiber, matchedFiber, "" + newChild, lanes);
}
@@ -12266,17 +13363,18 @@
switch (newChild.$$typeof) {
case REACT_ELEMENT_TYPE: {
var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
- if (newChild.type === REACT_FRAGMENT_TYPE) {
- return updateFragment2(returnFiber, _matchedFiber, newChild.props.children, lanes, newChild.key);
- }
return updateElement(returnFiber, _matchedFiber, newChild, lanes);
}
case REACT_PORTAL_TYPE: {
var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
return updatePortal(returnFiber, _matchedFiber2, newChild, lanes);
}
+ case REACT_LAZY_TYPE:
+ var payload = newChild._payload;
+ var init = newChild._init;
+ return updateFromMap(existingChildren, returnFiber, newIdx, init(payload), lanes);
}
- if (isArray$1(newChild) || getIteratorFn(newChild)) {
+ if (isArray(newChild) || getIteratorFn(newChild)) {
var _matchedFiber3 = existingChildren.get(newIdx) || null;
return updateFragment2(returnFiber, _matchedFiber3, newChild, lanes, null);
}
@@ -12313,6 +13411,11 @@
}
error("Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted \u2014 the behavior is unsupported and could change in a future version.", key);
break;
+ case REACT_LAZY_TYPE:
+ var payload = child._payload;
+ var init = child._init;
+ warnOnInvalidKey(init(payload), knownKeys, returnFiber);
+ break;
}
}
return knownKeys;
@@ -12361,6 +13464,10 @@
}
if (newIdx === newChildren.length) {
deleteRemainingChildren(returnFiber, oldFiber);
+ if (getIsHydrating()) {
+ var numberOfForks = newIdx;
+ pushTreeFork(returnFiber, numberOfForks);
+ }
return resultingFirstChild;
}
if (oldFiber === null) {
@@ -12377,6 +13484,10 @@
}
previousNewFiber = _newFiber;
}
+ if (getIsHydrating()) {
+ var _numberOfForks = newIdx;
+ pushTreeFork(returnFiber, _numberOfForks);
+ }
return resultingFirstChild;
}
var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
@@ -12402,14 +13513,16 @@
return deleteChild(returnFiber, child2);
});
}
+ if (getIsHydrating()) {
+ var _numberOfForks2 = newIdx;
+ pushTreeFork(returnFiber, _numberOfForks2);
+ }
return resultingFirstChild;
}
function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, lanes) {
var iteratorFn = getIteratorFn(newChildrenIterable);
- if (!(typeof iteratorFn === "function")) {
- {
- throw Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.");
- }
+ if (typeof iteratorFn !== "function") {
+ throw new Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.");
}
{
if (typeof Symbol === "function" && // $FlowFixMe Flow doesn't know about toStringTag
@@ -12436,10 +13549,8 @@
}
}
var newChildren = iteratorFn.call(newChildrenIterable);
- if (!(newChildren != null)) {
- {
- throw Error("An iterable object provided no iterator.");
- }
+ if (newChildren == null) {
+ throw new Error("An iterable object provided no iterator.");
}
var resultingFirstChild = null;
var previousNewFiber = null;
@@ -12478,6 +13589,10 @@
}
if (step.done) {
deleteRemainingChildren(returnFiber, oldFiber);
+ if (getIsHydrating()) {
+ var numberOfForks = newIdx;
+ pushTreeFork(returnFiber, numberOfForks);
+ }
return resultingFirstChild;
}
if (oldFiber === null) {
@@ -12494,6 +13609,10 @@
}
previousNewFiber = _newFiber3;
}
+ if (getIsHydrating()) {
+ var _numberOfForks3 = newIdx;
+ pushTreeFork(returnFiber, _numberOfForks3);
+ }
return resultingFirstChild;
}
var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
@@ -12519,6 +13638,10 @@
return deleteChild(returnFiber, child2);
});
}
+ if (getIsHydrating()) {
+ var _numberOfForks4 = newIdx;
+ pushTreeFork(returnFiber, _numberOfForks4);
+ }
return resultingFirstChild;
}
function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, lanes) {
@@ -12538,35 +13661,34 @@
var child = currentFirstChild;
while (child !== null) {
if (child.key === key) {
- switch (child.tag) {
- case Fragment4: {
- if (element.type === REACT_FRAGMENT_TYPE) {
- deleteRemainingChildren(returnFiber, child.sibling);
- var existing = useFiber(child, element.props.children);
- existing.return = returnFiber;
- {
- existing._debugSource = element._source;
- existing._debugOwner = element._owner;
- }
- return existing;
+ var elementType = element.type;
+ if (elementType === REACT_FRAGMENT_TYPE) {
+ if (child.tag === Fragment4) {
+ deleteRemainingChildren(returnFiber, child.sibling);
+ var existing = useFiber(child, element.props.children);
+ existing.return = returnFiber;
+ {
+ existing._debugSource = element._source;
+ existing._debugOwner = element._owner;
}
- break;
+ return existing;
}
- case Block:
- default: {
- if (child.elementType === element.type || // Keep this check inline so it only runs on the false path:
- isCompatibleFamilyForHotReloading(child, element)) {
- deleteRemainingChildren(returnFiber, child.sibling);
- var _existing3 = useFiber(child, element.props);
- _existing3.ref = coerceRef(returnFiber, child, element);
- _existing3.return = returnFiber;
- {
- _existing3._debugSource = element._source;
- _existing3._debugOwner = element._owner;
- }
- return _existing3;
+ } else {
+ if (child.elementType === elementType || // Keep this check inline so it only runs on the false path:
+ isCompatibleFamilyForHotReloading(child, element) || // Lazy types should reconcile their resolved type.
+ // We need to do this after the Hot Reloading check above,
+ // because hot reloading has different semantics than prod because
+ // it doesn't resuspend. So we can't let the call below suspend.
+ typeof elementType === "object" && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === child.type) {
+ deleteRemainingChildren(returnFiber, child.sibling);
+ var _existing = useFiber(child, element.props);
+ _existing.ref = coerceRef(returnFiber, child, element);
+ _existing.return = returnFiber;
+ {
+ _existing._debugSource = element._source;
+ _existing._debugOwner = element._owner;
}
- break;
+ return _existing;
}
}
deleteRemainingChildren(returnFiber, child);
@@ -12615,54 +13737,33 @@
if (isUnkeyedTopLevelFragment) {
newChild = newChild.props.children;
}
- var isObject = typeof newChild === "object" && newChild !== null;
- if (isObject) {
+ if (typeof newChild === "object" && newChild !== null) {
switch (newChild.$$typeof) {
case REACT_ELEMENT_TYPE:
return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, lanes));
case REACT_PORTAL_TYPE:
return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, lanes));
+ case REACT_LAZY_TYPE:
+ var payload = newChild._payload;
+ var init = newChild._init;
+ return reconcileChildFibers2(returnFiber, currentFirstChild, init(payload), lanes);
+ }
+ if (isArray(newChild)) {
+ return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, lanes);
+ }
+ if (getIteratorFn(newChild)) {
+ return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, lanes);
}
+ throwOnInvalidObjectType(returnFiber, newChild);
}
- if (typeof newChild === "string" || typeof newChild === "number") {
+ if (typeof newChild === "string" && newChild !== "" || typeof newChild === "number") {
return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, "" + newChild, lanes));
}
- if (isArray$1(newChild)) {
- return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, lanes);
- }
- if (getIteratorFn(newChild)) {
- return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, lanes);
- }
- if (isObject) {
- throwOnInvalidObjectType(returnFiber, newChild);
- }
{
if (typeof newChild === "function") {
warnOnFunctionType(returnFiber);
}
}
- if (typeof newChild === "undefined" && !isUnkeyedTopLevelFragment) {
- switch (returnFiber.tag) {
- case ClassComponent: {
- {
- var instance = returnFiber.stateNode;
- if (instance.render._isMockFunction) {
- break;
- }
- }
- }
- case Block:
- case FunctionComponent:
- case ForwardRef:
- case SimpleMemoComponent: {
- {
- {
- throw Error((getComponentName(returnFiber.type) || "Component") + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.");
- }
- }
- }
- }
- }
return deleteRemainingChildren(returnFiber, currentFirstChild);
}
return reconcileChildFibers2;
@@ -12670,10 +13771,8 @@
var reconcileChildFibers = ChildReconciler(true);
var mountChildFibers = ChildReconciler(false);
function cloneChildFibers(current2, workInProgress2) {
- if (!(current2 === null || workInProgress2.child === current2.child)) {
- {
- throw Error("Resuming work not yet implemented.");
- }
+ if (current2 !== null && workInProgress2.child !== current2.child) {
+ throw new Error("Resuming work not yet implemented.");
}
if (workInProgress2.child === null) {
return;
@@ -12701,10 +13800,8 @@
var contextFiberStackCursor = createCursor(NO_CONTEXT);
var rootInstanceStackCursor = createCursor(NO_CONTEXT);
function requiredContext(c) {
- if (!(c !== NO_CONTEXT)) {
- {
- throw Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");
- }
+ if (c === NO_CONTEXT) {
+ throw new Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");
}
return c;
}
@@ -12778,16 +13875,9 @@
return false;
}
var props = workInProgress2.memoizedProps;
- if (props.fallback === void 0) {
- return false;
- }
- if (props.unstable_avoidThisFallback !== true) {
+ {
return true;
}
- if (hasInvisibleParent) {
- return false;
- }
- return true;
}
function findFirstSuspended(row) {
var node = row;
@@ -12827,244 +13917,26 @@
return null;
}
var NoFlags$1 = (
- /* */
+ /* */
0
);
var HasEffect = (
/* */
1
);
+ var Insertion = (
+ /* */
+ 2
+ );
var Layout = (
/* */
- 2
+ 4
);
var Passive$1 = (
/* */
- 4
+ 8
);
- var hydrationParentFiber = null;
- var nextHydratableInstance = null;
- var isHydrating = false;
- function enterHydrationState(fiber) {
- var parentInstance = fiber.stateNode.containerInfo;
- nextHydratableInstance = getFirstHydratableChild(parentInstance);
- hydrationParentFiber = fiber;
- isHydrating = true;
- return true;
- }
- function deleteHydratableInstance(returnFiber, instance) {
- {
- switch (returnFiber.tag) {
- case HostRoot:
- didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
- break;
- case HostComponent:
- didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
- break;
- }
- }
- var childToDelete = createFiberFromHostInstanceForDeletion();
- childToDelete.stateNode = instance;
- childToDelete.return = returnFiber;
- childToDelete.flags = Deletion;
- if (returnFiber.lastEffect !== null) {
- returnFiber.lastEffect.nextEffect = childToDelete;
- returnFiber.lastEffect = childToDelete;
- } else {
- returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
- }
- }
- function insertNonHydratedInstance(returnFiber, fiber) {
- fiber.flags = fiber.flags & ~Hydrating | Placement;
- {
- switch (returnFiber.tag) {
- case HostRoot: {
- var parentContainer = returnFiber.stateNode.containerInfo;
- switch (fiber.tag) {
- case HostComponent:
- var type = fiber.type;
- var props = fiber.pendingProps;
- didNotFindHydratableContainerInstance(parentContainer, type);
- break;
- case HostText:
- var text = fiber.pendingProps;
- didNotFindHydratableContainerTextInstance(parentContainer, text);
- break;
- }
- break;
- }
- case HostComponent: {
- var parentType = returnFiber.type;
- var parentProps = returnFiber.memoizedProps;
- var parentInstance = returnFiber.stateNode;
- switch (fiber.tag) {
- case HostComponent:
- var _type = fiber.type;
- var _props = fiber.pendingProps;
- didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type);
- break;
- case HostText:
- var _text = fiber.pendingProps;
- didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
- break;
- case SuspenseComponent:
- didNotFindHydratableSuspenseInstance(parentType, parentProps);
- break;
- }
- break;
- }
- default:
- return;
- }
- }
- }
- function tryHydrate(fiber, nextInstance) {
- switch (fiber.tag) {
- case HostComponent: {
- var type = fiber.type;
- var props = fiber.pendingProps;
- var instance = canHydrateInstance(nextInstance, type);
- if (instance !== null) {
- fiber.stateNode = instance;
- return true;
- }
- return false;
- }
- case HostText: {
- var text = fiber.pendingProps;
- var textInstance = canHydrateTextInstance(nextInstance, text);
- if (textInstance !== null) {
- fiber.stateNode = textInstance;
- return true;
- }
- return false;
- }
- case SuspenseComponent: {
- return false;
- }
- default:
- return false;
- }
- }
- function tryToClaimNextHydratableInstance(fiber) {
- if (!isHydrating) {
- return;
- }
- var nextInstance = nextHydratableInstance;
- if (!nextInstance) {
- insertNonHydratedInstance(hydrationParentFiber, fiber);
- isHydrating = false;
- hydrationParentFiber = fiber;
- return;
- }
- var firstAttemptedInstance = nextInstance;
- if (!tryHydrate(fiber, nextInstance)) {
- nextInstance = getNextHydratableSibling(firstAttemptedInstance);
- if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
- insertNonHydratedInstance(hydrationParentFiber, fiber);
- isHydrating = false;
- hydrationParentFiber = fiber;
- return;
- }
- deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance);
- }
- hydrationParentFiber = fiber;
- nextHydratableInstance = getFirstHydratableChild(nextInstance);
- }
- function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
- var instance = fiber.stateNode;
- var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber);
- fiber.updateQueue = updatePayload;
- if (updatePayload !== null) {
- return true;
- }
- return false;
- }
- function prepareToHydrateHostTextInstance(fiber) {
- var textInstance = fiber.stateNode;
- var textContent = fiber.memoizedProps;
- var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
- {
- if (shouldUpdate) {
- var returnFiber = hydrationParentFiber;
- if (returnFiber !== null) {
- switch (returnFiber.tag) {
- case HostRoot: {
- var parentContainer = returnFiber.stateNode.containerInfo;
- didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
- break;
- }
- case HostComponent: {
- var parentType = returnFiber.type;
- var parentProps = returnFiber.memoizedProps;
- var parentInstance = returnFiber.stateNode;
- didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
- break;
- }
- }
- }
- }
- }
- return shouldUpdate;
- }
- function skipPastDehydratedSuspenseInstance(fiber) {
- var suspenseState = fiber.memoizedState;
- var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
- if (!suspenseInstance) {
- {
- throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
- }
- }
- return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
- }
- function popToNextHostParent(fiber) {
- var parent = fiber.return;
- while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== SuspenseComponent) {
- parent = parent.return;
- }
- hydrationParentFiber = parent;
- }
- function popHydrationState(fiber) {
- if (fiber !== hydrationParentFiber) {
- return false;
- }
- if (!isHydrating) {
- popToNextHostParent(fiber);
- isHydrating = true;
- return false;
- }
- var type = fiber.type;
- if (fiber.tag !== HostComponent || type !== "head" && type !== "body" && !shouldSetTextContent(type, fiber.memoizedProps)) {
- var nextInstance = nextHydratableInstance;
- while (nextInstance) {
- deleteHydratableInstance(fiber, nextInstance);
- nextInstance = getNextHydratableSibling(nextInstance);
- }
- }
- popToNextHostParent(fiber);
- if (fiber.tag === SuspenseComponent) {
- nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber);
- } else {
- nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
- }
- return true;
- }
- function resetHydrationState() {
- hydrationParentFiber = null;
- nextHydratableInstance = null;
- isHydrating = false;
- }
- function getIsHydrating() {
- return isHydrating;
- }
var workInProgressSources = [];
- var rendererSigil$1;
- {
- rendererSigil$1 = {};
- }
- function markSourceAsDirty(mutableSource) {
- workInProgressSources.push(mutableSource);
- }
function resetWorkInProgressVersions() {
for (var i = 0; i < workInProgressSources.length; i++) {
var mutableSource = workInProgressSources[i];
@@ -13074,33 +13946,19 @@
}
workInProgressSources.length = 0;
}
- function getWorkInProgressVersion(mutableSource) {
- {
- return mutableSource._workInProgressVersionPrimary;
- }
- }
- function setWorkInProgressVersion(mutableSource, version) {
- {
- mutableSource._workInProgressVersionPrimary = version;
- }
- workInProgressSources.push(mutableSource);
- }
- function warnAboutMultipleRenderersDEV(mutableSource) {
- {
- {
- if (mutableSource._currentPrimaryRenderer == null) {
- mutableSource._currentPrimaryRenderer = rendererSigil$1;
- } else if (mutableSource._currentPrimaryRenderer !== rendererSigil$1) {
- error("Detected multiple renderers concurrently rendering the same mutable source. This is currently unsupported.");
- }
- }
+ function registerMutableSourceForHydration(root2, mutableSource) {
+ var getVersion = mutableSource._getVersion;
+ var version = getVersion(mutableSource._source);
+ if (root2.mutableSourceEagerHydrationData == null) {
+ root2.mutableSourceEagerHydrationData = [mutableSource, version];
+ } else {
+ root2.mutableSourceEagerHydrationData.push(mutableSource, version);
}
}
- var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig;
+ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig;
var didWarnAboutMismatchedHooksForComponent;
- var didWarnAboutUseOpaqueIdentifier;
+ var didWarnUncachedGetSnapshot;
{
- didWarnAboutUseOpaqueIdentifier = {};
didWarnAboutMismatchedHooksForComponent = /* @__PURE__ */ new Set();
}
var renderLanes = NoLanes;
@@ -13109,6 +13967,8 @@
var workInProgressHook = null;
var didScheduleRenderPhaseUpdate = false;
var didScheduleRenderPhaseUpdateDuringThisPass = false;
+ var localIdCounter = 0;
+ var globalClientIdCounter = 0;
var RE_RENDER_LIMIT = 25;
var currentHookNameInDev = null;
var hookTypesDev = null;
@@ -13137,14 +13997,14 @@
}
function checkDepsAreArrayDev(deps) {
{
- if (deps !== void 0 && deps !== null && !Array.isArray(deps)) {
+ if (deps !== void 0 && deps !== null && !isArray(deps)) {
error("%s received a final argument that is not an array (instead, received `%s`). When specified, the final argument must be an array.", currentHookNameInDev, typeof deps);
}
}
}
function warnOnHookMismatchInDev(currentHookName) {
{
- var componentName = getComponentName(currentlyRenderingFiber$1.type);
+ var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1);
if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
didWarnAboutMismatchedHooksForComponent.add(componentName);
if (hookTypesDev !== null) {
@@ -13166,11 +14026,7 @@
}
}
function throwInvalidHookError() {
- {
- {
- throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
- }
- }
+ throw new Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
}
function areHookInputsEqual(nextDeps, prevDeps) {
{
@@ -13222,10 +14078,9 @@
var numberOfReRenders = 0;
do {
didScheduleRenderPhaseUpdateDuringThisPass = false;
- if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
- {
- throw Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");
- }
+ localIdCounter = 0;
+ if (numberOfReRenders >= RE_RENDER_LIMIT) {
+ throw new Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");
}
numberOfReRenders += 1;
{
@@ -13254,18 +14109,33 @@
currentHookNameInDev = null;
hookTypesDev = null;
hookTypesUpdateIndexDev = -1;
+ if (current2 !== null && (current2.flags & StaticMask) !== (workInProgress2.flags & StaticMask) && // Disable this warning in legacy mode, because legacy Suspense is weird
+ // and creates false positives. To make this work in legacy mode, we'd
+ // need to mark fibers that commit in an incomplete state, somehow. For
+ // now I'll disable the warning that most of the bugs that would trigger
+ // it are either exclusive to concurrent mode or exist in both.
+ (current2.mode & ConcurrentMode) !== NoMode) {
+ error("Internal React error: Expected static flag was missing. Please notify the React team.");
+ }
}
didScheduleRenderPhaseUpdate = false;
- if (!!didRenderTooFewHooks) {
- {
- throw Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");
- }
+ if (didRenderTooFewHooks) {
+ throw new Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");
}
return children;
}
+ function checkDidRenderIdHook() {
+ var didRenderIdHook = localIdCounter !== 0;
+ localIdCounter = 0;
+ return didRenderIdHook;
+ }
function bailoutHooks(current2, workInProgress2, lanes) {
workInProgress2.updateQueue = current2.updateQueue;
- workInProgress2.flags &= ~(Passive | Update);
+ if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
+ workInProgress2.flags &= ~(MountPassiveDev | MountLayoutDev | Passive | Update);
+ } else {
+ workInProgress2.flags &= ~(Passive | Update);
+ }
current2.lanes = removeLanes(current2.lanes, lanes);
}
function resetHooksAfterThrow() {
@@ -13292,6 +14162,7 @@
isUpdatingOpaqueValueInRenderPhase = false;
}
didScheduleRenderPhaseUpdateDuringThisPass = false;
+ localIdCounter = 0;
}
function mountWorkInProgressHook() {
var hook = {
@@ -13331,10 +14202,8 @@
nextWorkInProgressHook = workInProgressHook.next;
currentHook = nextCurrentHook;
} else {
- if (!(nextCurrentHook !== null)) {
- {
- throw Error("Rendered more hooks than during the previous render.");
- }
+ if (nextCurrentHook === null) {
+ throw new Error("Rendered more hooks than during the previous render.");
}
currentHook = nextCurrentHook;
var newHook = {
@@ -13354,7 +14223,8 @@
}
function createFunctionComponentUpdateQueue() {
return {
- lastEffect: null
+ lastEffect: null,
+ stores: null
};
}
function basicStateReducer(state, action) {
@@ -13369,22 +14239,23 @@
initialState = initialArg;
}
hook.memoizedState = hook.baseState = initialState;
- var queue = hook.queue = {
+ var queue = {
pending: null,
+ interleaved: null,
+ lanes: NoLanes,
dispatch: null,
lastRenderedReducer: reducer,
lastRenderedState: initialState
};
- var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue);
+ hook.queue = queue;
+ var dispatch = queue.dispatch = dispatchReducerAction.bind(null, currentlyRenderingFiber$1, queue);
return [hook.memoizedState, dispatch];
}
function updateReducer(reducer, initialArg, init) {
var hook = updateWorkInProgressHook();
var queue = hook.queue;
- if (!(queue !== null)) {
- {
- throw Error("Should have a queue. This is likely a bug in React. Please file an issue.");
- }
+ if (queue === null) {
+ throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");
}
queue.lastRenderedReducer = reducer;
var current2 = currentHook;
@@ -13418,7 +14289,7 @@
var clone = {
lane: updateLane,
action: update.action,
- eagerReducer: update.eagerReducer,
+ hasEagerState: update.hasEagerState,
eagerState: update.eagerState,
next: null
};
@@ -13438,13 +14309,13 @@
// this will never be skipped by the check above.
lane: NoLane,
action: update.action,
- eagerReducer: update.eagerReducer,
+ hasEagerState: update.hasEagerState,
eagerState: update.eagerState,
next: null
};
newBaseQueueLast = newBaseQueueLast.next = _clone;
}
- if (update.eagerReducer === reducer) {
+ if (update.hasEagerState) {
newState = update.eagerState;
} else {
var action = update.action;
@@ -13466,16 +14337,26 @@
hook.baseQueue = newBaseQueueLast;
queue.lastRenderedState = newState;
}
+ var lastInterleaved = queue.interleaved;
+ if (lastInterleaved !== null) {
+ var interleaved = lastInterleaved;
+ do {
+ var interleavedLane = interleaved.lane;
+ currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, interleavedLane);
+ markSkippedUpdateLanes(interleavedLane);
+ interleaved = interleaved.next;
+ } while (interleaved !== lastInterleaved);
+ } else if (baseQueue === null) {
+ queue.lanes = NoLanes;
+ }
var dispatch = queue.dispatch;
return [hook.memoizedState, dispatch];
}
function rerenderReducer(reducer, initialArg, init) {
var hook = updateWorkInProgressHook();
var queue = hook.queue;
- if (!(queue !== null)) {
- {
- throw Error("Should have a queue. This is likely a bug in React. Please file an issue.");
- }
+ if (queue === null) {
+ throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");
}
queue.lastRenderedReducer = reducer;
var dispatch = queue.dispatch;
@@ -13501,136 +14382,150 @@
}
return [newState, dispatch];
}
- function readFromUnsubcribedMutableSource(root2, source, getSnapshot) {
+ function mountMutableSource(source, getSnapshot, subscribe) {
{
- warnAboutMultipleRenderersDEV(source);
+ return void 0;
}
- var getVersion = source._getVersion;
- var version = getVersion(source._source);
- var isSafeToReadFromSource = false;
- var currentRenderVersion = getWorkInProgressVersion(source);
- if (currentRenderVersion !== null) {
- isSafeToReadFromSource = currentRenderVersion === version;
- } else {
- isSafeToReadFromSource = isSubsetOfLanes(renderLanes, root2.mutableReadLanes);
- if (isSafeToReadFromSource) {
- setWorkInProgressVersion(source, version);
- }
+ }
+ function updateMutableSource(source, getSnapshot, subscribe) {
+ {
+ return void 0;
}
- if (isSafeToReadFromSource) {
- var snapshot = getSnapshot(source._source);
+ }
+ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
+ var fiber = currentlyRenderingFiber$1;
+ var hook = mountWorkInProgressHook();
+ var nextSnapshot;
+ var isHydrating2 = getIsHydrating();
+ if (isHydrating2) {
+ if (getServerSnapshot === void 0) {
+ throw new Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");
+ }
+ nextSnapshot = getServerSnapshot();
{
- if (typeof snapshot === "function") {
- error("Mutable source should not return a function as the snapshot value. Functions may close over mutable values and cause tearing.");
+ if (!didWarnUncachedGetSnapshot) {
+ if (nextSnapshot !== getServerSnapshot()) {
+ error("The result of getServerSnapshot should be cached to avoid an infinite loop");
+ didWarnUncachedGetSnapshot = true;
+ }
}
}
- return snapshot;
} else {
- markSourceAsDirty(source);
+ nextSnapshot = getSnapshot();
{
- {
- throw Error("Cannot read from mutable source during the current render without tearing. This is a bug in React. Please file an issue.");
+ if (!didWarnUncachedGetSnapshot) {
+ var cachedSnapshot = getSnapshot();
+ if (!objectIs(nextSnapshot, cachedSnapshot)) {
+ error("The result of getSnapshot should be cached to avoid an infinite loop");
+ didWarnUncachedGetSnapshot = true;
+ }
}
}
+ var root2 = getWorkInProgressRoot();
+ if (root2 === null) {
+ throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");
+ }
+ if (!includesBlockingLane(root2, renderLanes)) {
+ pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
+ }
}
+ hook.memoizedState = nextSnapshot;
+ var inst = {
+ value: nextSnapshot,
+ getSnapshot
+ };
+ hook.queue = inst;
+ mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]);
+ fiber.flags |= Passive;
+ pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), void 0, null);
+ return nextSnapshot;
}
- function useMutableSource(hook, source, getSnapshot, subscribe) {
- var root2 = getWorkInProgressRoot();
- if (!(root2 !== null)) {
- {
- throw Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");
- }
- }
- var getVersion = source._getVersion;
- var version = getVersion(source._source);
- var dispatcher = ReactCurrentDispatcher$1.current;
- var _dispatcher$useState = dispatcher.useState(function() {
- return readFromUnsubcribedMutableSource(root2, source, getSnapshot);
- }), currentSnapshot = _dispatcher$useState[0], setSnapshot = _dispatcher$useState[1];
- var snapshot = currentSnapshot;
- var stateHook = workInProgressHook;
- var memoizedState = hook.memoizedState;
- var refs = memoizedState.refs;
- var prevGetSnapshot = refs.getSnapshot;
- var prevSource = memoizedState.source;
- var prevSubscribe = memoizedState.subscribe;
+ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
var fiber = currentlyRenderingFiber$1;
- hook.memoizedState = {
- refs,
- source,
- subscribe
- };
- dispatcher.useEffect(function() {
- refs.getSnapshot = getSnapshot;
- refs.setSnapshot = setSnapshot;
- var maybeNewVersion = getVersion(source._source);
- if (!objectIs(version, maybeNewVersion)) {
- var maybeNewSnapshot = getSnapshot(source._source);
- {
- if (typeof maybeNewSnapshot === "function") {
- error("Mutable source should not return a function as the snapshot value. Functions may close over mutable values and cause tearing.");
- }
- }
- if (!objectIs(snapshot, maybeNewSnapshot)) {
- setSnapshot(maybeNewSnapshot);
- var lane = requestUpdateLane(fiber);
- markRootMutableRead(root2, lane);
+ var hook = updateWorkInProgressHook();
+ var nextSnapshot = getSnapshot();
+ {
+ if (!didWarnUncachedGetSnapshot) {
+ var cachedSnapshot = getSnapshot();
+ if (!objectIs(nextSnapshot, cachedSnapshot)) {
+ error("The result of getSnapshot should be cached to avoid an infinite loop");
+ didWarnUncachedGetSnapshot = true;
}
- markRootEntangled(root2, root2.mutableReadLanes);
}
- }, [getSnapshot, source, subscribe]);
- dispatcher.useEffect(function() {
- var handleChange = function() {
- var latestGetSnapshot = refs.getSnapshot;
- var latestSetSnapshot = refs.setSnapshot;
- try {
- latestSetSnapshot(latestGetSnapshot(source._source));
- var lane = requestUpdateLane(fiber);
- markRootMutableRead(root2, lane);
- } catch (error2) {
- latestSetSnapshot(function() {
- throw error2;
- });
- }
- };
- var unsubscribe = subscribe(source._source, handleChange);
- {
- if (typeof unsubscribe !== "function") {
- error("Mutable source subscribe function must return an unsubscribe function.");
- }
+ }
+ var prevSnapshot = hook.memoizedState;
+ var snapshotChanged = !objectIs(prevSnapshot, nextSnapshot);
+ if (snapshotChanged) {
+ hook.memoizedState = nextSnapshot;
+ markWorkInProgressReceivedUpdate();
+ }
+ var inst = hook.queue;
+ updateEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]);
+ if (inst.getSnapshot !== getSnapshot || snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
+ // checking whether we scheduled a subscription effect above.
+ workInProgressHook !== null && workInProgressHook.memoizedState.tag & HasEffect) {
+ fiber.flags |= Passive;
+ pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), void 0, null);
+ var root2 = getWorkInProgressRoot();
+ if (root2 === null) {
+ throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");
+ }
+ if (!includesBlockingLane(root2, renderLanes)) {
+ pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
}
- return unsubscribe;
- }, [source, subscribe]);
- if (!objectIs(prevGetSnapshot, getSnapshot) || !objectIs(prevSource, source) || !objectIs(prevSubscribe, subscribe)) {
- var newQueue = {
- pending: null,
- dispatch: null,
- lastRenderedReducer: basicStateReducer,
- lastRenderedState: snapshot
- };
- newQueue.dispatch = setSnapshot = dispatchAction.bind(null, currentlyRenderingFiber$1, newQueue);
- stateHook.queue = newQueue;
- stateHook.baseQueue = null;
- snapshot = readFromUnsubcribedMutableSource(root2, source, getSnapshot);
- stateHook.memoizedState = stateHook.baseState = snapshot;
}
- return snapshot;
+ return nextSnapshot;
}
- function mountMutableSource(source, getSnapshot, subscribe) {
- var hook = mountWorkInProgressHook();
- hook.memoizedState = {
- refs: {
- getSnapshot,
- setSnapshot: null
- },
- source,
- subscribe
+ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
+ fiber.flags |= StoreConsistency;
+ var check = {
+ getSnapshot,
+ value: renderedSnapshot
};
- return useMutableSource(hook, source, getSnapshot, subscribe);
+ var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue;
+ if (componentUpdateQueue === null) {
+ componentUpdateQueue = createFunctionComponentUpdateQueue();
+ currentlyRenderingFiber$1.updateQueue = componentUpdateQueue;
+ componentUpdateQueue.stores = [check];
+ } else {
+ var stores = componentUpdateQueue.stores;
+ if (stores === null) {
+ componentUpdateQueue.stores = [check];
+ } else {
+ stores.push(check);
+ }
+ }
}
- function updateMutableSource(source, getSnapshot, subscribe) {
- var hook = updateWorkInProgressHook();
- return useMutableSource(hook, source, getSnapshot, subscribe);
+ function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) {
+ inst.value = nextSnapshot;
+ inst.getSnapshot = getSnapshot;
+ if (checkIfSnapshotChanged(inst)) {
+ forceStoreRerender(fiber);
+ }
+ }
+ function subscribeToStore(fiber, inst, subscribe) {
+ var handleStoreChange = function() {
+ if (checkIfSnapshotChanged(inst)) {
+ forceStoreRerender(fiber);
+ }
+ };
+ return subscribe(handleStoreChange);
+ }
+ function checkIfSnapshotChanged(inst) {
+ var latestGetSnapshot = inst.getSnapshot;
+ var prevValue = inst.value;
+ try {
+ var nextValue = latestGetSnapshot();
+ return !objectIs(prevValue, nextValue);
+ } catch (error2) {
+ return true;
+ }
+ }
+ function forceStoreRerender(fiber) {
+ var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
+ if (root2 !== null) {
+ scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
+ }
}
function mountState(initialState) {
var hook = mountWorkInProgressHook();
@@ -13638,13 +14533,16 @@
initialState = initialState();
}
hook.memoizedState = hook.baseState = initialState;
- var queue = hook.queue = {
+ var queue = {
pending: null,
+ interleaved: null,
+ lanes: NoLanes,
dispatch: null,
lastRenderedReducer: basicStateReducer,
lastRenderedState: initialState
};
- var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue);
+ hook.queue = queue;
+ var dispatch = queue.dispatch = dispatchSetState.bind(null, currentlyRenderingFiber$1, queue);
return [hook.memoizedState, dispatch];
}
function updateState(initialState) {
@@ -13682,14 +14580,13 @@
}
function mountRef(initialValue) {
var hook = mountWorkInProgressHook();
- var ref = {
- current: initialValue
- };
{
- Object.seal(ref);
+ var _ref2 = {
+ current: initialValue
+ };
+ hook.memoizedState = _ref2;
+ return _ref2;
}
- hook.memoizedState = ref;
- return ref;
}
function updateRef(initialValue) {
var hook = updateWorkInProgressHook();
@@ -13711,7 +14608,7 @@
if (nextDeps !== null) {
var prevDeps = prevEffect.deps;
if (areHookInputsEqual(nextDeps, prevDeps)) {
- pushEffect(hookFlags, create, destroy, nextDeps);
+ hook.memoizedState = pushEffect(hookFlags, create, destroy, nextDeps);
return;
}
}
@@ -13720,23 +14617,30 @@
hook.memoizedState = pushEffect(HasEffect | hookFlags, create, destroy, nextDeps);
}
function mountEffect(create, deps) {
- {
- if ("undefined" !== typeof jest) {
- warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
- }
+ if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) {
+ return mountEffectImpl(MountPassiveDev | Passive | PassiveStatic, Passive$1, create, deps);
+ } else {
+ return mountEffectImpl(Passive | PassiveStatic, Passive$1, create, deps);
}
- return mountEffectImpl(Update | Passive, Passive$1, create, deps);
}
function updateEffect(create, deps) {
- {
- if ("undefined" !== typeof jest) {
- warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
- }
- }
- return updateEffectImpl(Update | Passive, Passive$1, create, deps);
+ return updateEffectImpl(Passive, Passive$1, create, deps);
+ }
+ function mountInsertionEffect(create, deps) {
+ return mountEffectImpl(Update, Insertion, create, deps);
+ }
+ function updateInsertionEffect(create, deps) {
+ return updateEffectImpl(Update, Insertion, create, deps);
}
function mountLayoutEffect(create, deps) {
- return mountEffectImpl(Update, Layout, create, deps);
+ var fiberFlags = Update;
+ {
+ fiberFlags |= LayoutStatic;
+ }
+ if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) {
+ fiberFlags |= MountLayoutDev;
+ }
+ return mountEffectImpl(fiberFlags, Layout, create, deps);
}
function updateLayoutEffect(create, deps) {
return updateEffectImpl(Update, Layout, create, deps);
@@ -13770,7 +14674,14 @@
}
}
var effectDeps = deps !== null && deps !== void 0 ? deps.concat([ref]) : null;
- return mountEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
+ var fiberFlags = Update;
+ {
+ fiberFlags |= LayoutStatic;
+ }
+ if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) {
+ fiberFlags |= MountLayoutDev;
+ }
+ return mountEffectImpl(fiberFlags, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
}
function updateImperativeHandle(ref, create, deps) {
{
@@ -13829,79 +14740,90 @@
return nextValue;
}
function mountDeferredValue(value) {
- var _mountState = mountState(value), prevValue = _mountState[0], setValue = _mountState[1];
- mountEffect(function() {
- var prevTransition = ReactCurrentBatchConfig$1.transition;
- ReactCurrentBatchConfig$1.transition = 1;
- try {
- setValue(value);
- } finally {
- ReactCurrentBatchConfig$1.transition = prevTransition;
- }
- }, [value]);
- return prevValue;
+ var hook = mountWorkInProgressHook();
+ hook.memoizedState = value;
+ return value;
}
function updateDeferredValue(value) {
- var _updateState = updateState(), prevValue = _updateState[0], setValue = _updateState[1];
- updateEffect(function() {
- var prevTransition = ReactCurrentBatchConfig$1.transition;
- ReactCurrentBatchConfig$1.transition = 1;
- try {
- setValue(value);
- } finally {
- ReactCurrentBatchConfig$1.transition = prevTransition;
- }
- }, [value]);
- return prevValue;
+ var hook = updateWorkInProgressHook();
+ var resolvedCurrentHook = currentHook;
+ var prevValue = resolvedCurrentHook.memoizedState;
+ return updateDeferredValueImpl(hook, prevValue, value);
}
function rerenderDeferredValue(value) {
- var _rerenderState = rerenderState(), prevValue = _rerenderState[0], setValue = _rerenderState[1];
- updateEffect(function() {
- var prevTransition = ReactCurrentBatchConfig$1.transition;
- ReactCurrentBatchConfig$1.transition = 1;
- try {
- setValue(value);
- } finally {
- ReactCurrentBatchConfig$1.transition = prevTransition;
+ var hook = updateWorkInProgressHook();
+ if (currentHook === null) {
+ hook.memoizedState = value;
+ return value;
+ } else {
+ var prevValue = currentHook.memoizedState;
+ return updateDeferredValueImpl(hook, prevValue, value);
+ }
+ }
+ function updateDeferredValueImpl(hook, prevValue, value) {
+ var shouldDeferValue = !includesOnlyNonUrgentLanes(renderLanes);
+ if (shouldDeferValue) {
+ if (!objectIs(value, prevValue)) {
+ var deferredLane = claimNextTransitionLane();
+ currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, deferredLane);
+ markSkippedUpdateLanes(deferredLane);
+ hook.baseState = true;
+ }
+ return prevValue;
+ } else {
+ if (hook.baseState) {
+ hook.baseState = false;
+ markWorkInProgressReceivedUpdate();
}
- }, [value]);
- return prevValue;
+ hook.memoizedState = value;
+ return value;
+ }
}
- function startTransition(setPending, callback) {
- var priorityLevel = getCurrentPriorityLevel();
+ function startTransition(setPending, callback, options2) {
+ var previousPriority = getCurrentUpdatePriority();
+ setCurrentUpdatePriority(higherEventPriority(previousPriority, ContinuousEventPriority));
+ setPending(true);
+ var prevTransition = ReactCurrentBatchConfig$2.transition;
+ ReactCurrentBatchConfig$2.transition = {};
+ var currentTransition = ReactCurrentBatchConfig$2.transition;
{
- runWithPriority$1(priorityLevel < UserBlockingPriority$2 ? UserBlockingPriority$2 : priorityLevel, function() {
- setPending(true);
- });
- runWithPriority$1(priorityLevel > NormalPriority$1 ? NormalPriority$1 : priorityLevel, function() {
- var prevTransition = ReactCurrentBatchConfig$1.transition;
- ReactCurrentBatchConfig$1.transition = 1;
- try {
- setPending(false);
- callback();
- } finally {
- ReactCurrentBatchConfig$1.transition = prevTransition;
+ ReactCurrentBatchConfig$2.transition._updatedFibers = /* @__PURE__ */ new Set();
+ }
+ try {
+ setPending(false);
+ callback();
+ } finally {
+ setCurrentUpdatePriority(previousPriority);
+ ReactCurrentBatchConfig$2.transition = prevTransition;
+ {
+ if (prevTransition === null && currentTransition._updatedFibers) {
+ var updatedFibersCount = currentTransition._updatedFibers.size;
+ if (updatedFibersCount > 10) {
+ warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.");
+ }
+ currentTransition._updatedFibers.clear();
}
- });
+ }
}
}
function mountTransition() {
- var _mountState2 = mountState(false), isPending = _mountState2[0], setPending = _mountState2[1];
+ var _mountState = mountState(false), isPending = _mountState[0], setPending = _mountState[1];
var start2 = startTransition.bind(null, setPending);
- mountRef(start2);
- return [start2, isPending];
+ var hook = mountWorkInProgressHook();
+ hook.memoizedState = start2;
+ return [isPending, start2];
}
function updateTransition() {
- var _updateState2 = updateState(), isPending = _updateState2[0];
- var startRef = updateRef();
- var start2 = startRef.current;
- return [start2, isPending];
+ var _updateState = updateState(), isPending = _updateState[0];
+ var hook = updateWorkInProgressHook();
+ var start2 = hook.memoizedState;
+ return [isPending, start2];
}
function rerenderTransition() {
- var _rerenderState2 = rerenderState(), isPending = _rerenderState2[0];
- var startRef = updateRef();
- var start2 = startRef.current;
- return [start2, isPending];
+ var _rerenderState = rerenderState(), isPending = _rerenderState[0];
+ var hook = updateWorkInProgressHook();
+ var start2 = hook.memoizedState;
+ return [isPending, start2];
}
var isUpdatingOpaqueValueInRenderPhase = false;
function getIsUpdatingOpaqueValueInRenderPhaseInDEV() {
@@ -13909,86 +14831,75 @@
return isUpdatingOpaqueValueInRenderPhase;
}
}
- function warnOnOpaqueIdentifierAccessInDEV(fiber) {
- {
- var name = getComponentName(fiber.type) || "Unknown";
- if (getIsRendering() && !didWarnAboutUseOpaqueIdentifier[name]) {
- error("The object passed back from useOpaqueIdentifier is meant to be passed through to attributes only. Do not read the value directly.");
- didWarnAboutUseOpaqueIdentifier[name] = true;
- }
- }
- }
- function mountOpaqueIdentifier() {
- var makeId = makeClientIdInDEV.bind(null, warnOnOpaqueIdentifierAccessInDEV.bind(null, currentlyRenderingFiber$1));
+ function mountId() {
+ var hook = mountWorkInProgressHook();
+ var root2 = getWorkInProgressRoot();
+ var identifierPrefix = root2.identifierPrefix;
+ var id;
if (getIsHydrating()) {
- var didUpgrade = false;
- var fiber = currentlyRenderingFiber$1;
- var readValue = function() {
- if (!didUpgrade) {
- didUpgrade = true;
- {
- isUpdatingOpaqueValueInRenderPhase = true;
- setId(makeId());
- isUpdatingOpaqueValueInRenderPhase = false;
- warnOnOpaqueIdentifierAccessInDEV(fiber);
- }
- }
- {
- {
- throw Error("The object passed back from useOpaqueIdentifier is meant to be passed through to attributes only. Do not read the value directly.");
- }
- }
- };
- var id = makeOpaqueHydratingObject(readValue);
- var setId = mountState(id)[1];
- if ((currentlyRenderingFiber$1.mode & BlockingMode) === NoMode) {
- currentlyRenderingFiber$1.flags |= Update | Passive;
- pushEffect(HasEffect | Passive$1, function() {
- setId(makeId());
- }, void 0, null);
- }
- return id;
+ var treeId = getTreeId();
+ id = ":" + identifierPrefix + "R" + treeId;
+ var localId = localIdCounter++;
+ if (localId > 0) {
+ id += "H" + localId.toString(32);
+ }
+ id += ":";
} else {
- var _id = makeId();
- mountState(_id);
- return _id;
+ var globalClientId = globalClientIdCounter++;
+ id = ":" + identifierPrefix + "r" + globalClientId.toString(32) + ":";
}
- }
- function updateOpaqueIdentifier() {
- var id = updateState()[0];
+ hook.memoizedState = id;
return id;
}
- function rerenderOpaqueIdentifier() {
- var id = rerenderState()[0];
+ function updateId() {
+ var hook = updateWorkInProgressHook();
+ var id = hook.memoizedState;
return id;
}
- function dispatchAction(fiber, queue, action) {
+ function dispatchReducerAction(fiber, queue, action) {
{
if (typeof arguments[3] === "function") {
error("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");
}
}
- var eventTime = requestEventTime();
var lane = requestUpdateLane(fiber);
var update = {
lane,
action,
- eagerReducer: null,
+ hasEagerState: false,
eagerState: null,
next: null
};
- var pending = queue.pending;
- if (pending === null) {
- update.next = update;
+ if (isRenderPhaseUpdate(fiber)) {
+ enqueueRenderPhaseUpdate(queue, update);
} else {
- update.next = pending.next;
- pending.next = update;
+ var root2 = enqueueConcurrentHookUpdate(fiber, queue, update, lane);
+ if (root2 !== null) {
+ var eventTime = requestEventTime();
+ scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
+ entangleTransitionUpdate(root2, queue, lane);
+ }
}
- queue.pending = update;
- var alternate = fiber.alternate;
- if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) {
- didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true;
+ markUpdateInDevTools(fiber, lane);
+ }
+ function dispatchSetState(fiber, queue, action) {
+ {
+ if (typeof arguments[3] === "function") {
+ error("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");
+ }
+ }
+ var lane = requestUpdateLane(fiber);
+ var update = {
+ lane,
+ action,
+ hasEagerState: false,
+ eagerState: null,
+ next: null
+ };
+ if (isRenderPhaseUpdate(fiber)) {
+ enqueueRenderPhaseUpdate(queue, update);
} else {
+ var alternate = fiber.alternate;
if (fiber.lanes === NoLanes && (alternate === null || alternate.lanes === NoLanes)) {
var lastRenderedReducer = queue.lastRenderedReducer;
if (lastRenderedReducer !== null) {
@@ -14000,9 +14911,10 @@
try {
var currentState = queue.lastRenderedState;
var eagerState = lastRenderedReducer(currentState, action);
- update.eagerReducer = lastRenderedReducer;
+ update.hasEagerState = true;
update.eagerState = eagerState;
if (objectIs(eagerState, currentState)) {
+ enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update, lane);
return;
}
} catch (error2) {
@@ -14013,13 +14925,42 @@
}
}
}
- {
- if ("undefined" !== typeof jest) {
- warnIfNotScopedWithMatchingAct(fiber);
- warnIfNotCurrentlyActingUpdatesInDev(fiber);
- }
+ var root2 = enqueueConcurrentHookUpdate(fiber, queue, update, lane);
+ if (root2 !== null) {
+ var eventTime = requestEventTime();
+ scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
+ entangleTransitionUpdate(root2, queue, lane);
}
- scheduleUpdateOnFiber(fiber, lane, eventTime);
+ }
+ markUpdateInDevTools(fiber, lane);
+ }
+ function isRenderPhaseUpdate(fiber) {
+ var alternate = fiber.alternate;
+ return fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1;
+ }
+ function enqueueRenderPhaseUpdate(queue, update) {
+ didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true;
+ var pending = queue.pending;
+ if (pending === null) {
+ update.next = update;
+ } else {
+ update.next = pending.next;
+ pending.next = update;
+ }
+ queue.pending = update;
+ }
+ function entangleTransitionUpdate(root2, queue, lane) {
+ if (isTransitionLane(lane)) {
+ var queueLanes = queue.lanes;
+ queueLanes = intersectLanes(queueLanes, root2.pendingLanes);
+ var newQueueLanes = mergeLanes(queueLanes, lane);
+ queue.lanes = newQueueLanes;
+ markRootEntangled(root2, newQueueLanes);
+ }
+ }
+ function markUpdateInDevTools(fiber, lane, action) {
+ {
+ markStateUpdateScheduled(fiber, lane);
}
}
var ContextOnlyDispatcher = {
@@ -14028,6 +14969,7 @@
useContext: throwInvalidHookError,
useEffect: throwInvalidHookError,
useImperativeHandle: throwInvalidHookError,
+ useInsertionEffect: throwInvalidHookError,
useLayoutEffect: throwInvalidHookError,
useMemo: throwInvalidHookError,
useReducer: throwInvalidHookError,
@@ -14037,7 +14979,8 @@
useDeferredValue: throwInvalidHookError,
useTransition: throwInvalidHookError,
useMutableSource: throwInvalidHookError,
- useOpaqueIdentifier: throwInvalidHookError,
+ useSyncExternalStore: throwInvalidHookError,
+ useId: throwInvalidHookError,
unstable_isNewReconciler: enableNewReconciler
};
var HooksDispatcherOnMountInDEV = null;
@@ -14055,8 +14998,8 @@
error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks");
};
HooksDispatcherOnMountInDEV = {
- readContext: function(context, observedBits) {
- return readContext(context, observedBits);
+ readContext: function(context) {
+ return readContext(context);
},
useCallback: function(callback, deps) {
currentHookNameInDev = "useCallback";
@@ -14064,10 +15007,10 @@
checkDepsAreArrayDev(deps);
return mountCallback(callback, deps);
},
- useContext: function(context, observedBits) {
+ useContext: function(context) {
currentHookNameInDev = "useContext";
mountHookTypesDev();
- return readContext(context, observedBits);
+ return readContext(context);
},
useEffect: function(create, deps) {
currentHookNameInDev = "useEffect";
@@ -14081,6 +15024,12 @@
checkDepsAreArrayDev(deps);
return mountImperativeHandle(ref, create, deps);
},
+ useInsertionEffect: function(create, deps) {
+ currentHookNameInDev = "useInsertionEffect";
+ mountHookTypesDev();
+ checkDepsAreArrayDev(deps);
+ return mountInsertionEffect(create, deps);
+ },
useLayoutEffect: function(create, deps) {
currentHookNameInDev = "useLayoutEffect";
mountHookTypesDev();
@@ -14144,28 +15093,33 @@
useMutableSource: function(source, getSnapshot, subscribe) {
currentHookNameInDev = "useMutableSource";
mountHookTypesDev();
- return mountMutableSource(source, getSnapshot, subscribe);
+ return mountMutableSource();
},
- useOpaqueIdentifier: function() {
- currentHookNameInDev = "useOpaqueIdentifier";
+ useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
+ currentHookNameInDev = "useSyncExternalStore";
mountHookTypesDev();
- return mountOpaqueIdentifier();
+ return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
+ },
+ useId: function() {
+ currentHookNameInDev = "useId";
+ mountHookTypesDev();
+ return mountId();
},
unstable_isNewReconciler: enableNewReconciler
};
HooksDispatcherOnMountWithHookTypesInDEV = {
- readContext: function(context, observedBits) {
- return readContext(context, observedBits);
+ readContext: function(context) {
+ return readContext(context);
},
useCallback: function(callback, deps) {
currentHookNameInDev = "useCallback";
updateHookTypesDev();
return mountCallback(callback, deps);
},
- useContext: function(context, observedBits) {
+ useContext: function(context) {
currentHookNameInDev = "useContext";
updateHookTypesDev();
- return readContext(context, observedBits);
+ return readContext(context);
},
useEffect: function(create, deps) {
currentHookNameInDev = "useEffect";
@@ -14177,6 +15131,11 @@
updateHookTypesDev();
return mountImperativeHandle(ref, create, deps);
},
+ useInsertionEffect: function(create, deps) {
+ currentHookNameInDev = "useInsertionEffect";
+ updateHookTypesDev();
+ return mountInsertionEffect(create, deps);
+ },
useLayoutEffect: function(create, deps) {
currentHookNameInDev = "useLayoutEffect";
updateHookTypesDev();
@@ -14238,28 +15197,33 @@
useMutableSource: function(source, getSnapshot, subscribe) {
currentHookNameInDev = "useMutableSource";
updateHookTypesDev();
- return mountMutableSource(source, getSnapshot, subscribe);
+ return mountMutableSource();
+ },
+ useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
+ currentHookNameInDev = "useSyncExternalStore";
+ updateHookTypesDev();
+ return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
},
- useOpaqueIdentifier: function() {
- currentHookNameInDev = "useOpaqueIdentifier";
+ useId: function() {
+ currentHookNameInDev = "useId";
updateHookTypesDev();
- return mountOpaqueIdentifier();
+ return mountId();
},
unstable_isNewReconciler: enableNewReconciler
};
HooksDispatcherOnUpdateInDEV = {
- readContext: function(context, observedBits) {
- return readContext(context, observedBits);
+ readContext: function(context) {
+ return readContext(context);
},
useCallback: function(callback, deps) {
currentHookNameInDev = "useCallback";
updateHookTypesDev();
return updateCallback(callback, deps);
},
- useContext: function(context, observedBits) {
+ useContext: function(context) {
currentHookNameInDev = "useContext";
updateHookTypesDev();
- return readContext(context, observedBits);
+ return readContext(context);
},
useEffect: function(create, deps) {
currentHookNameInDev = "useEffect";
@@ -14271,6 +15235,11 @@
updateHookTypesDev();
return updateImperativeHandle(ref, create, deps);
},
+ useInsertionEffect: function(create, deps) {
+ currentHookNameInDev = "useInsertionEffect";
+ updateHookTypesDev();
+ return updateInsertionEffect(create, deps);
+ },
useLayoutEffect: function(create, deps) {
currentHookNameInDev = "useLayoutEffect";
updateHookTypesDev();
@@ -14332,28 +15301,33 @@
useMutableSource: function(source, getSnapshot, subscribe) {
currentHookNameInDev = "useMutableSource";
updateHookTypesDev();
- return updateMutableSource(source, getSnapshot, subscribe);
+ return updateMutableSource();
+ },
+ useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
+ currentHookNameInDev = "useSyncExternalStore";
+ updateHookTypesDev();
+ return updateSyncExternalStore(subscribe, getSnapshot);
},
- useOpaqueIdentifier: function() {
- currentHookNameInDev = "useOpaqueIdentifier";
+ useId: function() {
+ currentHookNameInDev = "useId";
updateHookTypesDev();
- return updateOpaqueIdentifier();
+ return updateId();
},
unstable_isNewReconciler: enableNewReconciler
};
HooksDispatcherOnRerenderInDEV = {
- readContext: function(context, observedBits) {
- return readContext(context, observedBits);
+ readContext: function(context) {
+ return readContext(context);
},
useCallback: function(callback, deps) {
currentHookNameInDev = "useCallback";
updateHookTypesDev();
return updateCallback(callback, deps);
},
- useContext: function(context, observedBits) {
+ useContext: function(context) {
currentHookNameInDev = "useContext";
updateHookTypesDev();
- return readContext(context, observedBits);
+ return readContext(context);
},
useEffect: function(create, deps) {
currentHookNameInDev = "useEffect";
@@ -14365,6 +15339,11 @@
updateHookTypesDev();
return updateImperativeHandle(ref, create, deps);
},
+ useInsertionEffect: function(create, deps) {
+ currentHookNameInDev = "useInsertionEffect";
+ updateHookTypesDev();
+ return updateInsertionEffect(create, deps);
+ },
useLayoutEffect: function(create, deps) {
currentHookNameInDev = "useLayoutEffect";
updateHookTypesDev();
@@ -14426,19 +15405,24 @@
useMutableSource: function(source, getSnapshot, subscribe) {
currentHookNameInDev = "useMutableSource";
updateHookTypesDev();
- return updateMutableSource(source, getSnapshot, subscribe);
+ return updateMutableSource();
+ },
+ useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
+ currentHookNameInDev = "useSyncExternalStore";
+ updateHookTypesDev();
+ return updateSyncExternalStore(subscribe, getSnapshot);
},
- useOpaqueIdentifier: function() {
- currentHookNameInDev = "useOpaqueIdentifier";
+ useId: function() {
+ currentHookNameInDev = "useId";
updateHookTypesDev();
- return rerenderOpaqueIdentifier();
+ return updateId();
},
unstable_isNewReconciler: enableNewReconciler
};
InvalidNestedHooksDispatcherOnMountInDEV = {
- readContext: function(context, observedBits) {
+ readContext: function(context) {
warnInvalidContextAccess();
- return readContext(context, observedBits);
+ return readContext(context);
},
useCallback: function(callback, deps) {
currentHookNameInDev = "useCallback";
@@ -14446,11 +15430,11 @@
mountHookTypesDev();
return mountCallback(callback, deps);
},
- useContext: function(context, observedBits) {
+ useContext: function(context) {
currentHookNameInDev = "useContext";
warnInvalidHookAccess();
mountHookTypesDev();
- return readContext(context, observedBits);
+ return readContext(context);
},
useEffect: function(create, deps) {
currentHookNameInDev = "useEffect";
@@ -14464,6 +15448,12 @@
mountHookTypesDev();
return mountImperativeHandle(ref, create, deps);
},
+ useInsertionEffect: function(create, deps) {
+ currentHookNameInDev = "useInsertionEffect";
+ warnInvalidHookAccess();
+ mountHookTypesDev();
+ return mountInsertionEffect(create, deps);
+ },
useLayoutEffect: function(create, deps) {
currentHookNameInDev = "useLayoutEffect";
warnInvalidHookAccess();
@@ -14534,20 +15524,26 @@
currentHookNameInDev = "useMutableSource";
warnInvalidHookAccess();
mountHookTypesDev();
- return mountMutableSource(source, getSnapshot, subscribe);
+ return mountMutableSource();
},
- useOpaqueIdentifier: function() {
- currentHookNameInDev = "useOpaqueIdentifier";
+ useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
+ currentHookNameInDev = "useSyncExternalStore";
warnInvalidHookAccess();
mountHookTypesDev();
- return mountOpaqueIdentifier();
+ return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
+ },
+ useId: function() {
+ currentHookNameInDev = "useId";
+ warnInvalidHookAccess();
+ mountHookTypesDev();
+ return mountId();
},
unstable_isNewReconciler: enableNewReconciler
};
InvalidNestedHooksDispatcherOnUpdateInDEV = {
- readContext: function(context, observedBits) {
+ readContext: function(context) {
warnInvalidContextAccess();
- return readContext(context, observedBits);
+ return readContext(context);
},
useCallback: function(callback, deps) {
currentHookNameInDev = "useCallback";
@@ -14555,11 +15551,11 @@
updateHookTypesDev();
return updateCallback(callback, deps);
},
- useContext: function(context, observedBits) {
+ useContext: function(context) {
currentHookNameInDev = "useContext";
warnInvalidHookAccess();
updateHookTypesDev();
- return readContext(context, observedBits);
+ return readContext(context);
},
useEffect: function(create, deps) {
currentHookNameInDev = "useEffect";
@@ -14573,6 +15569,12 @@
updateHookTypesDev();
return updateImperativeHandle(ref, create, deps);
},
+ useInsertionEffect: function(create, deps) {
+ currentHookNameInDev = "useInsertionEffect";
+ warnInvalidHookAccess();
+ updateHookTypesDev();
+ return updateInsertionEffect(create, deps);
+ },
useLayoutEffect: function(create, deps) {
currentHookNameInDev = "useLayoutEffect";
warnInvalidHookAccess();
@@ -14643,20 +15645,26 @@
currentHookNameInDev = "useMutableSource";
warnInvalidHookAccess();
updateHookTypesDev();
- return updateMutableSource(source, getSnapshot, subscribe);
+ return updateMutableSource();
+ },
+ useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
+ currentHookNameInDev = "useSyncExternalStore";
+ warnInvalidHookAccess();
+ updateHookTypesDev();
+ return updateSyncExternalStore(subscribe, getSnapshot);
},
- useOpaqueIdentifier: function() {
- currentHookNameInDev = "useOpaqueIdentifier";
+ useId: function() {
+ currentHookNameInDev = "useId";
warnInvalidHookAccess();
updateHookTypesDev();
- return updateOpaqueIdentifier();
+ return updateId();
},
unstable_isNewReconciler: enableNewReconciler
};
InvalidNestedHooksDispatcherOnRerenderInDEV = {
- readContext: function(context, observedBits) {
+ readContext: function(context) {
warnInvalidContextAccess();
- return readContext(context, observedBits);
+ return readContext(context);
},
useCallback: function(callback, deps) {
currentHookNameInDev = "useCallback";
@@ -14664,11 +15672,11 @@
updateHookTypesDev();
return updateCallback(callback, deps);
},
- useContext: function(context, observedBits) {
+ useContext: function(context) {
currentHookNameInDev = "useContext";
warnInvalidHookAccess();
updateHookTypesDev();
- return readContext(context, observedBits);
+ return readContext(context);
},
useEffect: function(create, deps) {
currentHookNameInDev = "useEffect";
@@ -14682,6 +15690,12 @@
updateHookTypesDev();
return updateImperativeHandle(ref, create, deps);
},
+ useInsertionEffect: function(create, deps) {
+ currentHookNameInDev = "useInsertionEffect";
+ warnInvalidHookAccess();
+ updateHookTypesDev();
+ return updateInsertionEffect(create, deps);
+ },
useLayoutEffect: function(create, deps) {
currentHookNameInDev = "useLayoutEffect";
warnInvalidHookAccess();
@@ -14752,20 +15766,50 @@
currentHookNameInDev = "useMutableSource";
warnInvalidHookAccess();
updateHookTypesDev();
- return updateMutableSource(source, getSnapshot, subscribe);
+ return updateMutableSource();
},
- useOpaqueIdentifier: function() {
- currentHookNameInDev = "useOpaqueIdentifier";
+ useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
+ currentHookNameInDev = "useSyncExternalStore";
warnInvalidHookAccess();
updateHookTypesDev();
- return rerenderOpaqueIdentifier();
+ return updateSyncExternalStore(subscribe, getSnapshot);
+ },
+ useId: function() {
+ currentHookNameInDev = "useId";
+ warnInvalidHookAccess();
+ updateHookTypesDev();
+ return updateId();
},
unstable_isNewReconciler: enableNewReconciler
};
}
var now$1 = Scheduler.unstable_now;
var commitTime = 0;
+ var layoutEffectStartTime = -1;
var profilerStartTime = -1;
+ var passiveEffectStartTime = -1;
+ var currentUpdateIsNested = false;
+ var nestedUpdateScheduled = false;
+ function isCurrentUpdateNested() {
+ return currentUpdateIsNested;
+ }
+ function markNestedUpdateScheduled() {
+ {
+ nestedUpdateScheduled = true;
+ }
+ }
+ function resetNestedUpdateFlag() {
+ {
+ currentUpdateIsNested = false;
+ nestedUpdateScheduled = false;
+ }
+ }
+ function syncNestedUpdateFlag() {
+ {
+ currentUpdateIsNested = nestedUpdateScheduled;
+ nestedUpdateScheduled = false;
+ }
+ }
function getCommitTime() {
return commitTime;
}
@@ -14791,6 +15835,56 @@
profilerStartTime = -1;
}
}
+ function recordLayoutEffectDuration(fiber) {
+ if (layoutEffectStartTime >= 0) {
+ var elapsedTime = now$1() - layoutEffectStartTime;
+ layoutEffectStartTime = -1;
+ var parentFiber = fiber.return;
+ while (parentFiber !== null) {
+ switch (parentFiber.tag) {
+ case HostRoot:
+ var root2 = parentFiber.stateNode;
+ root2.effectDuration += elapsedTime;
+ return;
+ case Profiler:
+ var parentStateNode = parentFiber.stateNode;
+ parentStateNode.effectDuration += elapsedTime;
+ return;
+ }
+ parentFiber = parentFiber.return;
+ }
+ }
+ }
+ function recordPassiveEffectDuration(fiber) {
+ if (passiveEffectStartTime >= 0) {
+ var elapsedTime = now$1() - passiveEffectStartTime;
+ passiveEffectStartTime = -1;
+ var parentFiber = fiber.return;
+ while (parentFiber !== null) {
+ switch (parentFiber.tag) {
+ case HostRoot:
+ var root2 = parentFiber.stateNode;
+ if (root2 !== null) {
+ root2.passiveEffectDuration += elapsedTime;
+ }
+ return;
+ case Profiler:
+ var parentStateNode = parentFiber.stateNode;
+ if (parentStateNode !== null) {
+ parentStateNode.passiveEffectDuration += elapsedTime;
+ }
+ return;
+ }
+ parentFiber = parentFiber.return;
+ }
+ }
+ }
+ function startLayoutEffectTimer() {
+ layoutEffectStartTime = now$1();
+ }
+ function startPassiveEffectTimer() {
+ passiveEffectStartTime = now$1();
+ }
function transferActualDuration(fiber) {
var child = fiber.child;
while (child) {
@@ -14798,6 +15892,286 @@
child = child.sibling;
}
}
+ function createCapturedValueAtFiber(value, source) {
+ return {
+ value,
+ source,
+ stack: getStackByFiberInDevAndProd(source),
+ digest: null
+ };
+ }
+ function createCapturedValue(value, digest, stack) {
+ return {
+ value,
+ source: null,
+ stack: stack != null ? stack : null,
+ digest: digest != null ? digest : null
+ };
+ }
+ function showErrorDialog(boundary, errorInfo) {
+ return true;
+ }
+ function logCapturedError(boundary, errorInfo) {
+ try {
+ var logError = showErrorDialog(boundary, errorInfo);
+ if (logError === false) {
+ return;
+ }
+ var error2 = errorInfo.value;
+ if (true) {
+ var source = errorInfo.source;
+ var stack = errorInfo.stack;
+ var componentStack = stack !== null ? stack : "";
+ if (error2 != null && error2._suppressLogging) {
+ if (boundary.tag === ClassComponent) {
+ return;
+ }
+ console["error"](error2);
+ }
+ var componentName = source ? getComponentNameFromFiber(source) : null;
+ var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : "The above error occurred in one of your React components:";
+ var errorBoundaryMessage;
+ if (boundary.tag === HostRoot) {
+ errorBoundaryMessage = "Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://reactjs.org/link/error-boundaries to learn more about error boundaries.";
+ } else {
+ var errorBoundaryName = getComponentNameFromFiber(boundary) || "Anonymous";
+ errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + ".");
+ }
+ var combinedMessage = componentNameMessage + "\n" + componentStack + "\n\n" + ("" + errorBoundaryMessage);
+ console["error"](combinedMessage);
+ } else {
+ console["error"](error2);
+ }
+ } catch (e) {
+ setTimeout(function() {
+ throw e;
+ });
+ }
+ }
+ var PossiblyWeakMap$1 = typeof WeakMap === "function" ? WeakMap : Map;
+ function createRootErrorUpdate(fiber, errorInfo, lane) {
+ var update = createUpdate(NoTimestamp, lane);
+ update.tag = CaptureUpdate;
+ update.payload = {
+ element: null
+ };
+ var error2 = errorInfo.value;
+ update.callback = function() {
+ onUncaughtError(error2);
+ logCapturedError(fiber, errorInfo);
+ };
+ return update;
+ }
+ function createClassErrorUpdate(fiber, errorInfo, lane) {
+ var update = createUpdate(NoTimestamp, lane);
+ update.tag = CaptureUpdate;
+ var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
+ if (typeof getDerivedStateFromError === "function") {
+ var error$1 = errorInfo.value;
+ update.payload = function() {
+ return getDerivedStateFromError(error$1);
+ };
+ update.callback = function() {
+ {
+ markFailedErrorBoundaryForHotReloading(fiber);
+ }
+ logCapturedError(fiber, errorInfo);
+ };
+ }
+ var inst = fiber.stateNode;
+ if (inst !== null && typeof inst.componentDidCatch === "function") {
+ update.callback = function callback() {
+ {
+ markFailedErrorBoundaryForHotReloading(fiber);
+ }
+ logCapturedError(fiber, errorInfo);
+ if (typeof getDerivedStateFromError !== "function") {
+ markLegacyErrorBoundaryAsFailed(this);
+ }
+ var error$12 = errorInfo.value;
+ var stack = errorInfo.stack;
+ this.componentDidCatch(error$12, {
+ componentStack: stack !== null ? stack : ""
+ });
+ {
+ if (typeof getDerivedStateFromError !== "function") {
+ if (!includesSomeLane(fiber.lanes, SyncLane)) {
+ error("%s: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.", getComponentNameFromFiber(fiber) || "Unknown");
+ }
+ }
+ }
+ };
+ }
+ return update;
+ }
+ function attachPingListener(root2, wakeable, lanes) {
+ var pingCache = root2.pingCache;
+ var threadIDs;
+ if (pingCache === null) {
+ pingCache = root2.pingCache = new PossiblyWeakMap$1();
+ threadIDs = /* @__PURE__ */ new Set();
+ pingCache.set(wakeable, threadIDs);
+ } else {
+ threadIDs = pingCache.get(wakeable);
+ if (threadIDs === void 0) {
+ threadIDs = /* @__PURE__ */ new Set();
+ pingCache.set(wakeable, threadIDs);
+ }
+ }
+ if (!threadIDs.has(lanes)) {
+ threadIDs.add(lanes);
+ var ping = pingSuspendedRoot.bind(null, root2, wakeable, lanes);
+ {
+ if (isDevToolsPresent) {
+ restorePendingUpdaters(root2, lanes);
+ }
+ }
+ wakeable.then(ping, ping);
+ }
+ }
+ function attachRetryListener(suspenseBoundary, root2, wakeable, lanes) {
+ var wakeables = suspenseBoundary.updateQueue;
+ if (wakeables === null) {
+ var updateQueue = /* @__PURE__ */ new Set();
+ updateQueue.add(wakeable);
+ suspenseBoundary.updateQueue = updateQueue;
+ } else {
+ wakeables.add(wakeable);
+ }
+ }
+ function resetSuspendedComponent(sourceFiber, rootRenderLanes) {
+ var tag = sourceFiber.tag;
+ if ((sourceFiber.mode & ConcurrentMode) === NoMode && (tag === FunctionComponent || tag === ForwardRef || tag === SimpleMemoComponent)) {
+ var currentSource = sourceFiber.alternate;
+ if (currentSource) {
+ sourceFiber.updateQueue = currentSource.updateQueue;
+ sourceFiber.memoizedState = currentSource.memoizedState;
+ sourceFiber.lanes = currentSource.lanes;
+ } else {
+ sourceFiber.updateQueue = null;
+ sourceFiber.memoizedState = null;
+ }
+ }
+ }
+ function getNearestSuspenseBoundaryToCapture(returnFiber) {
+ var node = returnFiber;
+ do {
+ if (node.tag === SuspenseComponent && shouldCaptureSuspense(node)) {
+ return node;
+ }
+ node = node.return;
+ } while (node !== null);
+ return null;
+ }
+ function markSuspenseBoundaryShouldCapture(suspenseBoundary, returnFiber, sourceFiber, root2, rootRenderLanes) {
+ if ((suspenseBoundary.mode & ConcurrentMode) === NoMode) {
+ if (suspenseBoundary === returnFiber) {
+ suspenseBoundary.flags |= ShouldCapture;
+ } else {
+ suspenseBoundary.flags |= DidCapture;
+ sourceFiber.flags |= ForceUpdateForLegacySuspense;
+ sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete);
+ if (sourceFiber.tag === ClassComponent) {
+ var currentSourceFiber = sourceFiber.alternate;
+ if (currentSourceFiber === null) {
+ sourceFiber.tag = IncompleteClassComponent;
+ } else {
+ var update = createUpdate(NoTimestamp, SyncLane);
+ update.tag = ForceUpdate;
+ enqueueUpdate(sourceFiber, update, SyncLane);
+ }
+ }
+ sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane);
+ }
+ return suspenseBoundary;
+ }
+ suspenseBoundary.flags |= ShouldCapture;
+ suspenseBoundary.lanes = rootRenderLanes;
+ return suspenseBoundary;
+ }
+ function throwException(root2, returnFiber, sourceFiber, value, rootRenderLanes) {
+ sourceFiber.flags |= Incomplete;
+ {
+ if (isDevToolsPresent) {
+ restorePendingUpdaters(root2, rootRenderLanes);
+ }
+ }
+ if (value !== null && typeof value === "object" && typeof value.then === "function") {
+ var wakeable = value;
+ resetSuspendedComponent(sourceFiber);
+ {
+ if (getIsHydrating() && sourceFiber.mode & ConcurrentMode) {
+ markDidThrowWhileHydratingDEV();
+ }
+ }
+ var suspenseBoundary = getNearestSuspenseBoundaryToCapture(returnFiber);
+ if (suspenseBoundary !== null) {
+ suspenseBoundary.flags &= ~ForceClientRender;
+ markSuspenseBoundaryShouldCapture(suspenseBoundary, returnFiber, sourceFiber, root2, rootRenderLanes);
+ if (suspenseBoundary.mode & ConcurrentMode) {
+ attachPingListener(root2, wakeable, rootRenderLanes);
+ }
+ attachRetryListener(suspenseBoundary, root2, wakeable);
+ return;
+ } else {
+ if (!includesSyncLane(rootRenderLanes)) {
+ attachPingListener(root2, wakeable, rootRenderLanes);
+ renderDidSuspendDelayIfPossible();
+ return;
+ }
+ var uncaughtSuspenseError = new Error("A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.");
+ value = uncaughtSuspenseError;
+ }
+ } else {
+ if (getIsHydrating() && sourceFiber.mode & ConcurrentMode) {
+ markDidThrowWhileHydratingDEV();
+ var _suspenseBoundary = getNearestSuspenseBoundaryToCapture(returnFiber);
+ if (_suspenseBoundary !== null) {
+ if ((_suspenseBoundary.flags & ShouldCapture) === NoFlags) {
+ _suspenseBoundary.flags |= ForceClientRender;
+ }
+ markSuspenseBoundaryShouldCapture(_suspenseBoundary, returnFiber, sourceFiber, root2, rootRenderLanes);
+ queueHydrationError(createCapturedValueAtFiber(value, sourceFiber));
+ return;
+ }
+ }
+ }
+ value = createCapturedValueAtFiber(value, sourceFiber);
+ renderDidError(value);
+ var workInProgress2 = returnFiber;
+ do {
+ switch (workInProgress2.tag) {
+ case HostRoot: {
+ var _errorInfo = value;
+ workInProgress2.flags |= ShouldCapture;
+ var lane = pickArbitraryLane(rootRenderLanes);
+ workInProgress2.lanes = mergeLanes(workInProgress2.lanes, lane);
+ var update = createRootErrorUpdate(workInProgress2, _errorInfo, lane);
+ enqueueCapturedUpdate(workInProgress2, update);
+ return;
+ }
+ case ClassComponent:
+ var errorInfo = value;
+ var ctor = workInProgress2.type;
+ var instance = workInProgress2.stateNode;
+ if ((workInProgress2.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === "function" || instance !== null && typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance))) {
+ workInProgress2.flags |= ShouldCapture;
+ var _lane = pickArbitraryLane(rootRenderLanes);
+ workInProgress2.lanes = mergeLanes(workInProgress2.lanes, _lane);
+ var _update = createClassErrorUpdate(workInProgress2, errorInfo, _lane);
+ enqueueCapturedUpdate(workInProgress2, _update);
+ return;
+ }
+ break;
+ }
+ workInProgress2 = workInProgress2.return;
+ } while (workInProgress2 !== null);
+ }
+ function getSuspendedCache() {
+ {
+ return null;
+ }
+ }
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
var didReceiveUpdate = false;
var didWarnAboutBadClass;
@@ -14839,7 +16213,7 @@
nextProps,
// Resolved props
"prop",
- getComponentName(Component7)
+ getComponentNameFromType(Component7)
);
}
}
@@ -14847,30 +16221,42 @@
var render2 = Component7.render;
var ref = workInProgress2.ref;
var nextChildren;
+ var hasId;
prepareToReadContext(workInProgress2, renderLanes2);
{
+ markComponentRenderStarted(workInProgress2);
+ }
+ {
ReactCurrentOwner$1.current = workInProgress2;
setIsRendering(true);
nextChildren = renderWithHooks(current2, workInProgress2, render2, nextProps, ref, renderLanes2);
- if (workInProgress2.mode & StrictMode) {
- disableLogs();
+ hasId = checkDidRenderIdHook();
+ if (workInProgress2.mode & StrictLegacyMode) {
+ setIsStrictModeForDevtools(true);
try {
nextChildren = renderWithHooks(current2, workInProgress2, render2, nextProps, ref, renderLanes2);
+ hasId = checkDidRenderIdHook();
} finally {
- reenableLogs();
+ setIsStrictModeForDevtools(false);
}
}
setIsRendering(false);
}
+ {
+ markComponentRenderStopped();
+ }
if (current2 !== null && !didReceiveUpdate) {
bailoutHooks(current2, workInProgress2, renderLanes2);
return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
}
+ if (getIsHydrating() && hasId) {
+ pushMaterializedTreeId(workInProgress2);
+ }
workInProgress2.flags |= PerformedWork;
reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
return workInProgress2.child;
}
- function updateMemoComponent(current2, workInProgress2, Component7, nextProps, updateLanes, renderLanes2) {
+ function updateMemoComponent(current2, workInProgress2, Component7, nextProps, renderLanes2) {
if (current2 === null) {
var type = Component7.type;
if (isSimpleFunctionComponent(type) && Component7.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either.
@@ -14884,7 +16270,7 @@
{
validateFunctionComponentInDev(workInProgress2, type);
}
- return updateSimpleMemoComponent(current2, workInProgress2, resolvedType, nextProps, updateLanes, renderLanes2);
+ return updateSimpleMemoComponent(current2, workInProgress2, resolvedType, nextProps, renderLanes2);
}
{
var innerPropTypes = type.propTypes;
@@ -14894,7 +16280,7 @@
nextProps,
// Resolved props
"prop",
- getComponentName(type)
+ getComponentNameFromType(type)
);
}
}
@@ -14913,12 +16299,13 @@
nextProps,
// Resolved props
"prop",
- getComponentName(_type)
+ getComponentNameFromType(_type)
);
}
}
var currentChild = current2.child;
- if (!includesSomeLane(updateLanes, renderLanes2)) {
+ var hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(current2, renderLanes2);
+ if (!hasScheduledUpdateOrContext) {
var prevProps = currentChild.memoizedProps;
var compare = Component7.compare;
compare = compare !== null ? compare : shallowEqual;
@@ -14933,7 +16320,7 @@
workInProgress2.child = newChild;
return newChild;
}
- function updateSimpleMemoComponent(current2, workInProgress2, Component7, nextProps, updateLanes, renderLanes2) {
+ function updateSimpleMemoComponent(current2, workInProgress2, Component7, nextProps, renderLanes2) {
{
if (workInProgress2.type !== workInProgress2.elementType) {
var outerMemoType = workInProgress2.elementType;
@@ -14953,7 +16340,7 @@
nextProps,
// Resolved (SimpleMemoComponent has no defaultProps)
"prop",
- getComponentName(outerMemoType)
+ getComponentNameFromType(outerMemoType)
);
}
}
@@ -14964,7 +16351,8 @@
if (shallowEqual(prevProps, nextProps) && current2.ref === workInProgress2.ref && // Prevent bailout if the implementation changed due to hot reload.
workInProgress2.type === current2.type) {
didReceiveUpdate = false;
- if (!includesSomeLane(renderLanes2, updateLanes)) {
+ workInProgress2.pendingProps = nextProps = prevProps;
+ if (!checkScheduledUpdateOrContext(current2, renderLanes2)) {
workInProgress2.lanes = current2.lanes;
return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
} else if ((current2.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
@@ -14978,14 +16366,17 @@
var nextProps = workInProgress2.pendingProps;
var nextChildren = nextProps.children;
var prevState = current2 !== null ? current2.memoizedState : null;
- if (nextProps.mode === "hidden" || nextProps.mode === "unstable-defer-without-hiding") {
+ if (nextProps.mode === "hidden" || enableLegacyHidden) {
if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
var nextState = {
- baseLanes: NoLanes
+ baseLanes: NoLanes,
+ cachePool: null,
+ transitions: null
};
workInProgress2.memoizedState = nextState;
pushRenderLanes(workInProgress2, renderLanes2);
} else if (!includesSomeLane(renderLanes2, OffscreenLane)) {
+ var spawnedCachePool = null;
var nextBaseLanes;
if (prevState !== null) {
var prevBaseLanes = prevState.baseLanes;
@@ -14993,19 +16384,21 @@
} else {
nextBaseLanes = renderLanes2;
}
- {
- markSpawnedWork(OffscreenLane);
- }
workInProgress2.lanes = workInProgress2.childLanes = laneToLanes(OffscreenLane);
var _nextState = {
- baseLanes: nextBaseLanes
+ baseLanes: nextBaseLanes,
+ cachePool: spawnedCachePool,
+ transitions: null
};
workInProgress2.memoizedState = _nextState;
+ workInProgress2.updateQueue = null;
pushRenderLanes(workInProgress2, nextBaseLanes);
return null;
} else {
var _nextState2 = {
- baseLanes: NoLanes
+ baseLanes: NoLanes,
+ cachePool: null,
+ transitions: null
};
workInProgress2.memoizedState = _nextState2;
var subtreeRenderLanes2 = prevState !== null ? prevState.baseLanes : renderLanes2;
@@ -15024,7 +16417,6 @@
reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
return workInProgress2.child;
}
- var updateLegacyHiddenComponent = updateOffscreenComponent;
function updateFragment(current2, workInProgress2, renderLanes2) {
var nextChildren = workInProgress2.pendingProps;
reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
@@ -15038,9 +16430,11 @@
function updateProfiler(current2, workInProgress2, renderLanes2) {
{
workInProgress2.flags |= Update;
- var stateNode = workInProgress2.stateNode;
- stateNode.effectDuration = 0;
- stateNode.passiveEffectDuration = 0;
+ {
+ var stateNode = workInProgress2.stateNode;
+ stateNode.effectDuration = 0;
+ stateNode.passiveEffectDuration = 0;
+ }
}
var nextProps = workInProgress2.pendingProps;
var nextChildren = nextProps.children;
@@ -15051,6 +16445,9 @@
var ref = workInProgress2.ref;
if (current2 === null && ref !== null || current2 !== null && current2.ref !== ref) {
workInProgress2.flags |= Ref;
+ {
+ workInProgress2.flags |= RefStatic;
+ }
}
}
function updateFunctionComponent(current2, workInProgress2, Component7, nextProps, renderLanes2) {
@@ -15063,7 +16460,7 @@
nextProps,
// Resolved props
"prop",
- getComponentName(Component7)
+ getComponentNameFromType(Component7)
);
}
}
@@ -15074,31 +16471,63 @@
context = getMaskedContext(workInProgress2, unmaskedContext);
}
var nextChildren;
+ var hasId;
prepareToReadContext(workInProgress2, renderLanes2);
{
+ markComponentRenderStarted(workInProgress2);
+ }
+ {
ReactCurrentOwner$1.current = workInProgress2;
setIsRendering(true);
nextChildren = renderWithHooks(current2, workInProgress2, Component7, nextProps, context, renderLanes2);
- if (workInProgress2.mode & StrictMode) {
- disableLogs();
+ hasId = checkDidRenderIdHook();
+ if (workInProgress2.mode & StrictLegacyMode) {
+ setIsStrictModeForDevtools(true);
try {
nextChildren = renderWithHooks(current2, workInProgress2, Component7, nextProps, context, renderLanes2);
+ hasId = checkDidRenderIdHook();
} finally {
- reenableLogs();
+ setIsStrictModeForDevtools(false);
}
}
setIsRendering(false);
}
+ {
+ markComponentRenderStopped();
+ }
if (current2 !== null && !didReceiveUpdate) {
bailoutHooks(current2, workInProgress2, renderLanes2);
return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
}
+ if (getIsHydrating() && hasId) {
+ pushMaterializedTreeId(workInProgress2);
+ }
workInProgress2.flags |= PerformedWork;
reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
return workInProgress2.child;
}
function updateClassComponent(current2, workInProgress2, Component7, nextProps, renderLanes2) {
{
+ switch (shouldError(workInProgress2)) {
+ case false: {
+ var _instance = workInProgress2.stateNode;
+ var ctor = workInProgress2.type;
+ var tempInstance = new ctor(workInProgress2.memoizedProps, _instance.context);
+ var state = tempInstance.state;
+ _instance.updater.enqueueSetState(_instance, state, null);
+ break;
+ }
+ case true: {
+ workInProgress2.flags |= DidCapture;
+ workInProgress2.flags |= ShouldCapture;
+ var error$1 = new Error("Simulated error coming from DevTools");
+ var lane = pickArbitraryLane(renderLanes2);
+ workInProgress2.lanes = mergeLanes(workInProgress2.lanes, lane);
+ var update = createClassErrorUpdate(workInProgress2, createCapturedValueAtFiber(error$1, workInProgress2), lane);
+ enqueueCapturedUpdate(workInProgress2, update);
+ break;
+ }
+ }
if (workInProgress2.type !== workInProgress2.elementType) {
var innerPropTypes = Component7.propTypes;
if (innerPropTypes) {
@@ -15107,7 +16536,7 @@
nextProps,
// Resolved props
"prop",
- getComponentName(Component7)
+ getComponentNameFromType(Component7)
);
}
}
@@ -15123,11 +16552,7 @@
var instance = workInProgress2.stateNode;
var shouldUpdate;
if (instance === null) {
- if (current2 !== null) {
- current2.alternate = null;
- workInProgress2.alternate = null;
- workInProgress2.flags |= Placement;
- }
+ resetSuspendedCurrentOnMountInLegacyMode(current2, workInProgress2);
constructClassInstance(workInProgress2, Component7, nextProps);
mountClassInstance(workInProgress2, Component7, nextProps, renderLanes2);
shouldUpdate = true;
@@ -15141,7 +16566,7 @@
var inst = workInProgress2.stateNode;
if (shouldUpdate && inst.props !== nextProps) {
if (!didWarnAboutReassigningProps) {
- error("It looks like %s is reassigning its own `this.props` while rendering. This is not supported and can lead to confusing bugs.", getComponentName(workInProgress2.type) || "a component");
+ error("It looks like %s is reassigning its own `this.props` while rendering. This is not supported and can lead to confusing bugs.", getComponentNameFromFiber(workInProgress2) || "a component");
}
didWarnAboutReassigningProps = true;
}
@@ -15167,18 +16592,24 @@
}
} else {
{
+ markComponentRenderStarted(workInProgress2);
+ }
+ {
setIsRendering(true);
nextChildren = instance.render();
- if (workInProgress2.mode & StrictMode) {
- disableLogs();
+ if (workInProgress2.mode & StrictLegacyMode) {
+ setIsStrictModeForDevtools(true);
try {
instance.render();
} finally {
- reenableLogs();
+ setIsStrictModeForDevtools(false);
}
}
setIsRendering(false);
}
+ {
+ markComponentRenderStopped();
+ }
}
workInProgress2.flags |= PerformedWork;
if (current2 !== null && didCaptureError) {
@@ -15203,48 +16634,60 @@
}
function updateHostRoot(current2, workInProgress2, renderLanes2) {
pushHostRootContext(workInProgress2);
- var updateQueue = workInProgress2.updateQueue;
- if (!(current2 !== null && updateQueue !== null)) {
- {
- throw Error("If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue.");
- }
+ if (current2 === null) {
+ throw new Error("Should have a current fiber. This is a bug in React.");
}
var nextProps = workInProgress2.pendingProps;
var prevState = workInProgress2.memoizedState;
- var prevChildren = prevState !== null ? prevState.element : null;
+ var prevChildren = prevState.element;
cloneUpdateQueue(current2, workInProgress2);
processUpdateQueue(workInProgress2, nextProps, null, renderLanes2);
var nextState = workInProgress2.memoizedState;
- var nextChildren = nextState.element;
- if (nextChildren === prevChildren) {
- resetHydrationState();
- return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
- }
var root2 = workInProgress2.stateNode;
- if (root2.hydrate && enterHydrationState(workInProgress2)) {
- {
- var mutableSourceEagerHydrationData = root2.mutableSourceEagerHydrationData;
- if (mutableSourceEagerHydrationData != null) {
- for (var i = 0; i < mutableSourceEagerHydrationData.length; i += 2) {
- var mutableSource = mutableSourceEagerHydrationData[i];
- var version = mutableSourceEagerHydrationData[i + 1];
- setWorkInProgressVersion(mutableSource, version);
- }
+ var nextChildren = nextState.element;
+ if (prevState.isDehydrated) {
+ var overrideState = {
+ element: nextChildren,
+ isDehydrated: false,
+ cache: nextState.cache,
+ pendingSuspenseBoundaries: nextState.pendingSuspenseBoundaries,
+ transitions: nextState.transitions
+ };
+ var updateQueue = workInProgress2.updateQueue;
+ updateQueue.baseState = overrideState;
+ workInProgress2.memoizedState = overrideState;
+ if (workInProgress2.flags & ForceClientRender) {
+ var recoverableError = createCapturedValueAtFiber(new Error("There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering."), workInProgress2);
+ return mountHostRootWithoutHydrating(current2, workInProgress2, nextChildren, renderLanes2, recoverableError);
+ } else if (nextChildren !== prevChildren) {
+ var _recoverableError = createCapturedValueAtFiber(new Error("This root received an early update, before anything was able hydrate. Switched the entire root to client rendering."), workInProgress2);
+ return mountHostRootWithoutHydrating(current2, workInProgress2, nextChildren, renderLanes2, _recoverableError);
+ } else {
+ enterHydrationState(workInProgress2);
+ var child = mountChildFibers(workInProgress2, null, nextChildren, renderLanes2);
+ workInProgress2.child = child;
+ var node = child;
+ while (node) {
+ node.flags = node.flags & ~Placement | Hydrating;
+ node = node.sibling;
}
}
- var child = mountChildFibers(workInProgress2, null, nextChildren, renderLanes2);
- workInProgress2.child = child;
- var node = child;
- while (node) {
- node.flags = node.flags & ~Placement | Hydrating;
- node = node.sibling;
- }
} else {
- reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
resetHydrationState();
+ if (nextChildren === prevChildren) {
+ return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
+ }
+ reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
}
return workInProgress2.child;
}
+ function mountHostRootWithoutHydrating(current2, workInProgress2, nextChildren, renderLanes2, recoverableError) {
+ resetHydrationState();
+ queueHydrationError(recoverableError);
+ workInProgress2.flags |= ForceClientRender;
+ reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
+ return workInProgress2.child;
+ }
function updateHostComponent(current2, workInProgress2, renderLanes2) {
pushHostContext(workInProgress2);
if (current2 === null) {
@@ -15270,12 +16713,8 @@
}
return null;
}
- function mountLazyComponent(_current, workInProgress2, elementType, updateLanes, renderLanes2) {
- if (_current !== null) {
- _current.alternate = null;
- workInProgress2.alternate = null;
- workInProgress2.flags |= Placement;
- }
+ function mountLazyComponent(_current, workInProgress2, elementType, renderLanes2) {
+ resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress2);
var props = workInProgress2.pendingProps;
var lazyComponent = elementType;
var payload = lazyComponent._payload;
@@ -15318,7 +16757,7 @@
resolvedProps,
// Resolved for outer only
"prop",
- getComponentName(Component7)
+ getComponentNameFromType(Component7)
);
}
}
@@ -15329,7 +16768,6 @@
Component7,
resolveDefaultProps(Component7.type, resolvedProps),
// The inner type can have defaults too
- updateLanes,
renderLanes2
);
return child;
@@ -15341,18 +16779,10 @@
hint = " Did you wrap a component in React.lazy() more than once?";
}
}
- {
- {
- throw Error("Element type is invalid. Received a promise that resolves to: " + Component7 + ". Lazy element type must resolve to a class or function." + hint);
- }
- }
+ throw new Error("Element type is invalid. Received a promise that resolves to: " + Component7 + ". " + ("Lazy element type must resolve to a class or function." + hint));
}
function mountIncompleteClassComponent(_current, workInProgress2, Component7, nextProps, renderLanes2) {
- if (_current !== null) {
- _current.alternate = null;
- workInProgress2.alternate = null;
- workInProgress2.flags |= Placement;
- }
+ resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress2);
workInProgress2.tag = ClassComponent;
var hasContext;
if (isContextProvider(Component7)) {
@@ -15367,11 +16797,7 @@
return finishClassComponent(null, workInProgress2, Component7, true, hasContext, renderLanes2);
}
function mountIndeterminateComponent(_current, workInProgress2, Component7, renderLanes2) {
- if (_current !== null) {
- _current.alternate = null;
- workInProgress2.alternate = null;
- workInProgress2.flags |= Placement;
- }
+ resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress2);
var props = workInProgress2.pendingProps;
var context;
{
@@ -15380,26 +16806,34 @@
}
prepareToReadContext(workInProgress2, renderLanes2);
var value;
+ var hasId;
+ {
+ markComponentRenderStarted(workInProgress2);
+ }
{
if (Component7.prototype && typeof Component7.prototype.render === "function") {
- var componentName = getComponentName(Component7) || "Unknown";
+ var componentName = getComponentNameFromType(Component7) || "Unknown";
if (!didWarnAboutBadClass[componentName]) {
error("The <%s /> component appears to have a render method, but doesn't extend React.Component. This is likely to cause errors. Change %s to extend React.Component instead.", componentName, componentName);
didWarnAboutBadClass[componentName] = true;
}
}
- if (workInProgress2.mode & StrictMode) {
+ if (workInProgress2.mode & StrictLegacyMode) {
ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress2, null);
}
setIsRendering(true);
ReactCurrentOwner$1.current = workInProgress2;
value = renderWithHooks(null, workInProgress2, Component7, props, context, renderLanes2);
+ hasId = checkDidRenderIdHook();
setIsRendering(false);
}
+ {
+ markComponentRenderStopped();
+ }
workInProgress2.flags |= PerformedWork;
{
if (typeof value === "object" && value !== null && typeof value.render === "function" && value.$$typeof === void 0) {
- var _componentName = getComponentName(Component7) || "Unknown";
+ var _componentName = getComponentNameFromType(Component7) || "Unknown";
if (!didWarnAboutModulePatternComponent[_componentName]) {
error("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.", _componentName, _componentName, _componentName);
didWarnAboutModulePatternComponent[_componentName] = true;
@@ -15412,7 +16846,7 @@
typeof value === "object" && value !== null && typeof value.render === "function" && value.$$typeof === void 0
) {
{
- var _componentName2 = getComponentName(Component7) || "Unknown";
+ var _componentName2 = getComponentNameFromType(Component7) || "Unknown";
if (!didWarnAboutModulePatternComponent[_componentName2]) {
error("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.", _componentName2, _componentName2, _componentName2);
didWarnAboutModulePatternComponent[_componentName2] = true;
@@ -15430,25 +16864,25 @@
}
workInProgress2.memoizedState = value.state !== null && value.state !== void 0 ? value.state : null;
initializeUpdateQueue(workInProgress2);
- var getDerivedStateFromProps = Component7.getDerivedStateFromProps;
- if (typeof getDerivedStateFromProps === "function") {
- applyDerivedStateFromProps(workInProgress2, Component7, getDerivedStateFromProps, props);
- }
adoptClassInstance(workInProgress2, value);
mountClassInstance(workInProgress2, Component7, props, renderLanes2);
return finishClassComponent(null, workInProgress2, Component7, true, hasContext, renderLanes2);
} else {
workInProgress2.tag = FunctionComponent;
{
- if (workInProgress2.mode & StrictMode) {
- disableLogs();
+ if (workInProgress2.mode & StrictLegacyMode) {
+ setIsStrictModeForDevtools(true);
try {
value = renderWithHooks(null, workInProgress2, Component7, props, context, renderLanes2);
+ hasId = checkDidRenderIdHook();
} finally {
- reenableLogs();
+ setIsStrictModeForDevtools(false);
}
}
}
+ if (getIsHydrating() && hasId) {
+ pushMaterializedTreeId(workInProgress2);
+ }
reconcileChildren(null, workInProgress2, value, renderLanes2);
{
validateFunctionComponentInDev(workInProgress2, Component7);
@@ -15469,7 +16903,7 @@
if (ownerName) {
info += "\n\nCheck the render method of `" + ownerName + "`.";
}
- var warningKey = ownerName || workInProgress2._debugID || "";
+ var warningKey = ownerName || "";
var debugSource = workInProgress2._debugSource;
if (debugSource) {
warningKey = debugSource.fileName + ":" + debugSource.lineNumber;
@@ -15480,14 +16914,14 @@
}
}
if (typeof Component7.getDerivedStateFromProps === "function") {
- var _componentName3 = getComponentName(Component7) || "Unknown";
+ var _componentName3 = getComponentNameFromType(Component7) || "Unknown";
if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]) {
error("%s: Function components do not support getDerivedStateFromProps.", _componentName3);
didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true;
}
}
if (typeof Component7.contextType === "object" && Component7.contextType !== null) {
- var _componentName4 = getComponentName(Component7) || "Unknown";
+ var _componentName4 = getComponentNameFromType(Component7) || "Unknown";
if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) {
error("%s: Function components do not support contextType.", _componentName4);
didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true;
@@ -15497,16 +16931,22 @@
}
var SUSPENDED_MARKER = {
dehydrated: null,
+ treeContext: null,
retryLane: NoLane
};
function mountSuspenseOffscreenState(renderLanes2) {
return {
- baseLanes: renderLanes2
+ baseLanes: renderLanes2,
+ cachePool: getSuspendedCache(),
+ transitions: null
};
}
function updateSuspenseOffscreenState(prevOffscreenState, renderLanes2) {
+ var cachePool = null;
return {
- baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes2)
+ baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes2),
+ cachePool,
+ transitions: prevOffscreenState.transitions
};
}
function shouldRemainOnFallback(suspenseContext, current2, workInProgress2, renderLanes2) {
@@ -15536,7 +16976,7 @@
workInProgress2.flags &= ~DidCapture;
} else {
if (current2 === null || current2.memoizedState !== null) {
- if (nextProps.fallback !== void 0 && nextProps.unstable_avoidThisFallback !== true) {
+ {
suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext);
}
}
@@ -15544,8 +16984,13 @@
suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
pushSuspenseContext(workInProgress2, suspenseContext);
if (current2 === null) {
- if (nextProps.fallback !== void 0) {
- tryToClaimNextHydratableInstance(workInProgress2);
+ tryToClaimNextHydratableInstance(workInProgress2);
+ var suspenseState = workInProgress2.memoizedState;
+ if (suspenseState !== null) {
+ var dehydrated = suspenseState.dehydrated;
+ if (dehydrated !== null) {
+ return mountDehydratedSuspenseComponent(workInProgress2, dehydrated);
+ }
}
var nextPrimaryChildren = nextProps.children;
var nextFallbackChildren = nextProps.fallback;
@@ -15555,55 +17000,32 @@
primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes2);
workInProgress2.memoizedState = SUSPENDED_MARKER;
return fallbackFragment;
- } else if (typeof nextProps.unstable_expectedLoadTime === "number") {
- var _fallbackFragment = mountSuspenseFallbackChildren(workInProgress2, nextPrimaryChildren, nextFallbackChildren, renderLanes2);
- var _primaryChildFragment = workInProgress2.child;
- _primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes2);
- workInProgress2.memoizedState = SUSPENDED_MARKER;
- workInProgress2.lanes = SomeRetryLane;
- {
- markSpawnedWork(SomeRetryLane);
- }
- return _fallbackFragment;
} else {
- return mountSuspensePrimaryChildren(workInProgress2, nextPrimaryChildren, renderLanes2);
+ return mountSuspensePrimaryChildren(workInProgress2, nextPrimaryChildren);
}
} else {
var prevState = current2.memoizedState;
if (prevState !== null) {
- if (showFallback) {
- var _nextFallbackChildren2 = nextProps.fallback;
- var _nextPrimaryChildren2 = nextProps.children;
- var _fallbackChildFragment = updateSuspenseFallbackChildren(current2, workInProgress2, _nextPrimaryChildren2, _nextFallbackChildren2, renderLanes2);
- var _primaryChildFragment3 = workInProgress2.child;
- var prevOffscreenState = current2.child.memoizedState;
- _primaryChildFragment3.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes2) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes2);
- _primaryChildFragment3.childLanes = getRemainingWorkInPrimaryTree(current2, renderLanes2);
- workInProgress2.memoizedState = SUSPENDED_MARKER;
- return _fallbackChildFragment;
- } else {
- var _nextPrimaryChildren3 = nextProps.children;
- var _primaryChildFragment4 = updateSuspensePrimaryChildren(current2, workInProgress2, _nextPrimaryChildren3, renderLanes2);
- workInProgress2.memoizedState = null;
- return _primaryChildFragment4;
+ var _dehydrated = prevState.dehydrated;
+ if (_dehydrated !== null) {
+ return updateDehydratedSuspenseComponent(current2, workInProgress2, didSuspend, nextProps, _dehydrated, prevState, renderLanes2);
}
+ }
+ if (showFallback) {
+ var _nextFallbackChildren = nextProps.fallback;
+ var _nextPrimaryChildren = nextProps.children;
+ var fallbackChildFragment = updateSuspenseFallbackChildren(current2, workInProgress2, _nextPrimaryChildren, _nextFallbackChildren, renderLanes2);
+ var _primaryChildFragment2 = workInProgress2.child;
+ var prevOffscreenState = current2.child.memoizedState;
+ _primaryChildFragment2.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes2) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes2);
+ _primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree(current2, renderLanes2);
+ workInProgress2.memoizedState = SUSPENDED_MARKER;
+ return fallbackChildFragment;
} else {
- if (showFallback) {
- var _nextFallbackChildren3 = nextProps.fallback;
- var _nextPrimaryChildren4 = nextProps.children;
- var _fallbackChildFragment2 = updateSuspenseFallbackChildren(current2, workInProgress2, _nextPrimaryChildren4, _nextFallbackChildren3, renderLanes2);
- var _primaryChildFragment5 = workInProgress2.child;
- var _prevOffscreenState = current2.child.memoizedState;
- _primaryChildFragment5.memoizedState = _prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes2) : updateSuspenseOffscreenState(_prevOffscreenState, renderLanes2);
- _primaryChildFragment5.childLanes = getRemainingWorkInPrimaryTree(current2, renderLanes2);
- workInProgress2.memoizedState = SUSPENDED_MARKER;
- return _fallbackChildFragment2;
- } else {
- var _nextPrimaryChildren5 = nextProps.children;
- var _primaryChildFragment6 = updateSuspensePrimaryChildren(current2, workInProgress2, _nextPrimaryChildren5, renderLanes2);
- workInProgress2.memoizedState = null;
- return _primaryChildFragment6;
- }
+ var _nextPrimaryChildren2 = nextProps.children;
+ var _primaryChildFragment3 = updateSuspensePrimaryChildren(current2, workInProgress2, _nextPrimaryChildren2, renderLanes2);
+ workInProgress2.memoizedState = null;
+ return _primaryChildFragment3;
}
}
}
@@ -15613,7 +17035,7 @@
mode: "visible",
children: primaryChildren
};
- var primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, renderLanes2, null);
+ var primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, mode);
primaryChildFragment.return = workInProgress2;
workInProgress2.child = primaryChildFragment;
return primaryChildFragment;
@@ -15627,7 +17049,7 @@
};
var primaryChildFragment;
var fallbackChildFragment;
- if ((mode & BlockingMode) === NoMode && progressedPrimaryFragment !== null) {
+ if ((mode & ConcurrentMode) === NoMode && progressedPrimaryFragment !== null) {
primaryChildFragment = progressedPrimaryFragment;
primaryChildFragment.childLanes = NoLanes;
primaryChildFragment.pendingProps = primaryChildProps;
@@ -15639,7 +17061,7 @@
}
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes2, null);
} else {
- primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, NoLanes, null);
+ primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, mode);
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes2, null);
}
primaryChildFragment.return = workInProgress2;
@@ -15648,25 +17070,32 @@
workInProgress2.child = primaryChildFragment;
return fallbackChildFragment;
}
- function createWorkInProgressOffscreenFiber(current2, offscreenProps) {
+ function mountWorkInProgressOffscreenFiber(offscreenProps, mode, renderLanes2) {
+ return createFiberFromOffscreen(offscreenProps, mode, NoLanes, null);
+ }
+ function updateWorkInProgressOffscreenFiber(current2, offscreenProps) {
return createWorkInProgress(current2, offscreenProps);
}
function updateSuspensePrimaryChildren(current2, workInProgress2, primaryChildren, renderLanes2) {
var currentPrimaryChildFragment = current2.child;
var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
- var primaryChildFragment = createWorkInProgressOffscreenFiber(currentPrimaryChildFragment, {
+ var primaryChildFragment = updateWorkInProgressOffscreenFiber(currentPrimaryChildFragment, {
mode: "visible",
children: primaryChildren
});
- if ((workInProgress2.mode & BlockingMode) === NoMode) {
+ if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
primaryChildFragment.lanes = renderLanes2;
}
primaryChildFragment.return = workInProgress2;
primaryChildFragment.sibling = null;
if (currentFallbackChildFragment !== null) {
- currentFallbackChildFragment.nextEffect = null;
- currentFallbackChildFragment.flags = Deletion;
- workInProgress2.firstEffect = workInProgress2.lastEffect = currentFallbackChildFragment;
+ var deletions = workInProgress2.deletions;
+ if (deletions === null) {
+ workInProgress2.deletions = [currentFallbackChildFragment];
+ workInProgress2.flags |= ChildDeletion;
+ } else {
+ deletions.push(currentFallbackChildFragment);
+ }
}
workInProgress2.child = primaryChildFragment;
return primaryChildFragment;
@@ -15683,7 +17112,7 @@
if (
// In legacy mode, we commit the primary tree as if it successfully
// completed, even though it's in an inconsistent state.
- (mode & BlockingMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was
+ (mode & ConcurrentMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was
// already cloned. In legacy mode, the only case where this isn't true is
// when DevTools forces us to display a fallback; we skip the first render
// pass entirely and go straight to rendering the fallback. (In Concurrent
@@ -15701,16 +17130,10 @@
primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration;
primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration;
}
- var progressedLastEffect = primaryChildFragment.lastEffect;
- if (progressedLastEffect !== null) {
- workInProgress2.firstEffect = primaryChildFragment.firstEffect;
- workInProgress2.lastEffect = progressedLastEffect;
- progressedLastEffect.nextEffect = null;
- } else {
- workInProgress2.firstEffect = workInProgress2.lastEffect = null;
- }
+ workInProgress2.deletions = null;
} else {
- primaryChildFragment = createWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps);
+ primaryChildFragment = updateWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps);
+ primaryChildFragment.subtreeFlags = currentPrimaryChildFragment.subtreeFlags & StaticMask;
}
var fallbackChildFragment;
if (currentFallbackChildFragment !== null) {
@@ -15725,13 +17148,135 @@
workInProgress2.child = primaryChildFragment;
return fallbackChildFragment;
}
- function scheduleWorkOnFiber(fiber, renderLanes2) {
+ function retrySuspenseComponentWithoutHydrating(current2, workInProgress2, renderLanes2, recoverableError) {
+ if (recoverableError !== null) {
+ queueHydrationError(recoverableError);
+ }
+ reconcileChildFibers(workInProgress2, current2.child, null, renderLanes2);
+ var nextProps = workInProgress2.pendingProps;
+ var primaryChildren = nextProps.children;
+ var primaryChildFragment = mountSuspensePrimaryChildren(workInProgress2, primaryChildren);
+ primaryChildFragment.flags |= Placement;
+ workInProgress2.memoizedState = null;
+ return primaryChildFragment;
+ }
+ function mountSuspenseFallbackAfterRetryWithoutHydrating(current2, workInProgress2, primaryChildren, fallbackChildren, renderLanes2) {
+ var fiberMode = workInProgress2.mode;
+ var primaryChildProps = {
+ mode: "visible",
+ children: primaryChildren
+ };
+ var primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, fiberMode);
+ var fallbackChildFragment = createFiberFromFragment(fallbackChildren, fiberMode, renderLanes2, null);
+ fallbackChildFragment.flags |= Placement;
+ primaryChildFragment.return = workInProgress2;
+ fallbackChildFragment.return = workInProgress2;
+ primaryChildFragment.sibling = fallbackChildFragment;
+ workInProgress2.child = primaryChildFragment;
+ if ((workInProgress2.mode & ConcurrentMode) !== NoMode) {
+ reconcileChildFibers(workInProgress2, current2.child, null, renderLanes2);
+ }
+ return fallbackChildFragment;
+ }
+ function mountDehydratedSuspenseComponent(workInProgress2, suspenseInstance, renderLanes2) {
+ if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
+ {
+ error("Cannot hydrate Suspense in legacy mode. Switch from ReactDOM.hydrate(element, container) to ReactDOMClient.hydrateRoot(container, <App />).render(element) or remove the Suspense components from the server rendered components.");
+ }
+ workInProgress2.lanes = laneToLanes(SyncLane);
+ } else if (isSuspenseInstanceFallback(suspenseInstance)) {
+ workInProgress2.lanes = laneToLanes(DefaultHydrationLane);
+ } else {
+ workInProgress2.lanes = laneToLanes(OffscreenLane);
+ }
+ return null;
+ }
+ function updateDehydratedSuspenseComponent(current2, workInProgress2, didSuspend, nextProps, suspenseInstance, suspenseState, renderLanes2) {
+ if (!didSuspend) {
+ warnIfHydrating();
+ if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
+ return retrySuspenseComponentWithoutHydrating(
+ current2,
+ workInProgress2,
+ renderLanes2,
+ // TODO: When we delete legacy mode, we should make this error argument
+ // required — every concurrent mode path that causes hydration to
+ // de-opt to client rendering should have an error message.
+ null
+ );
+ }
+ if (isSuspenseInstanceFallback(suspenseInstance)) {
+ var digest, message, stack;
+ {
+ var _getSuspenseInstanceF = getSuspenseInstanceFallbackErrorDetails(suspenseInstance);
+ digest = _getSuspenseInstanceF.digest;
+ message = _getSuspenseInstanceF.message;
+ stack = _getSuspenseInstanceF.stack;
+ }
+ var error2;
+ if (message) {
+ error2 = new Error(message);
+ } else {
+ error2 = new Error("The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.");
+ }
+ var capturedValue = createCapturedValue(error2, digest, stack);
+ return retrySuspenseComponentWithoutHydrating(current2, workInProgress2, renderLanes2, capturedValue);
+ }
+ var hasContextChanged2 = includesSomeLane(renderLanes2, current2.childLanes);
+ if (didReceiveUpdate || hasContextChanged2) {
+ var root2 = getWorkInProgressRoot();
+ if (root2 !== null) {
+ var attemptHydrationAtLane = getBumpedLaneForHydration(root2, renderLanes2);
+ if (attemptHydrationAtLane !== NoLane && attemptHydrationAtLane !== suspenseState.retryLane) {
+ suspenseState.retryLane = attemptHydrationAtLane;
+ var eventTime = NoTimestamp;
+ enqueueConcurrentRenderForLane(current2, attemptHydrationAtLane);
+ scheduleUpdateOnFiber(root2, current2, attemptHydrationAtLane, eventTime);
+ }
+ }
+ renderDidSuspendDelayIfPossible();
+ var _capturedValue = createCapturedValue(new Error("This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition."));
+ return retrySuspenseComponentWithoutHydrating(current2, workInProgress2, renderLanes2, _capturedValue);
+ } else if (isSuspenseInstancePending(suspenseInstance)) {
+ workInProgress2.flags |= DidCapture;
+ workInProgress2.child = current2.child;
+ var retry = retryDehydratedSuspenseBoundary.bind(null, current2);
+ registerSuspenseInstanceRetry(suspenseInstance, retry);
+ return null;
+ } else {
+ reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress2, suspenseInstance, suspenseState.treeContext);
+ var primaryChildren = nextProps.children;
+ var primaryChildFragment = mountSuspensePrimaryChildren(workInProgress2, primaryChildren);
+ primaryChildFragment.flags |= Hydrating;
+ return primaryChildFragment;
+ }
+ } else {
+ if (workInProgress2.flags & ForceClientRender) {
+ workInProgress2.flags &= ~ForceClientRender;
+ var _capturedValue2 = createCapturedValue(new Error("There was an error while hydrating this Suspense boundary. Switched to client rendering."));
+ return retrySuspenseComponentWithoutHydrating(current2, workInProgress2, renderLanes2, _capturedValue2);
+ } else if (workInProgress2.memoizedState !== null) {
+ workInProgress2.child = current2.child;
+ workInProgress2.flags |= DidCapture;
+ return null;
+ } else {
+ var nextPrimaryChildren = nextProps.children;
+ var nextFallbackChildren = nextProps.fallback;
+ var fallbackChildFragment = mountSuspenseFallbackAfterRetryWithoutHydrating(current2, workInProgress2, nextPrimaryChildren, nextFallbackChildren, renderLanes2);
+ var _primaryChildFragment4 = workInProgress2.child;
+ _primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes2);
+ workInProgress2.memoizedState = SUSPENDED_MARKER;
+ return fallbackChildFragment;
+ }
+ }
+ }
+ function scheduleSuspenseWorkOnFiber(fiber, renderLanes2, propagationRoot) {
fiber.lanes = mergeLanes(fiber.lanes, renderLanes2);
var alternate = fiber.alternate;
if (alternate !== null) {
alternate.lanes = mergeLanes(alternate.lanes, renderLanes2);
}
- scheduleWorkOnParentPath(fiber.return, renderLanes2);
+ scheduleContextWorkOnParentPath(fiber.return, renderLanes2, propagationRoot);
}
function propagateSuspenseContextChange(workInProgress2, firstChild, renderLanes2) {
var node = firstChild;
@@ -15739,10 +17284,10 @@
if (node.tag === SuspenseComponent) {
var state = node.memoizedState;
if (state !== null) {
- scheduleWorkOnFiber(node, renderLanes2);
+ scheduleSuspenseWorkOnFiber(node, renderLanes2, workInProgress2);
}
} else if (node.tag === SuspenseListComponent) {
- scheduleWorkOnFiber(node, renderLanes2);
+ scheduleSuspenseWorkOnFiber(node, renderLanes2, workInProgress2);
} else if (node.child !== null) {
node.child.return = node;
node = node.child;
@@ -15815,10 +17360,10 @@
}
function validateSuspenseListNestedChild(childSlot, index2) {
{
- var isArray2 = Array.isArray(childSlot);
- var isIterable = !isArray2 && typeof getIteratorFn(childSlot) === "function";
- if (isArray2 || isIterable) {
- var type = isArray2 ? "array" : "iterable";
+ var isAnArray = isArray(childSlot);
+ var isIterable = !isAnArray && typeof getIteratorFn(childSlot) === "function";
+ if (isAnArray || isIterable) {
+ var type = isAnArray ? "array" : "iterable";
error("A nested %s was passed to row #%s in <SuspenseList />. Wrap it in an additional SuspenseList to configure its revealOrder: <SuspenseList revealOrder=...> ... <SuspenseList revealOrder=...>{%s}</SuspenseList> ... </SuspenseList>", type, index2, type);
return false;
}
@@ -15828,7 +17373,7 @@
function validateSuspenseListChildren(children, revealOrder) {
{
if ((revealOrder === "forwards" || revealOrder === "backwards") && children !== void 0 && children !== null && children !== false) {
- if (Array.isArray(children)) {
+ if (isArray(children)) {
for (var i = 0; i < children.length; i++) {
if (!validateSuspenseListNestedChild(children[i], i)) {
return;
@@ -15855,7 +17400,7 @@
}
}
}
- function initSuspenseListRenderState(workInProgress2, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) {
+ function initSuspenseListRenderState(workInProgress2, isBackwards, tail, lastContentRow, tailMode) {
var renderState = workInProgress2.memoizedState;
if (renderState === null) {
workInProgress2.memoizedState = {
@@ -15864,8 +17409,7 @@
renderingStartTime: 0,
last: lastContentRow,
tail,
- tailMode,
- lastEffect: lastEffectBeforeRendering
+ tailMode
};
} else {
renderState.isBackwards = isBackwards;
@@ -15874,7 +17418,6 @@
renderState.last = lastContentRow;
renderState.tail = tail;
renderState.tailMode = tailMode;
- renderState.lastEffect = lastEffectBeforeRendering;
}
}
function updateSuspenseListComponent(current2, workInProgress2, renderLanes2) {
@@ -15899,7 +17442,7 @@
suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
}
pushSuspenseContext(workInProgress2, suspenseContext);
- if ((workInProgress2.mode & BlockingMode) === NoMode) {
+ if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
workInProgress2.memoizedState = null;
} else {
switch (revealOrder) {
@@ -15919,8 +17462,7 @@
// isBackwards
tail,
lastContentRow,
- tailMode,
- workInProgress2.lastEffect
+ tailMode
);
break;
}
@@ -15946,8 +17488,7 @@
_tail,
null,
// last
- tailMode,
- workInProgress2.lastEffect
+ tailMode
);
break;
}
@@ -15960,8 +17501,7 @@
// tail
null,
// last
- void 0,
- workInProgress2.lastEffect
+ void 0
);
break;
}
@@ -16001,16 +17541,17 @@
checkPropTypes(providerPropTypes, newProps, "prop", "Context.Provider");
}
}
- pushProvider(workInProgress2, newValue);
- if (oldProps !== null) {
- var oldValue = oldProps.value;
- var changedBits = calculateChangedBits(context, newValue, oldValue);
- if (changedBits === 0) {
- if (oldProps.children === newProps.children && !hasContextChanged()) {
- return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
+ pushProvider(workInProgress2, context, newValue);
+ {
+ if (oldProps !== null) {
+ var oldValue = oldProps.value;
+ if (objectIs(oldValue, newValue)) {
+ if (oldProps.children === newProps.children && !hasContextChanged()) {
+ return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
+ }
+ } else {
+ propagateContextChange(workInProgress2, context, renderLanes2);
}
- } else {
- propagateContextChange(workInProgress2, context, changedBits, renderLanes2);
}
}
var newChildren = newProps.children;
@@ -16040,7 +17581,10 @@
}
}
prepareToReadContext(workInProgress2, renderLanes2);
- var newValue = readContext(context, newProps.unstable_observedBits);
+ var newValue = readContext(context);
+ {
+ markComponentRenderStarted(workInProgress2);
+ }
var newChildren;
{
ReactCurrentOwner$1.current = workInProgress2;
@@ -16048,6 +17592,9 @@
newChildren = render2(newValue);
setIsRendering(false);
}
+ {
+ markComponentRenderStopped();
+ }
workInProgress2.flags |= PerformedWork;
reconcileChildren(current2, workInProgress2, newChildren, renderLanes2);
return workInProgress2.child;
@@ -16055,6 +17602,15 @@
function markWorkInProgressReceivedUpdate() {
didReceiveUpdate = true;
}
+ function resetSuspendedCurrentOnMountInLegacyMode(current2, workInProgress2) {
+ if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
+ if (current2 !== null) {
+ current2.alternate = null;
+ workInProgress2.alternate = null;
+ workInProgress2.flags |= Placement;
+ }
+ }
+ }
function bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2) {
if (current2 !== null) {
workInProgress2.dependencies = current2.dependencies;
@@ -16064,11 +17620,12 @@
}
markSkippedUpdateLanes(workInProgress2.lanes);
if (!includesSomeLane(renderLanes2, workInProgress2.childLanes)) {
- return null;
- } else {
- cloneChildFibers(current2, workInProgress2);
- return workInProgress2.child;
+ {
+ return null;
+ }
}
+ cloneChildFibers(current2, workInProgress2);
+ return workInProgress2.child;
}
function remountFiber(current2, oldWorkInProgress, newWorkInProgress) {
{
@@ -16097,21 +17654,120 @@
}
prevSibling.sibling = newWorkInProgress;
}
- var last = returnFiber.lastEffect;
- if (last !== null) {
- last.nextEffect = current2;
- returnFiber.lastEffect = current2;
+ var deletions = returnFiber.deletions;
+ if (deletions === null) {
+ returnFiber.deletions = [current2];
+ returnFiber.flags |= ChildDeletion;
} else {
- returnFiber.firstEffect = returnFiber.lastEffect = current2;
+ deletions.push(current2);
}
- current2.nextEffect = null;
- current2.flags = Deletion;
newWorkInProgress.flags |= Placement;
return newWorkInProgress;
}
}
+ function checkScheduledUpdateOrContext(current2, renderLanes2) {
+ var updateLanes = current2.lanes;
+ if (includesSomeLane(updateLanes, renderLanes2)) {
+ return true;
+ }
+ return false;
+ }
+ function attemptEarlyBailoutIfNoScheduledUpdate(current2, workInProgress2, renderLanes2) {
+ switch (workInProgress2.tag) {
+ case HostRoot:
+ pushHostRootContext(workInProgress2);
+ var root2 = workInProgress2.stateNode;
+ resetHydrationState();
+ break;
+ case HostComponent:
+ pushHostContext(workInProgress2);
+ break;
+ case ClassComponent: {
+ var Component7 = workInProgress2.type;
+ if (isContextProvider(Component7)) {
+ pushContextProvider(workInProgress2);
+ }
+ break;
+ }
+ case HostPortal:
+ pushHostContainer(workInProgress2, workInProgress2.stateNode.containerInfo);
+ break;
+ case ContextProvider: {
+ var newValue = workInProgress2.memoizedProps.value;
+ var context = workInProgress2.type._context;
+ pushProvider(workInProgress2, context, newValue);
+ break;
+ }
+ case Profiler:
+ {
+ var hasChildWork = includesSomeLane(renderLanes2, workInProgress2.childLanes);
+ if (hasChildWork) {
+ workInProgress2.flags |= Update;
+ }
+ {
+ var stateNode = workInProgress2.stateNode;
+ stateNode.effectDuration = 0;
+ stateNode.passiveEffectDuration = 0;
+ }
+ }
+ break;
+ case SuspenseComponent: {
+ var state = workInProgress2.memoizedState;
+ if (state !== null) {
+ if (state.dehydrated !== null) {
+ pushSuspenseContext(workInProgress2, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
+ workInProgress2.flags |= DidCapture;
+ return null;
+ }
+ var primaryChildFragment = workInProgress2.child;
+ var primaryChildLanes = primaryChildFragment.childLanes;
+ if (includesSomeLane(renderLanes2, primaryChildLanes)) {
+ return updateSuspenseComponent(current2, workInProgress2, renderLanes2);
+ } else {
+ pushSuspenseContext(workInProgress2, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
+ var child = bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
+ if (child !== null) {
+ return child.sibling;
+ } else {
+ return null;
+ }
+ }
+ } else {
+ pushSuspenseContext(workInProgress2, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
+ }
+ break;
+ }
+ case SuspenseListComponent: {
+ var didSuspendBefore = (current2.flags & DidCapture) !== NoFlags;
+ var _hasChildWork = includesSomeLane(renderLanes2, workInProgress2.childLanes);
+ if (didSuspendBefore) {
+ if (_hasChildWork) {
+ return updateSuspenseListComponent(current2, workInProgress2, renderLanes2);
+ }
+ workInProgress2.flags |= DidCapture;
+ }
+ var renderState = workInProgress2.memoizedState;
+ if (renderState !== null) {
+ renderState.rendering = null;
+ renderState.tail = null;
+ renderState.lastEffect = null;
+ }
+ pushSuspenseContext(workInProgress2, suspenseStackCursor.current);
+ if (_hasChildWork) {
+ break;
+ } else {
+ return null;
+ }
+ }
+ case OffscreenComponent:
+ case LegacyHiddenComponent: {
+ workInProgress2.lanes = NoLanes;
+ return updateOffscreenComponent(current2, workInProgress2, renderLanes2);
+ }
+ }
+ return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
+ }
function beginWork(current2, workInProgress2, renderLanes2) {
- var updateLanes = workInProgress2.lanes;
{
if (workInProgress2._debugNeedsRemount && current2 !== null) {
return remountFiber(current2, workInProgress2, createFiberFromTypeAndProps(workInProgress2.type, workInProgress2.key, workInProgress2.pendingProps, workInProgress2._debugOwner || null, workInProgress2.mode, workInProgress2.lanes));
@@ -16123,93 +17779,14 @@
if (oldProps !== newProps || hasContextChanged() || // Force a re-render if the implementation changed due to hot reload:
workInProgress2.type !== current2.type) {
didReceiveUpdate = true;
- } else if (!includesSomeLane(renderLanes2, updateLanes)) {
- didReceiveUpdate = false;
- switch (workInProgress2.tag) {
- case HostRoot:
- pushHostRootContext(workInProgress2);
- resetHydrationState();
- break;
- case HostComponent:
- pushHostContext(workInProgress2);
- break;
- case ClassComponent: {
- var Component7 = workInProgress2.type;
- if (isContextProvider(Component7)) {
- pushContextProvider(workInProgress2);
- }
- break;
- }
- case HostPortal:
- pushHostContainer(workInProgress2, workInProgress2.stateNode.containerInfo);
- break;
- case ContextProvider: {
- var newValue = workInProgress2.memoizedProps.value;
- pushProvider(workInProgress2, newValue);
- break;
- }
- case Profiler:
- {
- var hasChildWork = includesSomeLane(renderLanes2, workInProgress2.childLanes);
- if (hasChildWork) {
- workInProgress2.flags |= Update;
- }
- var stateNode = workInProgress2.stateNode;
- stateNode.effectDuration = 0;
- stateNode.passiveEffectDuration = 0;
- }
- break;
- case SuspenseComponent: {
- var state = workInProgress2.memoizedState;
- if (state !== null) {
- var primaryChildFragment = workInProgress2.child;
- var primaryChildLanes = primaryChildFragment.childLanes;
- if (includesSomeLane(renderLanes2, primaryChildLanes)) {
- return updateSuspenseComponent(current2, workInProgress2, renderLanes2);
- } else {
- pushSuspenseContext(workInProgress2, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
- var child = bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
- if (child !== null) {
- return child.sibling;
- } else {
- return null;
- }
- }
- } else {
- pushSuspenseContext(workInProgress2, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
- }
- break;
- }
- case SuspenseListComponent: {
- var didSuspendBefore = (current2.flags & DidCapture) !== NoFlags;
- var _hasChildWork = includesSomeLane(renderLanes2, workInProgress2.childLanes);
- if (didSuspendBefore) {
- if (_hasChildWork) {
- return updateSuspenseListComponent(current2, workInProgress2, renderLanes2);
- }
- workInProgress2.flags |= DidCapture;
- }
- var renderState = workInProgress2.memoizedState;
- if (renderState !== null) {
- renderState.rendering = null;
- renderState.tail = null;
- renderState.lastEffect = null;
- }
- pushSuspenseContext(workInProgress2, suspenseStackCursor.current);
- if (_hasChildWork) {
- break;
- } else {
- return null;
- }
- }
- case OffscreenComponent:
- case LegacyHiddenComponent: {
- workInProgress2.lanes = NoLanes;
- return updateOffscreenComponent(current2, workInProgress2, renderLanes2);
- }
- }
- return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
} else {
+ var hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(current2, renderLanes2);
+ if (!hasScheduledUpdateOrContext && // If this is the second pass of an error or suspense boundary, there
+ // may not be work scheduled on `current`, so we check for this flag.
+ (workInProgress2.flags & DidCapture) === NoFlags) {
+ didReceiveUpdate = false;
+ return attemptEarlyBailoutIfNoScheduledUpdate(current2, workInProgress2, renderLanes2);
+ }
if ((current2.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
didReceiveUpdate = true;
} else {
@@ -16218,6 +17795,11 @@
}
} else {
didReceiveUpdate = false;
+ if (getIsHydrating() && isForkedChild(workInProgress2)) {
+ var slotIndex = workInProgress2.index;
+ var numberOfForks = getForksAtLevel();
+ pushTreeId(workInProgress2, numberOfForks, slotIndex);
+ }
}
workInProgress2.lanes = NoLanes;
switch (workInProgress2.tag) {
@@ -16226,19 +17808,19 @@
}
case LazyComponent: {
var elementType = workInProgress2.elementType;
- return mountLazyComponent(current2, workInProgress2, elementType, updateLanes, renderLanes2);
+ return mountLazyComponent(current2, workInProgress2, elementType, renderLanes2);
}
case FunctionComponent: {
- var _Component = workInProgress2.type;
+ var Component7 = workInProgress2.type;
var unresolvedProps = workInProgress2.pendingProps;
- var resolvedProps = workInProgress2.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
- return updateFunctionComponent(current2, workInProgress2, _Component, resolvedProps, renderLanes2);
+ var resolvedProps = workInProgress2.elementType === Component7 ? unresolvedProps : resolveDefaultProps(Component7, unresolvedProps);
+ return updateFunctionComponent(current2, workInProgress2, Component7, resolvedProps, renderLanes2);
}
case ClassComponent: {
- var _Component2 = workInProgress2.type;
+ var _Component = workInProgress2.type;
var _unresolvedProps = workInProgress2.pendingProps;
- var _resolvedProps = workInProgress2.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
- return updateClassComponent(current2, workInProgress2, _Component2, _resolvedProps, renderLanes2);
+ var _resolvedProps = workInProgress2.elementType === _Component ? _unresolvedProps : resolveDefaultProps(_Component, _unresolvedProps);
+ return updateClassComponent(current2, workInProgress2, _Component, _resolvedProps, renderLanes2);
}
case HostRoot:
return updateHostRoot(current2, workInProgress2, renderLanes2);
@@ -16279,53 +17861,43 @@
_resolvedProps3,
// Resolved for outer only
"prop",
- getComponentName(_type2)
+ getComponentNameFromType(_type2)
);
}
}
}
_resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
- return updateMemoComponent(current2, workInProgress2, _type2, _resolvedProps3, updateLanes, renderLanes2);
+ return updateMemoComponent(current2, workInProgress2, _type2, _resolvedProps3, renderLanes2);
}
case SimpleMemoComponent: {
- return updateSimpleMemoComponent(current2, workInProgress2, workInProgress2.type, workInProgress2.pendingProps, updateLanes, renderLanes2);
+ return updateSimpleMemoComponent(current2, workInProgress2, workInProgress2.type, workInProgress2.pendingProps, renderLanes2);
}
case IncompleteClassComponent: {
- var _Component3 = workInProgress2.type;
+ var _Component2 = workInProgress2.type;
var _unresolvedProps4 = workInProgress2.pendingProps;
- var _resolvedProps4 = workInProgress2.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
- return mountIncompleteClassComponent(current2, workInProgress2, _Component3, _resolvedProps4, renderLanes2);
+ var _resolvedProps4 = workInProgress2.elementType === _Component2 ? _unresolvedProps4 : resolveDefaultProps(_Component2, _unresolvedProps4);
+ return mountIncompleteClassComponent(current2, workInProgress2, _Component2, _resolvedProps4, renderLanes2);
}
case SuspenseListComponent: {
return updateSuspenseListComponent(current2, workInProgress2, renderLanes2);
}
- case FundamentalComponent: {
- break;
- }
case ScopeComponent: {
break;
}
- case Block: {
- break;
- }
case OffscreenComponent: {
return updateOffscreenComponent(current2, workInProgress2, renderLanes2);
}
- case LegacyHiddenComponent: {
- return updateLegacyHiddenComponent(current2, workInProgress2, renderLanes2);
- }
- }
- {
- {
- throw Error("Unknown unit of work tag (" + workInProgress2.tag + "). This error is likely caused by a bug in React. Please file an issue.");
- }
}
+ throw new Error("Unknown unit of work tag (" + workInProgress2.tag + "). This error is likely caused by a bug in React. Please file an issue.");
}
function markUpdate(workInProgress2) {
workInProgress2.flags |= Update;
}
function markRef$1(workInProgress2) {
workInProgress2.flags |= Ref;
+ {
+ workInProgress2.flags |= RefStatic;
+ }
}
var appendAllChildren;
var updateHostContainer;
@@ -16357,7 +17929,7 @@
node = node.sibling;
}
};
- updateHostContainer = function(workInProgress2) {
+ updateHostContainer = function(current2, workInProgress2) {
};
updateHostComponent$1 = function(current2, workInProgress2, type, newProps, rootContainerInstance) {
var oldProps = current2.memoizedProps;
@@ -16421,8 +17993,118 @@
}
}
}
+ function bubbleProperties(completedWork) {
+ var didBailout = completedWork.alternate !== null && completedWork.alternate.child === completedWork.child;
+ var newChildLanes = NoLanes;
+ var subtreeFlags = NoFlags;
+ if (!didBailout) {
+ if ((completedWork.mode & ProfileMode) !== NoMode) {
+ var actualDuration = completedWork.actualDuration;
+ var treeBaseDuration = completedWork.selfBaseDuration;
+ var child = completedWork.child;
+ while (child !== null) {
+ newChildLanes = mergeLanes(newChildLanes, mergeLanes(child.lanes, child.childLanes));
+ subtreeFlags |= child.subtreeFlags;
+ subtreeFlags |= child.flags;
+ actualDuration += child.actualDuration;
+ treeBaseDuration += child.treeBaseDuration;
+ child = child.sibling;
+ }
+ completedWork.actualDuration = actualDuration;
+ completedWork.treeBaseDuration = treeBaseDuration;
+ } else {
+ var _child = completedWork.child;
+ while (_child !== null) {
+ newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child.lanes, _child.childLanes));
+ subtreeFlags |= _child.subtreeFlags;
+ subtreeFlags |= _child.flags;
+ _child.return = completedWork;
+ _child = _child.sibling;
+ }
+ }
+ completedWork.subtreeFlags |= subtreeFlags;
+ } else {
+ if ((completedWork.mode & ProfileMode) !== NoMode) {
+ var _treeBaseDuration = completedWork.selfBaseDuration;
+ var _child2 = completedWork.child;
+ while (_child2 !== null) {
+ newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child2.lanes, _child2.childLanes));
+ subtreeFlags |= _child2.subtreeFlags & StaticMask;
+ subtreeFlags |= _child2.flags & StaticMask;
+ _treeBaseDuration += _child2.treeBaseDuration;
+ _child2 = _child2.sibling;
+ }
+ completedWork.treeBaseDuration = _treeBaseDuration;
+ } else {
+ var _child3 = completedWork.child;
+ while (_child3 !== null) {
+ newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child3.lanes, _child3.childLanes));
+ subtreeFlags |= _child3.subtreeFlags & StaticMask;
+ subtreeFlags |= _child3.flags & StaticMask;
+ _child3.return = completedWork;
+ _child3 = _child3.sibling;
+ }
+ }
+ completedWork.subtreeFlags |= subtreeFlags;
+ }
+ completedWork.childLanes = newChildLanes;
+ return didBailout;
+ }
+ function completeDehydratedSuspenseBoundary(current2, workInProgress2, nextState) {
+ if (hasUnhydratedTailNodes() && (workInProgress2.mode & ConcurrentMode) !== NoMode && (workInProgress2.flags & DidCapture) === NoFlags) {
+ warnIfUnhydratedTailNodes(workInProgress2);
+ resetHydrationState();
+ workInProgress2.flags |= ForceClientRender | Incomplete | ShouldCapture;
+ return false;
+ }
+ var wasHydrated = popHydrationState(workInProgress2);
+ if (nextState !== null && nextState.dehydrated !== null) {
+ if (current2 === null) {
+ if (!wasHydrated) {
+ throw new Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");
+ }
+ prepareToHydrateHostSuspenseInstance(workInProgress2);
+ bubbleProperties(workInProgress2);
+ {
+ if ((workInProgress2.mode & ProfileMode) !== NoMode) {
+ var isTimedOutSuspense = nextState !== null;
+ if (isTimedOutSuspense) {
+ var primaryChildFragment = workInProgress2.child;
+ if (primaryChildFragment !== null) {
+ workInProgress2.treeBaseDuration -= primaryChildFragment.treeBaseDuration;
+ }
+ }
+ }
+ }
+ return false;
+ } else {
+ resetHydrationState();
+ if ((workInProgress2.flags & DidCapture) === NoFlags) {
+ workInProgress2.memoizedState = null;
+ }
+ workInProgress2.flags |= Update;
+ bubbleProperties(workInProgress2);
+ {
+ if ((workInProgress2.mode & ProfileMode) !== NoMode) {
+ var _isTimedOutSuspense = nextState !== null;
+ if (_isTimedOutSuspense) {
+ var _primaryChildFragment = workInProgress2.child;
+ if (_primaryChildFragment !== null) {
+ workInProgress2.treeBaseDuration -= _primaryChildFragment.treeBaseDuration;
+ }
+ }
+ }
+ }
+ return false;
+ }
+ } else {
+ upgradeHydrationErrorsToRecoverable();
+ return true;
+ }
+ }
function completeWork(current2, workInProgress2, renderLanes2) {
var newProps = workInProgress2.pendingProps;
+ popTreeContext(workInProgress2);
switch (workInProgress2.tag) {
case IndeterminateComponent:
case LazyComponent:
@@ -16434,19 +18116,21 @@
case Profiler:
case ContextConsumer:
case MemoComponent:
+ bubbleProperties(workInProgress2);
return null;
case ClassComponent: {
var Component7 = workInProgress2.type;
if (isContextProvider(Component7)) {
popContext(workInProgress2);
}
+ bubbleProperties(workInProgress2);
return null;
}
case HostRoot: {
+ var fiberRoot = workInProgress2.stateNode;
popHostContainer(workInProgress2);
popTopLevelContextObject(workInProgress2);
resetWorkInProgressVersions();
- var fiberRoot = workInProgress2.stateNode;
if (fiberRoot.pendingContext) {
fiberRoot.context = fiberRoot.pendingContext;
fiberRoot.pendingContext = null;
@@ -16455,11 +18139,22 @@
var wasHydrated = popHydrationState(workInProgress2);
if (wasHydrated) {
markUpdate(workInProgress2);
- } else if (!fiberRoot.hydrate) {
- workInProgress2.flags |= Snapshot;
+ } else {
+ if (current2 !== null) {
+ var prevState = current2.memoizedState;
+ if (
+ // Check if this is a client root
+ !prevState.isDehydrated || // Check if we reverted to client rendering (e.g. due to an error)
+ (workInProgress2.flags & ForceClientRender) !== NoFlags
+ ) {
+ workInProgress2.flags |= Snapshot;
+ upgradeHydrationErrorsToRecoverable();
+ }
+ }
}
}
- updateHostContainer(workInProgress2);
+ updateHostContainer(current2, workInProgress2);
+ bubbleProperties(workInProgress2);
return null;
}
case HostComponent: {
@@ -16473,11 +18168,10 @@
}
} else {
if (!newProps) {
- if (!(workInProgress2.stateNode !== null)) {
- {
- throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
- }
+ if (workInProgress2.stateNode === null) {
+ throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
}
+ bubbleProperties(workInProgress2);
return null;
}
var currentHostContext = getHostContext();
@@ -16498,6 +18192,7 @@
markRef$1(workInProgress2);
}
}
+ bubbleProperties(workInProgress2);
return null;
}
case HostText: {
@@ -16507,10 +18202,8 @@
updateHostText$1(current2, workInProgress2, oldText, newText);
} else {
if (typeof newText !== "string") {
- if (!(workInProgress2.stateNode !== null)) {
- {
- throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
- }
+ if (workInProgress2.stateNode === null) {
+ throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
}
}
var _rootContainerInstance = getRootHostContainer();
@@ -16524,11 +18217,22 @@
workInProgress2.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress2);
}
}
+ bubbleProperties(workInProgress2);
return null;
}
case SuspenseComponent: {
popSuspenseContext(workInProgress2);
var nextState = workInProgress2.memoizedState;
+ if (current2 === null || current2.memoizedState !== null && current2.memoizedState.dehydrated !== null) {
+ var fallthroughToNormalSuspensePath = completeDehydratedSuspenseBoundary(current2, workInProgress2, nextState);
+ if (!fallthroughToNormalSuspensePath) {
+ if (workInProgress2.flags & ShouldCapture) {
+ return workInProgress2;
+ } else {
+ return null;
+ }
+ }
+ }
if ((workInProgress2.flags & DidCapture) !== NoFlags) {
workInProgress2.lanes = renderLanes2;
if ((workInProgress2.mode & ProfileMode) !== NoMode) {
@@ -16537,53 +18241,64 @@
return workInProgress2;
}
var nextDidTimeout = nextState !== null;
- var prevDidTimeout = false;
- if (current2 === null) {
- if (workInProgress2.memoizedProps.fallback !== void 0) {
- popHydrationState(workInProgress2);
- }
- } else {
- var prevState = current2.memoizedState;
- prevDidTimeout = prevState !== null;
- }
- if (nextDidTimeout && !prevDidTimeout) {
- if ((workInProgress2.mode & BlockingMode) !== NoMode) {
- var hasInvisibleChildContext = current2 === null && workInProgress2.memoizedProps.unstable_avoidThisFallback !== true;
- if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) {
- renderDidSuspend();
- } else {
- renderDidSuspendDelayIfPossible();
+ var prevDidTimeout = current2 !== null && current2.memoizedState !== null;
+ if (nextDidTimeout !== prevDidTimeout) {
+ if (nextDidTimeout) {
+ var _offscreenFiber2 = workInProgress2.child;
+ _offscreenFiber2.flags |= Visibility;
+ if ((workInProgress2.mode & ConcurrentMode) !== NoMode) {
+ var hasInvisibleChildContext = current2 === null && (workInProgress2.memoizedProps.unstable_avoidThisFallback !== true || !enableSuspenseAvoidThisFallback);
+ if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) {
+ renderDidSuspend();
+ } else {
+ renderDidSuspendDelayIfPossible();
+ }
}
}
}
+ var wakeables = workInProgress2.updateQueue;
+ if (wakeables !== null) {
+ workInProgress2.flags |= Update;
+ }
+ bubbleProperties(workInProgress2);
{
- if (nextDidTimeout || prevDidTimeout) {
- workInProgress2.flags |= Update;
+ if ((workInProgress2.mode & ProfileMode) !== NoMode) {
+ if (nextDidTimeout) {
+ var primaryChildFragment = workInProgress2.child;
+ if (primaryChildFragment !== null) {
+ workInProgress2.treeBaseDuration -= primaryChildFragment.treeBaseDuration;
+ }
+ }
}
}
return null;
}
case HostPortal:
popHostContainer(workInProgress2);
- updateHostContainer(workInProgress2);
+ updateHostContainer(current2, workInProgress2);
if (current2 === null) {
preparePortalMount(workInProgress2.stateNode.containerInfo);
}
+ bubbleProperties(workInProgress2);
return null;
case ContextProvider:
- popProvider(workInProgress2);
+ var context = workInProgress2.type._context;
+ popProvider(context, workInProgress2);
+ bubbleProperties(workInProgress2);
return null;
case IncompleteClassComponent: {
var _Component = workInProgress2.type;
if (isContextProvider(_Component)) {
popContext(workInProgress2);
}
+ bubbleProperties(workInProgress2);
return null;
}
case SuspenseListComponent: {
popSuspenseContext(workInProgress2);
var renderState = workInProgress2.memoizedState;
if (renderState === null) {
+ bubbleProperties(workInProgress2);
return null;
}
var didSuspendAlready = (workInProgress2.flags & DidCapture) !== NoFlags;
@@ -16599,15 +18314,12 @@
didSuspendAlready = true;
workInProgress2.flags |= DidCapture;
cutOffTailIfNeeded(renderState, false);
- var newThennables = suspended.updateQueue;
- if (newThennables !== null) {
- workInProgress2.updateQueue = newThennables;
+ var newThenables = suspended.updateQueue;
+ if (newThenables !== null) {
+ workInProgress2.updateQueue = newThenables;
workInProgress2.flags |= Update;
}
- if (renderState.lastEffect === null) {
- workInProgress2.firstEffect = null;
- }
- workInProgress2.lastEffect = renderState.lastEffect;
+ workInProgress2.subtreeFlags = NoFlags;
resetChildFibers(workInProgress2, renderLanes2);
pushSuspenseContext(workInProgress2, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback));
return workInProgress2.child;
@@ -16620,9 +18332,6 @@
didSuspendAlready = true;
cutOffTailIfNeeded(renderState, false);
workInProgress2.lanes = SomeRetryLane;
- {
- markSpawnedWork(SomeRetryLane);
- }
}
} else {
cutOffTailIfNeeded(renderState, false);
@@ -16633,17 +18342,14 @@
if (_suspended !== null) {
workInProgress2.flags |= DidCapture;
didSuspendAlready = true;
- var _newThennables = _suspended.updateQueue;
- if (_newThennables !== null) {
- workInProgress2.updateQueue = _newThennables;
+ var _newThenables = _suspended.updateQueue;
+ if (_newThenables !== null) {
+ workInProgress2.updateQueue = _newThenables;
workInProgress2.flags |= Update;
}
cutOffTailIfNeeded(renderState, true);
if (renderState.tail === null && renderState.tailMode === "hidden" && !renderedTail.alternate && !getIsHydrating()) {
- var lastEffect = workInProgress2.lastEffect = renderState.lastEffect;
- if (lastEffect !== null) {
- lastEffect.nextEffect = null;
- }
+ bubbleProperties(workInProgress2);
return null;
}
} else if (
@@ -16656,9 +18362,6 @@
didSuspendAlready = true;
cutOffTailIfNeeded(renderState, false);
workInProgress2.lanes = SomeRetryLane;
- {
- markSpawnedWork(SomeRetryLane);
- }
}
}
if (renderState.isBackwards) {
@@ -16678,7 +18381,6 @@
var next = renderState.tail;
renderState.rendering = next;
renderState.tail = next.sibling;
- renderState.lastEffect = workInProgress2.lastEffect;
renderState.renderingStartTime = now();
next.sibling = null;
var suspenseContext = suspenseStackCursor.current;
@@ -16690,38 +18392,50 @@
pushSuspenseContext(workInProgress2, suspenseContext);
return next;
}
+ bubbleProperties(workInProgress2);
return null;
}
- case FundamentalComponent: {
- break;
- }
case ScopeComponent: {
break;
}
- case Block:
- break;
case OffscreenComponent:
case LegacyHiddenComponent: {
popRenderLanes(workInProgress2);
+ var _nextState = workInProgress2.memoizedState;
+ var nextIsHidden = _nextState !== null;
if (current2 !== null) {
- var _nextState = workInProgress2.memoizedState;
var _prevState = current2.memoizedState;
var prevIsHidden = _prevState !== null;
- var nextIsHidden = _nextState !== null;
- if (prevIsHidden !== nextIsHidden && newProps.mode !== "unstable-defer-without-hiding") {
- workInProgress2.flags |= Update;
+ if (prevIsHidden !== nextIsHidden && // LegacyHidden doesn't do any hiding — it only pre-renders.
+ !enableLegacyHidden) {
+ workInProgress2.flags |= Visibility;
+ }
+ }
+ if (!nextIsHidden || (workInProgress2.mode & ConcurrentMode) === NoMode) {
+ bubbleProperties(workInProgress2);
+ } else {
+ if (includesSomeLane(subtreeRenderLanes, OffscreenLane)) {
+ bubbleProperties(workInProgress2);
+ {
+ if (workInProgress2.subtreeFlags & (Placement | Update)) {
+ workInProgress2.flags |= Visibility;
+ }
+ }
}
}
return null;
}
- }
- {
- {
- throw Error("Unknown unit of work tag (" + workInProgress2.tag + "). This error is likely caused by a bug in React. Please file an issue.");
+ case CacheComponent: {
+ return null;
+ }
+ case TracingMarkerComponent: {
+ return null;
}
}
+ throw new Error("Unknown unit of work tag (" + workInProgress2.tag + "). This error is likely caused by a bug in React. Please file an issue.");
}
- function unwindWork(workInProgress2, renderLanes2) {
+ function unwindWork(current2, workInProgress2, renderLanes2) {
+ popTreeContext(workInProgress2);
switch (workInProgress2.tag) {
case ClassComponent: {
var Component7 = workInProgress2.type;
@@ -16739,17 +18453,16 @@
return null;
}
case HostRoot: {
+ var root2 = workInProgress2.stateNode;
popHostContainer(workInProgress2);
popTopLevelContextObject(workInProgress2);
resetWorkInProgressVersions();
var _flags = workInProgress2.flags;
- if (!((_flags & DidCapture) === NoFlags)) {
- {
- throw Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue.");
- }
+ if ((_flags & ShouldCapture) !== NoFlags && (_flags & DidCapture) === NoFlags) {
+ workInProgress2.flags = _flags & ~ShouldCapture | DidCapture;
+ return workInProgress2;
}
- workInProgress2.flags = _flags & ~ShouldCapture | DidCapture;
- return workInProgress2;
+ return null;
}
case HostComponent: {
popHostContext(workInProgress2);
@@ -16757,6 +18470,13 @@
}
case SuspenseComponent: {
popSuspenseContext(workInProgress2);
+ var suspenseState = workInProgress2.memoizedState;
+ if (suspenseState !== null && suspenseState.dehydrated !== null) {
+ if (workInProgress2.alternate === null) {
+ throw new Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");
+ }
+ resetHydrationState();
+ }
var _flags2 = workInProgress2.flags;
if (_flags2 & ShouldCapture) {
workInProgress2.flags = _flags2 & ~ShouldCapture | DidCapture;
@@ -16775,17 +18495,21 @@
popHostContainer(workInProgress2);
return null;
case ContextProvider:
- popProvider(workInProgress2);
+ var context = workInProgress2.type._context;
+ popProvider(context, workInProgress2);
return null;
case OffscreenComponent:
case LegacyHiddenComponent:
popRenderLanes(workInProgress2);
return null;
+ case CacheComponent:
+ return null;
default:
return null;
}
}
- function unwindInterruptedWork(interruptedWork) {
+ function unwindInterruptedWork(current2, interruptedWork, renderLanes2) {
+ popTreeContext(interruptedWork);
switch (interruptedWork.tag) {
case ClassComponent: {
var childContextTypes = interruptedWork.type.childContextTypes;
@@ -16795,6 +18519,7 @@
break;
}
case HostRoot: {
+ var root2 = interruptedWork.stateNode;
popHostContainer(interruptedWork);
popTopLevelContextObject(interruptedWork);
resetWorkInProgressVersions();
@@ -16814,7 +18539,8 @@
popSuspenseContext(interruptedWork);
break;
case ContextProvider:
- popProvider(interruptedWork);
+ var context = interruptedWork.type._context;
+ popProvider(context, interruptedWork);
break;
case OffscreenComponent:
case LegacyHiddenComponent:
@@ -16822,243 +18548,88 @@
break;
}
}
- function createCapturedValue(value, source) {
- return {
- value,
- source,
- stack: getStackByFiberInDevAndProd(source)
- };
- }
- function showErrorDialog(boundary, errorInfo) {
- return true;
- }
- function logCapturedError(boundary, errorInfo) {
- try {
- var logError = showErrorDialog(boundary, errorInfo);
- if (logError === false) {
- return;
- }
- var error2 = errorInfo.value;
- if (true) {
- var source = errorInfo.source;
- var stack = errorInfo.stack;
- var componentStack = stack !== null ? stack : "";
- if (error2 != null && error2._suppressLogging) {
- if (boundary.tag === ClassComponent) {
- return;
- }
- console["error"](error2);
- }
- var componentName = source ? getComponentName(source.type) : null;
- var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : "The above error occurred in one of your React components:";
- var errorBoundaryMessage;
- var errorBoundaryName = getComponentName(boundary.type);
- if (errorBoundaryName) {
- errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + ".");
- } else {
- errorBoundaryMessage = "Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://reactjs.org/link/error-boundaries to learn more about error boundaries.";
- }
- var combinedMessage = componentNameMessage + "\n" + componentStack + "\n\n" + ("" + errorBoundaryMessage);
- console["error"](combinedMessage);
- } else {
- console["error"](error2);
- }
- } catch (e) {
- setTimeout(function() {
- throw e;
- });
- }
- }
- var PossiblyWeakMap$1 = typeof WeakMap === "function" ? WeakMap : Map;
- function createRootErrorUpdate(fiber, errorInfo, lane) {
- var update = createUpdate(NoTimestamp, lane);
- update.tag = CaptureUpdate;
- update.payload = {
- element: null
- };
- var error2 = errorInfo.value;
- update.callback = function() {
- onUncaughtError(error2);
- logCapturedError(fiber, errorInfo);
- };
- return update;
- }
- function createClassErrorUpdate(fiber, errorInfo, lane) {
- var update = createUpdate(NoTimestamp, lane);
- update.tag = CaptureUpdate;
- var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
- if (typeof getDerivedStateFromError === "function") {
- var error$1 = errorInfo.value;
- update.payload = function() {
- logCapturedError(fiber, errorInfo);
- return getDerivedStateFromError(error$1);
- };
- }
- var inst = fiber.stateNode;
- if (inst !== null && typeof inst.componentDidCatch === "function") {
- update.callback = function callback() {
- {
- markFailedErrorBoundaryForHotReloading(fiber);
- }
- if (typeof getDerivedStateFromError !== "function") {
- markLegacyErrorBoundaryAsFailed(this);
- logCapturedError(fiber, errorInfo);
- }
- var error$12 = errorInfo.value;
- var stack = errorInfo.stack;
- this.componentDidCatch(error$12, {
- componentStack: stack !== null ? stack : ""
- });
- {
- if (typeof getDerivedStateFromError !== "function") {
- if (!includesSomeLane(fiber.lanes, SyncLane)) {
- error("%s: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.", getComponentName(fiber.type) || "Unknown");
- }
- }
- }
- };
- } else {
- update.callback = function() {
- markFailedErrorBoundaryForHotReloading(fiber);
- };
- }
- return update;
- }
- function attachPingListener(root2, wakeable, lanes) {
- var pingCache = root2.pingCache;
- var threadIDs;
- if (pingCache === null) {
- pingCache = root2.pingCache = new PossiblyWeakMap$1();
- threadIDs = /* @__PURE__ */ new Set();
- pingCache.set(wakeable, threadIDs);
- } else {
- threadIDs = pingCache.get(wakeable);
- if (threadIDs === void 0) {
- threadIDs = /* @__PURE__ */ new Set();
- pingCache.set(wakeable, threadIDs);
- }
- }
- if (!threadIDs.has(lanes)) {
- threadIDs.add(lanes);
- var ping = pingSuspendedRoot.bind(null, root2, wakeable, lanes);
- wakeable.then(ping, ping);
- }
- }
- function throwException(root2, returnFiber, sourceFiber, value, rootRenderLanes) {
- sourceFiber.flags |= Incomplete;
- sourceFiber.firstEffect = sourceFiber.lastEffect = null;
- if (value !== null && typeof value === "object" && typeof value.then === "function") {
- var wakeable = value;
- if ((sourceFiber.mode & BlockingMode) === NoMode) {
- var currentSource = sourceFiber.alternate;
- if (currentSource) {
- sourceFiber.updateQueue = currentSource.updateQueue;
- sourceFiber.memoizedState = currentSource.memoizedState;
- sourceFiber.lanes = currentSource.lanes;
- } else {
- sourceFiber.updateQueue = null;
- sourceFiber.memoizedState = null;
- }
- }
- var hasInvisibleParentBoundary = hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext);
- var _workInProgress = returnFiber;
- do {
- if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary)) {
- var wakeables = _workInProgress.updateQueue;
- if (wakeables === null) {
- var updateQueue = /* @__PURE__ */ new Set();
- updateQueue.add(wakeable);
- _workInProgress.updateQueue = updateQueue;
- } else {
- wakeables.add(wakeable);
- }
- if ((_workInProgress.mode & BlockingMode) === NoMode) {
- _workInProgress.flags |= DidCapture;
- sourceFiber.flags |= ForceUpdateForLegacySuspense;
- sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete);
- if (sourceFiber.tag === ClassComponent) {
- var currentSourceFiber = sourceFiber.alternate;
- if (currentSourceFiber === null) {
- sourceFiber.tag = IncompleteClassComponent;
- } else {
- var update = createUpdate(NoTimestamp, SyncLane);
- update.tag = ForceUpdate;
- enqueueUpdate(sourceFiber, update);
- }
- }
- sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane);
- return;
- }
- attachPingListener(root2, wakeable, rootRenderLanes);
- _workInProgress.flags |= ShouldCapture;
- _workInProgress.lanes = rootRenderLanes;
- return;
- }
- _workInProgress = _workInProgress.return;
- } while (_workInProgress !== null);
- value = new Error((getComponentName(sourceFiber.type) || "A React component") + " suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.");
- }
- renderDidError();
- value = createCapturedValue(value, sourceFiber);
- var workInProgress2 = returnFiber;
- do {
- switch (workInProgress2.tag) {
- case HostRoot: {
- var _errorInfo = value;
- workInProgress2.flags |= ShouldCapture;
- var lane = pickArbitraryLane(rootRenderLanes);
- workInProgress2.lanes = mergeLanes(workInProgress2.lanes, lane);
- var _update = createRootErrorUpdate(workInProgress2, _errorInfo, lane);
- enqueueCapturedUpdate(workInProgress2, _update);
- return;
- }
- case ClassComponent:
- var errorInfo = value;
- var ctor = workInProgress2.type;
- var instance = workInProgress2.stateNode;
- if ((workInProgress2.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === "function" || instance !== null && typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance))) {
- workInProgress2.flags |= ShouldCapture;
- var _lane = pickArbitraryLane(rootRenderLanes);
- workInProgress2.lanes = mergeLanes(workInProgress2.lanes, _lane);
- var _update2 = createClassErrorUpdate(workInProgress2, errorInfo, _lane);
- enqueueCapturedUpdate(workInProgress2, _update2);
- return;
- }
- break;
- }
- workInProgress2 = workInProgress2.return;
- } while (workInProgress2 !== null);
- }
var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
{
didWarnAboutUndefinedSnapshotBeforeUpdate = /* @__PURE__ */ new Set();
}
+ var offscreenSubtreeIsHidden = false;
+ var offscreenSubtreeWasHidden = false;
var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set;
+ var nextEffect = null;
+ var inProgressLanes = null;
+ var inProgressRoot = null;
+ function reportUncaughtErrorInDEV(error2) {
+ {
+ invokeGuardedCallback(null, function() {
+ throw error2;
+ });
+ clearCaughtError();
+ }
+ }
var callComponentWillUnmountWithTimer = function(current2, instance) {
instance.props = current2.memoizedProps;
instance.state = current2.memoizedState;
- {
+ if (current2.mode & ProfileMode) {
+ try {
+ startLayoutEffectTimer();
+ instance.componentWillUnmount();
+ } finally {
+ recordLayoutEffectDuration(current2);
+ }
+ } else {
instance.componentWillUnmount();
}
};
- function safelyCallComponentWillUnmount(current2, instance) {
- {
- invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current2, instance);
- if (hasCaughtError()) {
- var unmountError = clearCaughtError();
- captureCommitPhaseError(current2, unmountError);
- }
+ function safelyCallCommitHookLayoutEffectListMount(current2, nearestMountedAncestor) {
+ try {
+ commitHookEffectListMount(Layout, current2);
+ } catch (error2) {
+ captureCommitPhaseError(current2, nearestMountedAncestor, error2);
+ }
+ }
+ function safelyCallComponentWillUnmount(current2, nearestMountedAncestor, instance) {
+ try {
+ callComponentWillUnmountWithTimer(current2, instance);
+ } catch (error2) {
+ captureCommitPhaseError(current2, nearestMountedAncestor, error2);
+ }
+ }
+ function safelyCallComponentDidMount(current2, nearestMountedAncestor, instance) {
+ try {
+ instance.componentDidMount();
+ } catch (error2) {
+ captureCommitPhaseError(current2, nearestMountedAncestor, error2);
}
}
- function safelyDetachRef(current2) {
+ function safelyAttachRef(current2, nearestMountedAncestor) {
+ try {
+ commitAttachRef(current2);
+ } catch (error2) {
+ captureCommitPhaseError(current2, nearestMountedAncestor, error2);
+ }
+ }
+ function safelyDetachRef(current2, nearestMountedAncestor) {
var ref = current2.ref;
if (ref !== null) {
if (typeof ref === "function") {
+ var retVal;
+ try {
+ if (enableProfilerTimer && enableProfilerCommitHooks && current2.mode & ProfileMode) {
+ try {
+ startLayoutEffectTimer();
+ retVal = ref(null);
+ } finally {
+ recordLayoutEffectDuration(current2);
+ }
+ } else {
+ retVal = ref(null);
+ }
+ } catch (error2) {
+ captureCommitPhaseError(current2, nearestMountedAncestor, error2);
+ }
{
- invokeGuardedCallback(null, ref, null, null);
- if (hasCaughtError()) {
- var refError = clearCaughtError();
- captureCommitPhaseError(current2, refError);
+ if (typeof retVal === "function") {
+ error("Unexpected return value from a callback ref in %s. A callback ref should not return a function.", getComponentNameFromFiber(current2));
}
}
} else {
@@ -17066,25 +18637,67 @@
}
}
}
- function safelyCallDestroy(current2, destroy) {
- {
- invokeGuardedCallback(null, destroy, null);
- if (hasCaughtError()) {
- var error2 = clearCaughtError();
- captureCommitPhaseError(current2, error2);
+ function safelyCallDestroy(current2, nearestMountedAncestor, destroy) {
+ try {
+ destroy();
+ } catch (error2) {
+ captureCommitPhaseError(current2, nearestMountedAncestor, error2);
+ }
+ }
+ var focusedInstanceHandle = null;
+ var shouldFireAfterActiveInstanceBlur = false;
+ function commitBeforeMutationEffects(root2, firstChild) {
+ focusedInstanceHandle = prepareForCommit(root2.containerInfo);
+ nextEffect = firstChild;
+ commitBeforeMutationEffects_begin();
+ var shouldFire = shouldFireAfterActiveInstanceBlur;
+ shouldFireAfterActiveInstanceBlur = false;
+ focusedInstanceHandle = null;
+ return shouldFire;
+ }
+ function commitBeforeMutationEffects_begin() {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ var child = fiber.child;
+ if ((fiber.subtreeFlags & BeforeMutationMask) !== NoFlags && child !== null) {
+ child.return = fiber;
+ nextEffect = child;
+ } else {
+ commitBeforeMutationEffects_complete();
}
}
}
- function commitBeforeMutationLifeCycles(current2, finishedWork) {
- switch (finishedWork.tag) {
- case FunctionComponent:
- case ForwardRef:
- case SimpleMemoComponent:
- case Block: {
+ function commitBeforeMutationEffects_complete() {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ setCurrentFiber(fiber);
+ try {
+ commitBeforeMutationEffectsOnFiber(fiber);
+ } catch (error2) {
+ captureCommitPhaseError(fiber, fiber.return, error2);
+ }
+ resetCurrentFiber();
+ var sibling = fiber.sibling;
+ if (sibling !== null) {
+ sibling.return = fiber.return;
+ nextEffect = sibling;
return;
}
- case ClassComponent: {
- if (finishedWork.flags & Snapshot) {
+ nextEffect = fiber.return;
+ }
+ }
+ function commitBeforeMutationEffectsOnFiber(finishedWork) {
+ var current2 = finishedWork.alternate;
+ var flags = finishedWork.flags;
+ if ((flags & Snapshot) !== NoFlags) {
+ setCurrentFiber(finishedWork);
+ switch (finishedWork.tag) {
+ case FunctionComponent:
+ case ForwardRef:
+ case SimpleMemoComponent: {
+ break;
+ }
+ case ClassComponent: {
if (current2 !== null) {
var prevProps = current2.memoizedProps;
var prevState = current2.memoizedState;
@@ -17092,10 +18705,10 @@
{
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
if (instance.props !== finishedWork.memoizedProps) {
- error("Expected %s props to match memoized props before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork.type) || "instance");
+ error("Expected %s props to match memoized props before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
}
if (instance.state !== finishedWork.memoizedState) {
- error("Expected %s state to match memoized state before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork.type) || "instance");
+ error("Expected %s state to match memoized state before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
}
}
}
@@ -17104,75 +18717,128 @@
var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
if (snapshot === void 0 && !didWarnSet.has(finishedWork.type)) {
didWarnSet.add(finishedWork.type);
- error("%s.getSnapshotBeforeUpdate(): A snapshot value (or null) must be returned. You have returned undefined.", getComponentName(finishedWork.type));
+ error("%s.getSnapshotBeforeUpdate(): A snapshot value (or null) must be returned. You have returned undefined.", getComponentNameFromFiber(finishedWork));
}
}
instance.__reactInternalSnapshotBeforeUpdate = snapshot;
}
+ break;
}
- return;
- }
- case HostRoot: {
- {
- if (finishedWork.flags & Snapshot) {
+ case HostRoot: {
+ {
var root2 = finishedWork.stateNode;
clearContainer(root2.containerInfo);
}
+ break;
+ }
+ case HostComponent:
+ case HostText:
+ case HostPortal:
+ case IncompleteClassComponent:
+ break;
+ default: {
+ throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
}
- return;
- }
- case HostComponent:
- case HostText:
- case HostPortal:
- case IncompleteClassComponent:
- return;
- }
- {
- {
- throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
}
+ resetCurrentFiber();
}
}
- function commitHookEffectListUnmount(tag, finishedWork) {
+ function commitHookEffectListUnmount(flags, finishedWork, nearestMountedAncestor) {
var updateQueue = finishedWork.updateQueue;
var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
if (lastEffect !== null) {
var firstEffect = lastEffect.next;
var effect4 = firstEffect;
do {
- if ((effect4.tag & tag) === tag) {
+ if ((effect4.tag & flags) === flags) {
var destroy = effect4.destroy;
effect4.destroy = void 0;
if (destroy !== void 0) {
- destroy();
+ {
+ if ((flags & Passive$1) !== NoFlags$1) {
+ markComponentPassiveEffectUnmountStarted(finishedWork);
+ } else if ((flags & Layout) !== NoFlags$1) {
+ markComponentLayoutEffectUnmountStarted(finishedWork);
+ }
+ }
+ {
+ if ((flags & Insertion) !== NoFlags$1) {
+ setIsRunningInsertionEffect(true);
+ }
+ }
+ safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy);
+ {
+ if ((flags & Insertion) !== NoFlags$1) {
+ setIsRunningInsertionEffect(false);
+ }
+ }
+ {
+ if ((flags & Passive$1) !== NoFlags$1) {
+ markComponentPassiveEffectUnmountStopped();
+ } else if ((flags & Layout) !== NoFlags$1) {
+ markComponentLayoutEffectUnmountStopped();
+ }
+ }
}
}
effect4 = effect4.next;
} while (effect4 !== firstEffect);
}
}
- function commitHookEffectListMount(tag, finishedWork) {
+ function commitHookEffectListMount(flags, finishedWork) {
var updateQueue = finishedWork.updateQueue;
var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
if (lastEffect !== null) {
var firstEffect = lastEffect.next;
var effect4 = firstEffect;
do {
- if ((effect4.tag & tag) === tag) {
+ if ((effect4.tag & flags) === flags) {
+ {
+ if ((flags & Passive$1) !== NoFlags$1) {
+ markComponentPassiveEffectMountStarted(finishedWork);
+ } else if ((flags & Layout) !== NoFlags$1) {
+ markComponentLayoutEffectMountStarted(finishedWork);
+ }
+ }
var create = effect4.create;
+ {
+ if ((flags & Insertion) !== NoFlags$1) {
+ setIsRunningInsertionEffect(true);
+ }
+ }
effect4.destroy = create();
{
+ if ((flags & Insertion) !== NoFlags$1) {
+ setIsRunningInsertionEffect(false);
+ }
+ }
+ {
+ if ((flags & Passive$1) !== NoFlags$1) {
+ markComponentPassiveEffectMountStopped();
+ } else if ((flags & Layout) !== NoFlags$1) {
+ markComponentLayoutEffectMountStopped();
+ }
+ }
+ {
var destroy = effect4.destroy;
if (destroy !== void 0 && typeof destroy !== "function") {
+ var hookName = void 0;
+ if ((effect4.tag & Layout) !== NoFlags) {
+ hookName = "useLayoutEffect";
+ } else if ((effect4.tag & Insertion) !== NoFlags) {
+ hookName = "useInsertionEffect";
+ } else {
+ hookName = "useEffect";
+ }
var addendum = void 0;
if (destroy === null) {
addendum = " You returned null. If your effect does not require clean up, return undefined (or nothing).";
} else if (typeof destroy.then === "function") {
- addendum = "\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. Instead, write the async function inside your effect and call it immediately:\n\nuseEffect(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching";
+ addendum = "\n\nIt looks like you wrote " + hookName + "(async () => ...) or returned a Promise. Instead, write the async function inside your effect and call it immediately:\n\n" + hookName + "(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching";
} else {
addendum = " You returned: " + destroy;
}
- error("An effect function must not return anything besides a function, which is used for clean-up.%s", addendum);
+ error("%s must not return anything besides a function, which is used for clean-up.%s", hookName, addendum);
}
}
}
@@ -17180,166 +18846,288 @@
} while (effect4 !== firstEffect);
}
}
- function schedulePassiveEffects(finishedWork) {
- var updateQueue = finishedWork.updateQueue;
- var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
- if (lastEffect !== null) {
- var firstEffect = lastEffect.next;
- var effect4 = firstEffect;
- do {
- var _effect = effect4, next = _effect.next, tag = _effect.tag;
- if ((tag & Passive$1) !== NoFlags$1 && (tag & HasEffect) !== NoFlags$1) {
- enqueuePendingPassiveHookEffectUnmount(finishedWork, effect4);
- enqueuePendingPassiveHookEffectMount(finishedWork, effect4);
+ function commitPassiveEffectDurations(finishedRoot, finishedWork) {
+ {
+ if ((finishedWork.flags & Update) !== NoFlags) {
+ switch (finishedWork.tag) {
+ case Profiler: {
+ var passiveEffectDuration = finishedWork.stateNode.passiveEffectDuration;
+ var _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id, onPostCommit = _finishedWork$memoize.onPostCommit;
+ var commitTime2 = getCommitTime();
+ var phase = finishedWork.alternate === null ? "mount" : "update";
+ {
+ if (isCurrentUpdateNested()) {
+ phase = "nested-update";
+ }
+ }
+ if (typeof onPostCommit === "function") {
+ onPostCommit(id, phase, passiveEffectDuration, commitTime2);
+ }
+ var parentFiber = finishedWork.return;
+ outer:
+ while (parentFiber !== null) {
+ switch (parentFiber.tag) {
+ case HostRoot:
+ var root2 = parentFiber.stateNode;
+ root2.passiveEffectDuration += passiveEffectDuration;
+ break outer;
+ case Profiler:
+ var parentStateNode = parentFiber.stateNode;
+ parentStateNode.passiveEffectDuration += passiveEffectDuration;
+ break outer;
+ }
+ parentFiber = parentFiber.return;
+ }
+ break;
+ }
}
- effect4 = next;
- } while (effect4 !== firstEffect);
+ }
}
}
- function commitLifeCycles(finishedRoot, current2, finishedWork, committedLanes) {
- switch (finishedWork.tag) {
- case FunctionComponent:
- case ForwardRef:
- case SimpleMemoComponent:
- case Block: {
- {
- commitHookEffectListMount(Layout | HasEffect, finishedWork);
+ function commitLayoutEffectOnFiber(finishedRoot, current2, finishedWork, committedLanes) {
+ if ((finishedWork.flags & LayoutMask) !== NoFlags) {
+ switch (finishedWork.tag) {
+ case FunctionComponent:
+ case ForwardRef:
+ case SimpleMemoComponent: {
+ if (!offscreenSubtreeWasHidden) {
+ if (finishedWork.mode & ProfileMode) {
+ try {
+ startLayoutEffectTimer();
+ commitHookEffectListMount(Layout | HasEffect, finishedWork);
+ } finally {
+ recordLayoutEffectDuration(finishedWork);
+ }
+ } else {
+ commitHookEffectListMount(Layout | HasEffect, finishedWork);
+ }
+ }
+ break;
}
- schedulePassiveEffects(finishedWork);
- return;
- }
- case ClassComponent: {
- var instance = finishedWork.stateNode;
- if (finishedWork.flags & Update) {
- if (current2 === null) {
- {
- if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
- if (instance.props !== finishedWork.memoizedProps) {
- error("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork.type) || "instance");
+ case ClassComponent: {
+ var instance = finishedWork.stateNode;
+ if (finishedWork.flags & Update) {
+ if (!offscreenSubtreeWasHidden) {
+ if (current2 === null) {
+ {
+ if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
+ if (instance.props !== finishedWork.memoizedProps) {
+ error("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
+ }
+ if (instance.state !== finishedWork.memoizedState) {
+ error("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
+ }
+ }
}
- if (instance.state !== finishedWork.memoizedState) {
- error("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork.type) || "instance");
+ if (finishedWork.mode & ProfileMode) {
+ try {
+ startLayoutEffectTimer();
+ instance.componentDidMount();
+ } finally {
+ recordLayoutEffectDuration(finishedWork);
+ }
+ } else {
+ instance.componentDidMount();
+ }
+ } else {
+ var prevProps = finishedWork.elementType === finishedWork.type ? current2.memoizedProps : resolveDefaultProps(finishedWork.type, current2.memoizedProps);
+ var prevState = current2.memoizedState;
+ {
+ if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
+ if (instance.props !== finishedWork.memoizedProps) {
+ error("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
+ }
+ if (instance.state !== finishedWork.memoizedState) {
+ error("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
+ }
+ }
+ }
+ if (finishedWork.mode & ProfileMode) {
+ try {
+ startLayoutEffectTimer();
+ instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
+ } finally {
+ recordLayoutEffectDuration(finishedWork);
+ }
+ } else {
+ instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
}
}
}
- {
- instance.componentDidMount();
- }
- } else {
- var prevProps = finishedWork.elementType === finishedWork.type ? current2.memoizedProps : resolveDefaultProps(finishedWork.type, current2.memoizedProps);
- var prevState = current2.memoizedState;
+ }
+ var updateQueue = finishedWork.updateQueue;
+ if (updateQueue !== null) {
{
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
if (instance.props !== finishedWork.memoizedProps) {
- error("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork.type) || "instance");
+ error("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
}
if (instance.state !== finishedWork.memoizedState) {
- error("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork.type) || "instance");
+ error("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
}
}
}
- {
- instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
+ commitUpdateQueue(finishedWork, updateQueue, instance);
+ }
+ break;
+ }
+ case HostRoot: {
+ var _updateQueue = finishedWork.updateQueue;
+ if (_updateQueue !== null) {
+ var _instance = null;
+ if (finishedWork.child !== null) {
+ switch (finishedWork.child.tag) {
+ case HostComponent:
+ _instance = getPublicInstance(finishedWork.child.stateNode);
+ break;
+ case ClassComponent:
+ _instance = finishedWork.child.stateNode;
+ break;
+ }
}
+ commitUpdateQueue(finishedWork, _updateQueue, _instance);
}
+ break;
}
- var updateQueue = finishedWork.updateQueue;
- if (updateQueue !== null) {
+ case HostComponent: {
+ var _instance2 = finishedWork.stateNode;
+ if (current2 === null && finishedWork.flags & Update) {
+ var type = finishedWork.type;
+ var props = finishedWork.memoizedProps;
+ commitMount(_instance2, type, props);
+ }
+ break;
+ }
+ case HostText: {
+ break;
+ }
+ case HostPortal: {
+ break;
+ }
+ case Profiler: {
{
- if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
- if (instance.props !== finishedWork.memoizedProps) {
- error("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork.type) || "instance");
+ var _finishedWork$memoize2 = finishedWork.memoizedProps, onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender;
+ var effectDuration = finishedWork.stateNode.effectDuration;
+ var commitTime2 = getCommitTime();
+ var phase = current2 === null ? "mount" : "update";
+ {
+ if (isCurrentUpdateNested()) {
+ phase = "nested-update";
}
- if (instance.state !== finishedWork.memoizedState) {
- error("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork.type) || "instance");
+ }
+ if (typeof onRender === "function") {
+ onRender(finishedWork.memoizedProps.id, phase, finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime2);
+ }
+ {
+ if (typeof onCommit === "function") {
+ onCommit(finishedWork.memoizedProps.id, phase, effectDuration, commitTime2);
}
+ enqueuePendingPassiveProfilerEffect(finishedWork);
+ var parentFiber = finishedWork.return;
+ outer:
+ while (parentFiber !== null) {
+ switch (parentFiber.tag) {
+ case HostRoot:
+ var root2 = parentFiber.stateNode;
+ root2.effectDuration += effectDuration;
+ break outer;
+ case Profiler:
+ var parentStateNode = parentFiber.stateNode;
+ parentStateNode.effectDuration += effectDuration;
+ break outer;
+ }
+ parentFiber = parentFiber.return;
+ }
}
}
- commitUpdateQueue(finishedWork, updateQueue, instance);
+ break;
}
- return;
- }
- case HostRoot: {
- var _updateQueue = finishedWork.updateQueue;
- if (_updateQueue !== null) {
- var _instance = null;
- if (finishedWork.child !== null) {
- switch (finishedWork.child.tag) {
- case HostComponent:
- _instance = getPublicInstance(finishedWork.child.stateNode);
- break;
- case ClassComponent:
- _instance = finishedWork.child.stateNode;
- break;
- }
- }
- commitUpdateQueue(finishedWork, _updateQueue, _instance);
+ case SuspenseComponent: {
+ commitSuspenseHydrationCallbacks(finishedRoot, finishedWork);
+ break;
}
- return;
- }
- case HostComponent: {
- var _instance2 = finishedWork.stateNode;
- if (current2 === null && finishedWork.flags & Update) {
- var type = finishedWork.type;
- var props = finishedWork.memoizedProps;
- commitMount(_instance2, type, props);
+ case SuspenseListComponent:
+ case IncompleteClassComponent:
+ case ScopeComponent:
+ case OffscreenComponent:
+ case LegacyHiddenComponent:
+ case TracingMarkerComponent: {
+ break;
}
- return;
- }
- case HostText: {
- return;
+ default:
+ throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
}
- case HostPortal: {
- return;
+ }
+ if (!offscreenSubtreeWasHidden) {
+ {
+ if (finishedWork.flags & Ref) {
+ commitAttachRef(finishedWork);
+ }
}
- case Profiler: {
- {
- var _finishedWork$memoize2 = finishedWork.memoizedProps, onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender;
- var effectDuration = finishedWork.stateNode.effectDuration;
- var commitTime2 = getCommitTime();
- if (typeof onRender === "function") {
- {
- onRender(finishedWork.memoizedProps.id, current2 === null ? "mount" : "update", finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime2, finishedRoot.memoizedInteractions);
- }
+ }
+ }
+ function reappearLayoutEffectsOnFiber(node) {
+ switch (node.tag) {
+ case FunctionComponent:
+ case ForwardRef:
+ case SimpleMemoComponent: {
+ if (node.mode & ProfileMode) {
+ try {
+ startLayoutEffectTimer();
+ safelyCallCommitHookLayoutEffectListMount(node, node.return);
+ } finally {
+ recordLayoutEffectDuration(node);
}
+ } else {
+ safelyCallCommitHookLayoutEffectListMount(node, node.return);
}
- return;
+ break;
}
- case SuspenseComponent: {
- commitSuspenseHydrationCallbacks(finishedRoot, finishedWork);
- return;
+ case ClassComponent: {
+ var instance = node.stateNode;
+ if (typeof instance.componentDidMount === "function") {
+ safelyCallComponentDidMount(node, node.return, instance);
+ }
+ safelyAttachRef(node, node.return);
+ break;
}
- case SuspenseListComponent:
- case IncompleteClassComponent:
- case FundamentalComponent:
- case ScopeComponent:
- case OffscreenComponent:
- case LegacyHiddenComponent:
- return;
- }
- {
- {
- throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
+ case HostComponent: {
+ safelyAttachRef(node, node.return);
+ break;
}
}
}
function hideOrUnhideAllChildren(finishedWork, isHidden3) {
+ var hostSubtreeRoot = null;
{
var node = finishedWork;
while (true) {
if (node.tag === HostComponent) {
- var instance = node.stateNode;
- if (isHidden3) {
- hideInstance(instance);
- } else {
- unhideInstance(node.stateNode, node.memoizedProps);
+ if (hostSubtreeRoot === null) {
+ hostSubtreeRoot = node;
+ try {
+ var instance = node.stateNode;
+ if (isHidden3) {
+ hideInstance(instance);
+ } else {
+ unhideInstance(node.stateNode, node.memoizedProps);
+ }
+ } catch (error2) {
+ captureCommitPhaseError(finishedWork, finishedWork.return, error2);
+ }
}
} else if (node.tag === HostText) {
- var _instance3 = node.stateNode;
- if (isHidden3) {
- hideTextInstance(_instance3);
- } else {
- unhideTextInstance(_instance3, node.memoizedProps);
+ if (hostSubtreeRoot === null) {
+ try {
+ var _instance3 = node.stateNode;
+ if (isHidden3) {
+ hideTextInstance(_instance3);
+ } else {
+ unhideTextInstance(_instance3, node.memoizedProps);
+ }
+ } catch (error2) {
+ captureCommitPhaseError(finishedWork, finishedWork.return, error2);
+ }
}
} else if ((node.tag === OffscreenComponent || node.tag === LegacyHiddenComponent) && node.memoizedState !== null && node !== finishedWork)
;
@@ -17355,8 +19143,14 @@
if (node.return === null || node.return === finishedWork) {
return;
}
+ if (hostSubtreeRoot === node) {
+ hostSubtreeRoot = null;
+ }
node = node.return;
}
+ if (hostSubtreeRoot === node) {
+ hostSubtreeRoot = null;
+ }
node.sibling.return = node.return;
node = node.sibling;
}
@@ -17375,124 +19169,68 @@
instanceToUse = instance;
}
if (typeof ref === "function") {
- ref(instanceToUse);
+ var retVal;
+ if (finishedWork.mode & ProfileMode) {
+ try {
+ startLayoutEffectTimer();
+ retVal = ref(instanceToUse);
+ } finally {
+ recordLayoutEffectDuration(finishedWork);
+ }
+ } else {
+ retVal = ref(instanceToUse);
+ }
+ {
+ if (typeof retVal === "function") {
+ error("Unexpected return value from a callback ref in %s. A callback ref should not return a function.", getComponentNameFromFiber(finishedWork));
+ }
+ }
} else {
{
if (!ref.hasOwnProperty("current")) {
- error("Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().", getComponentName(finishedWork.type));
+ error("Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().", getComponentNameFromFiber(finishedWork));
}
}
ref.current = instanceToUse;
}
}
}
- function commitDetachRef(current2) {
- var currentRef = current2.ref;
- if (currentRef !== null) {
- if (typeof currentRef === "function") {
- currentRef(null);
- } else {
- currentRef.current = null;
- }
+ function detachFiberMutation(fiber) {
+ var alternate = fiber.alternate;
+ if (alternate !== null) {
+ alternate.return = null;
}
+ fiber.return = null;
}
- function commitUnmount(finishedRoot, current2, renderPriorityLevel) {
- onCommitUnmount(current2);
- switch (current2.tag) {
- case FunctionComponent:
- case ForwardRef:
- case MemoComponent:
- case SimpleMemoComponent:
- case Block: {
- var updateQueue = current2.updateQueue;
- if (updateQueue !== null) {
- var lastEffect = updateQueue.lastEffect;
- if (lastEffect !== null) {
- var firstEffect = lastEffect.next;
- var effect4 = firstEffect;
- do {
- var _effect2 = effect4, destroy = _effect2.destroy, tag = _effect2.tag;
- if (destroy !== void 0) {
- if ((tag & Passive$1) !== NoFlags$1) {
- enqueuePendingPassiveHookEffectUnmount(current2, effect4);
- } else {
- {
- safelyCallDestroy(current2, destroy);
- }
- }
- }
- effect4 = effect4.next;
- } while (effect4 !== firstEffect);
- }
- }
- return;
- }
- case ClassComponent: {
- safelyDetachRef(current2);
- var instance = current2.stateNode;
- if (typeof instance.componentWillUnmount === "function") {
- safelyCallComponentWillUnmount(current2, instance);
- }
- return;
- }
- case HostComponent: {
- safelyDetachRef(current2);
- return;
- }
- case HostPortal: {
- {
- unmountHostComponents(finishedRoot, current2);
- }
- return;
- }
- case FundamentalComponent: {
- return;
- }
- case DehydratedFragment: {
- return;
- }
- case ScopeComponent: {
- return;
- }
+ function detachFiberAfterEffects(fiber) {
+ var alternate = fiber.alternate;
+ if (alternate !== null) {
+ fiber.alternate = null;
+ detachFiberAfterEffects(alternate);
}
- }
- function commitNestedUnmounts(finishedRoot, root2, renderPriorityLevel) {
- var node = root2;
- while (true) {
- commitUnmount(finishedRoot, node);
- if (node.child !== null && // If we use mutation we drill down into portals using commitUnmount above.
- // If we don't use mutation we drill down into portals here instead.
- node.tag !== HostPortal) {
- node.child.return = node;
- node = node.child;
- continue;
+ {
+ fiber.child = null;
+ fiber.deletions = null;
+ fiber.sibling = null;
+ if (fiber.tag === HostComponent) {
+ var hostInstance = fiber.stateNode;
+ if (hostInstance !== null) {
+ detachDeletedInstance(hostInstance);
+ }
}
- if (node === root2) {
- return;
+ fiber.stateNode = null;
+ {
+ fiber._debugOwner = null;
}
- while (node.sibling === null) {
- if (node.return === null || node.return === root2) {
- return;
- }
- node = node.return;
+ {
+ fiber.return = null;
+ fiber.dependencies = null;
+ fiber.memoizedProps = null;
+ fiber.memoizedState = null;
+ fiber.pendingProps = null;
+ fiber.stateNode = null;
+ fiber.updateQueue = null;
}
- node.sibling.return = node.return;
- node = node.sibling;
- }
- }
- function detachFiberMutation(fiber) {
- fiber.alternate = null;
- fiber.child = null;
- fiber.dependencies = null;
- fiber.firstEffect = null;
- fiber.lastEffect = null;
- fiber.memoizedProps = null;
- fiber.memoizedState = null;
- fiber.pendingProps = null;
- fiber.return = null;
- fiber.updateQueue = null;
- {
- fiber._debugOwner = null;
}
}
function getHostParentFiber(fiber) {
@@ -17503,11 +19241,7 @@
}
parent = parent.return;
}
- {
- {
- throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
- }
- }
+ throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
}
function isHostParent(fiber) {
return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
@@ -17542,45 +19276,33 @@
}
function commitPlacement(finishedWork) {
var parentFiber = getHostParentFiber(finishedWork);
- var parent;
- var isContainer;
- var parentStateNode = parentFiber.stateNode;
switch (parentFiber.tag) {
- case HostComponent:
- parent = parentStateNode;
- isContainer = false;
+ case HostComponent: {
+ var parent = parentFiber.stateNode;
+ if (parentFiber.flags & ContentReset) {
+ resetTextContent(parent);
+ parentFiber.flags &= ~ContentReset;
+ }
+ var before = getHostSibling(finishedWork);
+ insertOrAppendPlacementNode(finishedWork, before, parent);
break;
+ }
case HostRoot:
- parent = parentStateNode.containerInfo;
- isContainer = true;
- break;
- case HostPortal:
- parent = parentStateNode.containerInfo;
- isContainer = true;
+ case HostPortal: {
+ var _parent = parentFiber.stateNode.containerInfo;
+ var _before = getHostSibling(finishedWork);
+ insertOrAppendPlacementNodeIntoContainer(finishedWork, _before, _parent);
break;
- case FundamentalComponent:
- default: {
- {
- throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
- }
}
- }
- if (parentFiber.flags & ContentReset) {
- resetTextContent(parent);
- parentFiber.flags &= ~ContentReset;
- }
- var before = getHostSibling(finishedWork);
- if (isContainer) {
- insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent);
- } else {
- insertOrAppendPlacementNode(finishedWork, before, parent);
+ default:
+ throw new Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
}
}
function insertOrAppendPlacementNodeIntoContainer(node, before, parent) {
var tag = node.tag;
var isHost = tag === HostComponent || tag === HostText;
- if (isHost || enableFundamentalAPI) {
- var stateNode = isHost ? node.stateNode : node.stateNode.instance;
+ if (isHost) {
+ var stateNode = node.stateNode;
if (before) {
insertInContainerBefore(parent, stateNode, before);
} else {
@@ -17603,8 +19325,8 @@
function insertOrAppendPlacementNode(node, before, parent) {
var tag = node.tag;
var isHost = tag === HostComponent || tag === HostText;
- if (isHost || enableFundamentalAPI) {
- var stateNode = isHost ? node.stateNode : node.stateNode.instance;
+ if (isHost) {
+ var stateNode = node.stateNode;
if (before) {
insertBefore(parent, stateNode, before);
} else {
@@ -17624,234 +19346,928 @@
}
}
}
- function unmountHostComponents(finishedRoot, current2, renderPriorityLevel) {
- var node = current2;
- var currentParentIsValid = false;
- var currentParent;
- var currentParentIsContainer;
- while (true) {
- if (!currentParentIsValid) {
- var parent = node.return;
- findParent:
- while (true) {
- if (!(parent !== null)) {
- {
- throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
- }
+ var hostParent = null;
+ var hostParentIsContainer = false;
+ function commitDeletionEffects(root2, returnFiber, deletedFiber) {
+ {
+ var parent = returnFiber;
+ findParent:
+ while (parent !== null) {
+ switch (parent.tag) {
+ case HostComponent: {
+ hostParent = parent.stateNode;
+ hostParentIsContainer = false;
+ break findParent;
}
- var parentStateNode = parent.stateNode;
- switch (parent.tag) {
- case HostComponent:
- currentParent = parentStateNode;
- currentParentIsContainer = false;
- break findParent;
- case HostRoot:
- currentParent = parentStateNode.containerInfo;
- currentParentIsContainer = true;
- break findParent;
- case HostPortal:
- currentParent = parentStateNode.containerInfo;
- currentParentIsContainer = true;
- break findParent;
+ case HostRoot: {
+ hostParent = parent.stateNode.containerInfo;
+ hostParentIsContainer = true;
+ break findParent;
+ }
+ case HostPortal: {
+ hostParent = parent.stateNode.containerInfo;
+ hostParentIsContainer = true;
+ break findParent;
}
- parent = parent.return;
}
- currentParentIsValid = true;
+ parent = parent.return;
+ }
+ if (hostParent === null) {
+ throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
}
- if (node.tag === HostComponent || node.tag === HostText) {
- commitNestedUnmounts(finishedRoot, node);
- if (currentParentIsContainer) {
- removeChildFromContainer(currentParent, node.stateNode);
- } else {
- removeChild(currentParent, node.stateNode);
+ commitDeletionEffectsOnFiber(root2, returnFiber, deletedFiber);
+ hostParent = null;
+ hostParentIsContainer = false;
+ }
+ detachFiberMutation(deletedFiber);
+ }
+ function recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, parent) {
+ var child = parent.child;
+ while (child !== null) {
+ commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, child);
+ child = child.sibling;
+ }
+ }
+ function commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, deletedFiber) {
+ onCommitUnmount(deletedFiber);
+ switch (deletedFiber.tag) {
+ case HostComponent: {
+ if (!offscreenSubtreeWasHidden) {
+ safelyDetachRef(deletedFiber, nearestMountedAncestor);
}
- } else if (node.tag === HostPortal) {
- if (node.child !== null) {
- currentParent = node.stateNode.containerInfo;
- currentParentIsContainer = true;
- node.child.return = node;
- node = node.child;
- continue;
+ }
+ case HostText: {
+ {
+ var prevHostParent = hostParent;
+ var prevHostParentIsContainer = hostParentIsContainer;
+ hostParent = null;
+ recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
+ hostParent = prevHostParent;
+ hostParentIsContainer = prevHostParentIsContainer;
+ if (hostParent !== null) {
+ if (hostParentIsContainer) {
+ removeChildFromContainer(hostParent, deletedFiber.stateNode);
+ } else {
+ removeChild(hostParent, deletedFiber.stateNode);
+ }
+ }
}
- } else {
- commitUnmount(finishedRoot, node);
- if (node.child !== null) {
- node.child.return = node;
- node = node.child;
- continue;
+ return;
+ }
+ case DehydratedFragment: {
+ {
+ if (hostParent !== null) {
+ if (hostParentIsContainer) {
+ clearSuspenseBoundaryFromContainer(hostParent, deletedFiber.stateNode);
+ } else {
+ clearSuspenseBoundary(hostParent, deletedFiber.stateNode);
+ }
+ }
}
+ return;
}
- if (node === current2) {
+ case HostPortal: {
+ {
+ var _prevHostParent = hostParent;
+ var _prevHostParentIsContainer = hostParentIsContainer;
+ hostParent = deletedFiber.stateNode.containerInfo;
+ hostParentIsContainer = true;
+ recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
+ hostParent = _prevHostParent;
+ hostParentIsContainer = _prevHostParentIsContainer;
+ }
return;
}
- while (node.sibling === null) {
- if (node.return === null || node.return === current2) {
- return;
+ case FunctionComponent:
+ case ForwardRef:
+ case MemoComponent:
+ case SimpleMemoComponent: {
+ if (!offscreenSubtreeWasHidden) {
+ var updateQueue = deletedFiber.updateQueue;
+ if (updateQueue !== null) {
+ var lastEffect = updateQueue.lastEffect;
+ if (lastEffect !== null) {
+ var firstEffect = lastEffect.next;
+ var effect4 = firstEffect;
+ do {
+ var _effect = effect4, destroy = _effect.destroy, tag = _effect.tag;
+ if (destroy !== void 0) {
+ if ((tag & Insertion) !== NoFlags$1) {
+ safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy);
+ } else if ((tag & Layout) !== NoFlags$1) {
+ {
+ markComponentLayoutEffectUnmountStarted(deletedFiber);
+ }
+ if (deletedFiber.mode & ProfileMode) {
+ startLayoutEffectTimer();
+ safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy);
+ recordLayoutEffectDuration(deletedFiber);
+ } else {
+ safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy);
+ }
+ {
+ markComponentLayoutEffectUnmountStopped();
+ }
+ }
+ }
+ effect4 = effect4.next;
+ } while (effect4 !== firstEffect);
+ }
+ }
}
- node = node.return;
- if (node.tag === HostPortal) {
- currentParentIsValid = false;
+ recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
+ return;
+ }
+ case ClassComponent: {
+ if (!offscreenSubtreeWasHidden) {
+ safelyDetachRef(deletedFiber, nearestMountedAncestor);
+ var instance = deletedFiber.stateNode;
+ if (typeof instance.componentWillUnmount === "function") {
+ safelyCallComponentWillUnmount(deletedFiber, nearestMountedAncestor, instance);
+ }
}
+ recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
+ return;
+ }
+ case ScopeComponent: {
+ recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
+ return;
+ }
+ case OffscreenComponent: {
+ if (
+ // TODO: Remove this dead flag
+ deletedFiber.mode & ConcurrentMode
+ ) {
+ var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
+ offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || deletedFiber.memoizedState !== null;
+ recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
+ offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
+ } else {
+ recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
+ }
+ break;
+ }
+ default: {
+ recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
+ return;
}
- node.sibling.return = node.return;
- node = node.sibling;
}
}
- function commitDeletion(finishedRoot, current2, renderPriorityLevel) {
- {
- unmountHostComponents(finishedRoot, current2);
+ function commitSuspenseCallback(finishedWork) {
+ var newState = finishedWork.memoizedState;
+ }
+ function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) {
+ var newState = finishedWork.memoizedState;
+ if (newState === null) {
+ var current2 = finishedWork.alternate;
+ if (current2 !== null) {
+ var prevState = current2.memoizedState;
+ if (prevState !== null) {
+ var suspenseInstance = prevState.dehydrated;
+ if (suspenseInstance !== null) {
+ commitHydratedSuspenseInstance(suspenseInstance);
+ }
+ }
+ }
}
- var alternate = current2.alternate;
- detachFiberMutation(current2);
- if (alternate !== null) {
- detachFiberMutation(alternate);
+ }
+ function attachSuspenseRetryListeners(finishedWork) {
+ var wakeables = finishedWork.updateQueue;
+ if (wakeables !== null) {
+ finishedWork.updateQueue = null;
+ var retryCache = finishedWork.stateNode;
+ if (retryCache === null) {
+ retryCache = finishedWork.stateNode = new PossiblyWeakSet();
+ }
+ wakeables.forEach(function(wakeable) {
+ var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable);
+ if (!retryCache.has(wakeable)) {
+ retryCache.add(wakeable);
+ {
+ if (isDevToolsPresent) {
+ if (inProgressLanes !== null && inProgressRoot !== null) {
+ restorePendingUpdaters(inProgressRoot, inProgressLanes);
+ } else {
+ throw Error("Expected finished root and lanes to be set. This is a bug in React.");
+ }
+ }
+ }
+ wakeable.then(retry, retry);
+ }
+ });
}
}
- function commitWork(current2, finishedWork) {
+ function commitMutationEffects(root2, finishedWork, committedLanes) {
+ inProgressLanes = committedLanes;
+ inProgressRoot = root2;
+ setCurrentFiber(finishedWork);
+ commitMutationEffectsOnFiber(finishedWork, root2);
+ setCurrentFiber(finishedWork);
+ inProgressLanes = null;
+ inProgressRoot = null;
+ }
+ function recursivelyTraverseMutationEffects(root2, parentFiber, lanes) {
+ var deletions = parentFiber.deletions;
+ if (deletions !== null) {
+ for (var i = 0; i < deletions.length; i++) {
+ var childToDelete = deletions[i];
+ try {
+ commitDeletionEffects(root2, parentFiber, childToDelete);
+ } catch (error2) {
+ captureCommitPhaseError(childToDelete, parentFiber, error2);
+ }
+ }
+ }
+ var prevDebugFiber = getCurrentFiber();
+ if (parentFiber.subtreeFlags & MutationMask) {
+ var child = parentFiber.child;
+ while (child !== null) {
+ setCurrentFiber(child);
+ commitMutationEffectsOnFiber(child, root2);
+ child = child.sibling;
+ }
+ }
+ setCurrentFiber(prevDebugFiber);
+ }
+ function commitMutationEffectsOnFiber(finishedWork, root2, lanes) {
+ var current2 = finishedWork.alternate;
+ var flags = finishedWork.flags;
switch (finishedWork.tag) {
case FunctionComponent:
case ForwardRef:
case MemoComponent:
- case SimpleMemoComponent:
- case Block: {
- {
- commitHookEffectListUnmount(Layout | HasEffect, finishedWork);
+ case SimpleMemoComponent: {
+ recursivelyTraverseMutationEffects(root2, finishedWork);
+ commitReconciliationEffects(finishedWork);
+ if (flags & Update) {
+ try {
+ commitHookEffectListUnmount(Insertion | HasEffect, finishedWork, finishedWork.return);
+ commitHookEffectListMount(Insertion | HasEffect, finishedWork);
+ } catch (error2) {
+ captureCommitPhaseError(finishedWork, finishedWork.return, error2);
+ }
+ if (finishedWork.mode & ProfileMode) {
+ try {
+ startLayoutEffectTimer();
+ commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return);
+ } catch (error2) {
+ captureCommitPhaseError(finishedWork, finishedWork.return, error2);
+ }
+ recordLayoutEffectDuration(finishedWork);
+ } else {
+ try {
+ commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return);
+ } catch (error2) {
+ captureCommitPhaseError(finishedWork, finishedWork.return, error2);
+ }
+ }
}
return;
}
case ClassComponent: {
+ recursivelyTraverseMutationEffects(root2, finishedWork);
+ commitReconciliationEffects(finishedWork);
+ if (flags & Ref) {
+ if (current2 !== null) {
+ safelyDetachRef(current2, current2.return);
+ }
+ }
return;
}
case HostComponent: {
- var instance = finishedWork.stateNode;
- if (instance != null) {
- var newProps = finishedWork.memoizedProps;
- var oldProps = current2 !== null ? current2.memoizedProps : newProps;
- var type = finishedWork.type;
- var updatePayload = finishedWork.updateQueue;
- finishedWork.updateQueue = null;
- if (updatePayload !== null) {
- commitUpdate(instance, updatePayload, type, oldProps, newProps);
+ recursivelyTraverseMutationEffects(root2, finishedWork);
+ commitReconciliationEffects(finishedWork);
+ if (flags & Ref) {
+ if (current2 !== null) {
+ safelyDetachRef(current2, current2.return);
+ }
+ }
+ {
+ if (finishedWork.flags & ContentReset) {
+ var instance = finishedWork.stateNode;
+ try {
+ resetTextContent(instance);
+ } catch (error2) {
+ captureCommitPhaseError(finishedWork, finishedWork.return, error2);
+ }
+ }
+ if (flags & Update) {
+ var _instance4 = finishedWork.stateNode;
+ if (_instance4 != null) {
+ var newProps = finishedWork.memoizedProps;
+ var oldProps = current2 !== null ? current2.memoizedProps : newProps;
+ var type = finishedWork.type;
+ var updatePayload = finishedWork.updateQueue;
+ finishedWork.updateQueue = null;
+ if (updatePayload !== null) {
+ try {
+ commitUpdate(_instance4, updatePayload, type, oldProps, newProps, finishedWork);
+ } catch (error2) {
+ captureCommitPhaseError(finishedWork, finishedWork.return, error2);
+ }
+ }
+ }
}
}
return;
}
case HostText: {
- if (!(finishedWork.stateNode !== null)) {
+ recursivelyTraverseMutationEffects(root2, finishedWork);
+ commitReconciliationEffects(finishedWork);
+ if (flags & Update) {
{
- throw Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");
+ if (finishedWork.stateNode === null) {
+ throw new Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");
+ }
+ var textInstance = finishedWork.stateNode;
+ var newText = finishedWork.memoizedProps;
+ var oldText = current2 !== null ? current2.memoizedProps : newText;
+ try {
+ commitTextUpdate(textInstance, oldText, newText);
+ } catch (error2) {
+ captureCommitPhaseError(finishedWork, finishedWork.return, error2);
+ }
}
}
- var textInstance = finishedWork.stateNode;
- var newText = finishedWork.memoizedProps;
- var oldText = current2 !== null ? current2.memoizedProps : newText;
- commitTextUpdate(textInstance, oldText, newText);
return;
}
case HostRoot: {
- {
- var _root = finishedWork.stateNode;
- if (_root.hydrate) {
- _root.hydrate = false;
- commitHydratedContainer(_root.containerInfo);
+ recursivelyTraverseMutationEffects(root2, finishedWork);
+ commitReconciliationEffects(finishedWork);
+ if (flags & Update) {
+ {
+ if (current2 !== null) {
+ var prevRootState = current2.memoizedState;
+ if (prevRootState.isDehydrated) {
+ try {
+ commitHydratedContainer(root2.containerInfo);
+ } catch (error2) {
+ captureCommitPhaseError(finishedWork, finishedWork.return, error2);
+ }
+ }
+ }
}
}
return;
}
- case Profiler: {
+ case HostPortal: {
+ recursivelyTraverseMutationEffects(root2, finishedWork);
+ commitReconciliationEffects(finishedWork);
return;
}
case SuspenseComponent: {
- commitSuspenseComponent(finishedWork);
- attachSuspenseRetryListeners(finishedWork);
+ recursivelyTraverseMutationEffects(root2, finishedWork);
+ commitReconciliationEffects(finishedWork);
+ var offscreenFiber = finishedWork.child;
+ if (offscreenFiber.flags & Visibility) {
+ var offscreenInstance = offscreenFiber.stateNode;
+ var newState = offscreenFiber.memoizedState;
+ var isHidden3 = newState !== null;
+ offscreenInstance.isHidden = isHidden3;
+ if (isHidden3) {
+ var wasHidden = offscreenFiber.alternate !== null && offscreenFiber.alternate.memoizedState !== null;
+ if (!wasHidden) {
+ markCommitTimeOfFallback();
+ }
+ }
+ }
+ if (flags & Update) {
+ try {
+ commitSuspenseCallback(finishedWork);
+ } catch (error2) {
+ captureCommitPhaseError(finishedWork, finishedWork.return, error2);
+ }
+ attachSuspenseRetryListeners(finishedWork);
+ }
return;
}
- case SuspenseListComponent: {
- attachSuspenseRetryListeners(finishedWork);
+ case OffscreenComponent: {
+ var _wasHidden = current2 !== null && current2.memoizedState !== null;
+ if (
+ // TODO: Remove this dead flag
+ finishedWork.mode & ConcurrentMode
+ ) {
+ var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
+ offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || _wasHidden;
+ recursivelyTraverseMutationEffects(root2, finishedWork);
+ offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
+ } else {
+ recursivelyTraverseMutationEffects(root2, finishedWork);
+ }
+ commitReconciliationEffects(finishedWork);
+ if (flags & Visibility) {
+ var _offscreenInstance = finishedWork.stateNode;
+ var _newState = finishedWork.memoizedState;
+ var _isHidden = _newState !== null;
+ var offscreenBoundary = finishedWork;
+ _offscreenInstance.isHidden = _isHidden;
+ {
+ if (_isHidden) {
+ if (!_wasHidden) {
+ if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
+ nextEffect = offscreenBoundary;
+ var offscreenChild = offscreenBoundary.child;
+ while (offscreenChild !== null) {
+ nextEffect = offscreenChild;
+ disappearLayoutEffects_begin(offscreenChild);
+ offscreenChild = offscreenChild.sibling;
+ }
+ }
+ }
+ }
+ }
+ {
+ hideOrUnhideAllChildren(offscreenBoundary, _isHidden);
+ }
+ }
return;
}
- case IncompleteClassComponent: {
+ case SuspenseListComponent: {
+ recursivelyTraverseMutationEffects(root2, finishedWork);
+ commitReconciliationEffects(finishedWork);
+ if (flags & Update) {
+ attachSuspenseRetryListeners(finishedWork);
+ }
return;
}
- case FundamentalComponent: {
- break;
- }
case ScopeComponent: {
- break;
+ return;
}
- case OffscreenComponent:
- case LegacyHiddenComponent: {
- var newState = finishedWork.memoizedState;
- var isHidden3 = newState !== null;
- hideOrUnhideAllChildren(finishedWork, isHidden3);
+ default: {
+ recursivelyTraverseMutationEffects(root2, finishedWork);
+ commitReconciliationEffects(finishedWork);
return;
}
}
- {
- {
- throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
+ }
+ function commitReconciliationEffects(finishedWork) {
+ var flags = finishedWork.flags;
+ if (flags & Placement) {
+ try {
+ commitPlacement(finishedWork);
+ } catch (error2) {
+ captureCommitPhaseError(finishedWork, finishedWork.return, error2);
}
+ finishedWork.flags &= ~Placement;
+ }
+ if (flags & Hydrating) {
+ finishedWork.flags &= ~Hydrating;
}
}
- function commitSuspenseComponent(finishedWork) {
- var newState = finishedWork.memoizedState;
- if (newState !== null) {
- markCommitTimeOfFallback();
- {
- var primaryChildParent = finishedWork.child;
- hideOrUnhideAllChildren(primaryChildParent, true);
+ function commitLayoutEffects(finishedWork, root2, committedLanes) {
+ inProgressLanes = committedLanes;
+ inProgressRoot = root2;
+ nextEffect = finishedWork;
+ commitLayoutEffects_begin(finishedWork, root2, committedLanes);
+ inProgressLanes = null;
+ inProgressRoot = null;
+ }
+ function commitLayoutEffects_begin(subtreeRoot, root2, committedLanes) {
+ var isModernRoot = (subtreeRoot.mode & ConcurrentMode) !== NoMode;
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ var firstChild = fiber.child;
+ if (fiber.tag === OffscreenComponent && isModernRoot) {
+ var isHidden3 = fiber.memoizedState !== null;
+ var newOffscreenSubtreeIsHidden = isHidden3 || offscreenSubtreeIsHidden;
+ if (newOffscreenSubtreeIsHidden) {
+ commitLayoutMountEffects_complete(subtreeRoot, root2, committedLanes);
+ continue;
+ } else {
+ var current2 = fiber.alternate;
+ var wasHidden = current2 !== null && current2.memoizedState !== null;
+ var newOffscreenSubtreeWasHidden = wasHidden || offscreenSubtreeWasHidden;
+ var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden;
+ var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
+ offscreenSubtreeIsHidden = newOffscreenSubtreeIsHidden;
+ offscreenSubtreeWasHidden = newOffscreenSubtreeWasHidden;
+ if (offscreenSubtreeWasHidden && !prevOffscreenSubtreeWasHidden) {
+ nextEffect = fiber;
+ reappearLayoutEffects_begin(fiber);
+ }
+ var child = firstChild;
+ while (child !== null) {
+ nextEffect = child;
+ commitLayoutEffects_begin(
+ child,
+ // New root; bubble back up to here and stop.
+ root2,
+ committedLanes
+ );
+ child = child.sibling;
+ }
+ nextEffect = fiber;
+ offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden;
+ offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
+ commitLayoutMountEffects_complete(subtreeRoot, root2, committedLanes);
+ continue;
+ }
+ }
+ if ((fiber.subtreeFlags & LayoutMask) !== NoFlags && firstChild !== null) {
+ firstChild.return = fiber;
+ nextEffect = firstChild;
+ } else {
+ commitLayoutMountEffects_complete(subtreeRoot, root2, committedLanes);
}
}
}
- function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) {
- var newState = finishedWork.memoizedState;
- if (newState === null) {
- var current2 = finishedWork.alternate;
- if (current2 !== null) {
- var prevState = current2.memoizedState;
- if (prevState !== null) {
- var suspenseInstance = prevState.dehydrated;
- if (suspenseInstance !== null) {
- commitHydratedSuspenseInstance(suspenseInstance);
+ function commitLayoutMountEffects_complete(subtreeRoot, root2, committedLanes) {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ if ((fiber.flags & LayoutMask) !== NoFlags) {
+ var current2 = fiber.alternate;
+ setCurrentFiber(fiber);
+ try {
+ commitLayoutEffectOnFiber(root2, current2, fiber, committedLanes);
+ } catch (error2) {
+ captureCommitPhaseError(fiber, fiber.return, error2);
+ }
+ resetCurrentFiber();
+ }
+ if (fiber === subtreeRoot) {
+ nextEffect = null;
+ return;
+ }
+ var sibling = fiber.sibling;
+ if (sibling !== null) {
+ sibling.return = fiber.return;
+ nextEffect = sibling;
+ return;
+ }
+ nextEffect = fiber.return;
+ }
+ }
+ function disappearLayoutEffects_begin(subtreeRoot) {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ var firstChild = fiber.child;
+ switch (fiber.tag) {
+ case FunctionComponent:
+ case ForwardRef:
+ case MemoComponent:
+ case SimpleMemoComponent: {
+ if (fiber.mode & ProfileMode) {
+ try {
+ startLayoutEffectTimer();
+ commitHookEffectListUnmount(Layout, fiber, fiber.return);
+ } finally {
+ recordLayoutEffectDuration(fiber);
+ }
+ } else {
+ commitHookEffectListUnmount(Layout, fiber, fiber.return);
+ }
+ break;
+ }
+ case ClassComponent: {
+ safelyDetachRef(fiber, fiber.return);
+ var instance = fiber.stateNode;
+ if (typeof instance.componentWillUnmount === "function") {
+ safelyCallComponentWillUnmount(fiber, fiber.return, instance);
+ }
+ break;
+ }
+ case HostComponent: {
+ safelyDetachRef(fiber, fiber.return);
+ break;
+ }
+ case OffscreenComponent: {
+ var isHidden3 = fiber.memoizedState !== null;
+ if (isHidden3) {
+ disappearLayoutEffects_complete(subtreeRoot);
+ continue;
}
+ break;
}
}
+ if (firstChild !== null) {
+ firstChild.return = fiber;
+ nextEffect = firstChild;
+ } else {
+ disappearLayoutEffects_complete(subtreeRoot);
+ }
}
}
- function attachSuspenseRetryListeners(finishedWork) {
- var wakeables = finishedWork.updateQueue;
- if (wakeables !== null) {
- finishedWork.updateQueue = null;
- var retryCache = finishedWork.stateNode;
- if (retryCache === null) {
- retryCache = finishedWork.stateNode = new PossiblyWeakSet();
+ function disappearLayoutEffects_complete(subtreeRoot) {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ if (fiber === subtreeRoot) {
+ nextEffect = null;
+ return;
}
- wakeables.forEach(function(wakeable) {
- var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable);
- if (!retryCache.has(wakeable)) {
+ var sibling = fiber.sibling;
+ if (sibling !== null) {
+ sibling.return = fiber.return;
+ nextEffect = sibling;
+ return;
+ }
+ nextEffect = fiber.return;
+ }
+ }
+ function reappearLayoutEffects_begin(subtreeRoot) {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ var firstChild = fiber.child;
+ if (fiber.tag === OffscreenComponent) {
+ var isHidden3 = fiber.memoizedState !== null;
+ if (isHidden3) {
+ reappearLayoutEffects_complete(subtreeRoot);
+ continue;
+ }
+ }
+ if (firstChild !== null) {
+ firstChild.return = fiber;
+ nextEffect = firstChild;
+ } else {
+ reappearLayoutEffects_complete(subtreeRoot);
+ }
+ }
+ }
+ function reappearLayoutEffects_complete(subtreeRoot) {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ setCurrentFiber(fiber);
+ try {
+ reappearLayoutEffectsOnFiber(fiber);
+ } catch (error2) {
+ captureCommitPhaseError(fiber, fiber.return, error2);
+ }
+ resetCurrentFiber();
+ if (fiber === subtreeRoot) {
+ nextEffect = null;
+ return;
+ }
+ var sibling = fiber.sibling;
+ if (sibling !== null) {
+ sibling.return = fiber.return;
+ nextEffect = sibling;
+ return;
+ }
+ nextEffect = fiber.return;
+ }
+ }
+ function commitPassiveMountEffects(root2, finishedWork, committedLanes, committedTransitions) {
+ nextEffect = finishedWork;
+ commitPassiveMountEffects_begin(finishedWork, root2, committedLanes, committedTransitions);
+ }
+ function commitPassiveMountEffects_begin(subtreeRoot, root2, committedLanes, committedTransitions) {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ var firstChild = fiber.child;
+ if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && firstChild !== null) {
+ firstChild.return = fiber;
+ nextEffect = firstChild;
+ } else {
+ commitPassiveMountEffects_complete(subtreeRoot, root2, committedLanes, committedTransitions);
+ }
+ }
+ }
+ function commitPassiveMountEffects_complete(subtreeRoot, root2, committedLanes, committedTransitions) {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ if ((fiber.flags & Passive) !== NoFlags) {
+ setCurrentFiber(fiber);
+ try {
+ commitPassiveMountOnFiber(root2, fiber, committedLanes, committedTransitions);
+ } catch (error2) {
+ captureCommitPhaseError(fiber, fiber.return, error2);
+ }
+ resetCurrentFiber();
+ }
+ if (fiber === subtreeRoot) {
+ nextEffect = null;
+ return;
+ }
+ var sibling = fiber.sibling;
+ if (sibling !== null) {
+ sibling.return = fiber.return;
+ nextEffect = sibling;
+ return;
+ }
+ nextEffect = fiber.return;
+ }
+ }
+ function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) {
+ switch (finishedWork.tag) {
+ case FunctionComponent:
+ case ForwardRef:
+ case SimpleMemoComponent: {
+ if (finishedWork.mode & ProfileMode) {
+ startPassiveEffectTimer();
+ try {
+ commitHookEffectListMount(Passive$1 | HasEffect, finishedWork);
+ } finally {
+ recordPassiveEffectDuration(finishedWork);
+ }
+ } else {
+ commitHookEffectListMount(Passive$1 | HasEffect, finishedWork);
+ }
+ break;
+ }
+ }
+ }
+ function commitPassiveUnmountEffects(firstChild) {
+ nextEffect = firstChild;
+ commitPassiveUnmountEffects_begin();
+ }
+ function commitPassiveUnmountEffects_begin() {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ var child = fiber.child;
+ if ((nextEffect.flags & ChildDeletion) !== NoFlags) {
+ var deletions = fiber.deletions;
+ if (deletions !== null) {
+ for (var i = 0; i < deletions.length; i++) {
+ var fiberToDelete = deletions[i];
+ nextEffect = fiberToDelete;
+ commitPassiveUnmountEffectsInsideOfDeletedTree_begin(fiberToDelete, fiber);
+ }
{
- if (wakeable.__reactDoNotTraceInteractions !== true) {
- retry = tracing.unstable_wrap(retry);
+ var previousFiber = fiber.alternate;
+ if (previousFiber !== null) {
+ var detachedChild = previousFiber.child;
+ if (detachedChild !== null) {
+ previousFiber.child = null;
+ do {
+ var detachedSibling = detachedChild.sibling;
+ detachedChild.sibling = null;
+ detachedChild = detachedSibling;
+ } while (detachedChild !== null);
+ }
}
}
- retryCache.add(wakeable);
- wakeable.then(retry, retry);
+ nextEffect = fiber;
}
- });
+ }
+ if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && child !== null) {
+ child.return = fiber;
+ nextEffect = child;
+ } else {
+ commitPassiveUnmountEffects_complete();
+ }
}
}
- function isSuspenseBoundaryBeingHidden(current2, finishedWork) {
- if (current2 !== null) {
- var oldState = current2.memoizedState;
- if (oldState === null || oldState.dehydrated !== null) {
- var newState = finishedWork.memoizedState;
- return newState !== null && newState.dehydrated === null;
+ function commitPassiveUnmountEffects_complete() {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ if ((fiber.flags & Passive) !== NoFlags) {
+ setCurrentFiber(fiber);
+ commitPassiveUnmountOnFiber(fiber);
+ resetCurrentFiber();
+ }
+ var sibling = fiber.sibling;
+ if (sibling !== null) {
+ sibling.return = fiber.return;
+ nextEffect = sibling;
+ return;
+ }
+ nextEffect = fiber.return;
+ }
+ }
+ function commitPassiveUnmountOnFiber(finishedWork) {
+ switch (finishedWork.tag) {
+ case FunctionComponent:
+ case ForwardRef:
+ case SimpleMemoComponent: {
+ if (finishedWork.mode & ProfileMode) {
+ startPassiveEffectTimer();
+ commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork, finishedWork.return);
+ recordPassiveEffectDuration(finishedWork);
+ } else {
+ commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork, finishedWork.return);
+ }
+ break;
+ }
+ }
+ }
+ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot, nearestMountedAncestor) {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ setCurrentFiber(fiber);
+ commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor);
+ resetCurrentFiber();
+ var child = fiber.child;
+ if (child !== null) {
+ child.return = fiber;
+ nextEffect = child;
+ } else {
+ commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot);
}
}
- return false;
}
- function commitResetTextContent(current2) {
- resetTextContent(current2.stateNode);
+ function commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot) {
+ while (nextEffect !== null) {
+ var fiber = nextEffect;
+ var sibling = fiber.sibling;
+ var returnFiber = fiber.return;
+ {
+ detachFiberAfterEffects(fiber);
+ if (fiber === deletedSubtreeRoot) {
+ nextEffect = null;
+ return;
+ }
+ }
+ if (sibling !== null) {
+ sibling.return = returnFiber;
+ nextEffect = sibling;
+ return;
+ }
+ nextEffect = returnFiber;
+ }
+ }
+ function commitPassiveUnmountInsideDeletedTreeOnFiber(current2, nearestMountedAncestor) {
+ switch (current2.tag) {
+ case FunctionComponent:
+ case ForwardRef:
+ case SimpleMemoComponent: {
+ if (current2.mode & ProfileMode) {
+ startPassiveEffectTimer();
+ commitHookEffectListUnmount(Passive$1, current2, nearestMountedAncestor);
+ recordPassiveEffectDuration(current2);
+ } else {
+ commitHookEffectListUnmount(Passive$1, current2, nearestMountedAncestor);
+ }
+ break;
+ }
+ }
+ }
+ function invokeLayoutEffectMountInDEV(fiber) {
+ {
+ switch (fiber.tag) {
+ case FunctionComponent:
+ case ForwardRef:
+ case SimpleMemoComponent: {
+ try {
+ commitHookEffectListMount(Layout | HasEffect, fiber);
+ } catch (error2) {
+ captureCommitPhaseError(fiber, fiber.return, error2);
+ }
+ break;
+ }
+ case ClassComponent: {
+ var instance = fiber.stateNode;
+ try {
+ instance.componentDidMount();
+ } catch (error2) {
+ captureCommitPhaseError(fiber, fiber.return, error2);
+ }
+ break;
+ }
+ }
+ }
+ }
+ function invokePassiveEffectMountInDEV(fiber) {
+ {
+ switch (fiber.tag) {
+ case FunctionComponent:
+ case ForwardRef:
+ case SimpleMemoComponent: {
+ try {
+ commitHookEffectListMount(Passive$1 | HasEffect, fiber);
+ } catch (error2) {
+ captureCommitPhaseError(fiber, fiber.return, error2);
+ }
+ break;
+ }
+ }
+ }
+ }
+ function invokeLayoutEffectUnmountInDEV(fiber) {
+ {
+ switch (fiber.tag) {
+ case FunctionComponent:
+ case ForwardRef:
+ case SimpleMemoComponent: {
+ try {
+ commitHookEffectListUnmount(Layout | HasEffect, fiber, fiber.return);
+ } catch (error2) {
+ captureCommitPhaseError(fiber, fiber.return, error2);
+ }
+ break;
+ }
+ case ClassComponent: {
+ var instance = fiber.stateNode;
+ if (typeof instance.componentWillUnmount === "function") {
+ safelyCallComponentWillUnmount(fiber, fiber.return, instance);
+ }
+ break;
+ }
+ }
+ }
+ }
+ function invokePassiveEffectUnmountInDEV(fiber) {
+ {
+ switch (fiber.tag) {
+ case FunctionComponent:
+ case ForwardRef:
+ case SimpleMemoComponent: {
+ try {
+ commitHookEffectListUnmount(Passive$1 | HasEffect, fiber, fiber.return);
+ } catch (error2) {
+ captureCommitPhaseError(fiber, fiber.return, error2);
+ }
+ }
+ }
+ }
}
var COMPONENT_TYPE = 0;
var HAS_PSEUDO_CLASS_TYPE = 1;
@@ -17859,12 +20275,12 @@
var TEST_NAME_TYPE = 3;
var TEXT_TYPE = 4;
if (typeof Symbol === "function" && Symbol.for) {
- var symbolFor$1 = Symbol.for;
- COMPONENT_TYPE = symbolFor$1("selector.component");
- HAS_PSEUDO_CLASS_TYPE = symbolFor$1("selector.has_pseudo_class");
- ROLE_TYPE = symbolFor$1("selector.role");
- TEST_NAME_TYPE = symbolFor$1("selector.test_id");
- TEXT_TYPE = symbolFor$1("selector.text");
+ var symbolFor = Symbol.for;
+ COMPONENT_TYPE = symbolFor("selector.component");
+ HAS_PSEUDO_CLASS_TYPE = symbolFor("selector.has_pseudo_class");
+ ROLE_TYPE = symbolFor("selector.role");
+ TEST_NAME_TYPE = symbolFor("selector.test_id");
+ TEXT_TYPE = symbolFor("selector.text");
}
var commitHooks = [];
function onCommitRoot$1() {
@@ -17874,8 +20290,31 @@
});
}
}
+ var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue;
+ function isLegacyActEnvironment(fiber) {
+ {
+ var isReactActEnvironmentGlobal = (
+ // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global
+ typeof IS_REACT_ACT_ENVIRONMENT !== "undefined" ? IS_REACT_ACT_ENVIRONMENT : void 0
+ );
+ var jestIsDefined = typeof jest !== "undefined";
+ return jestIsDefined && isReactActEnvironmentGlobal !== false;
+ }
+ }
+ function isConcurrentActEnvironment() {
+ {
+ var isReactActEnvironmentGlobal = (
+ // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global
+ typeof IS_REACT_ACT_ENVIRONMENT !== "undefined" ? IS_REACT_ACT_ENVIRONMENT : void 0
+ );
+ if (!isReactActEnvironmentGlobal && ReactCurrentActQueue.current !== null) {
+ error("The current testing environment is not configured to support act(...)");
+ }
+ return isReactActEnvironmentGlobal;
+ }
+ }
var ceil = Math.ceil;
- var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing;
+ var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, ReactCurrentBatchConfig$3 = ReactSharedInternals.ReactCurrentBatchConfig, ReactCurrentActQueue$1 = ReactSharedInternals.ReactCurrentActQueue;
var NoContext = (
/* */
0
@@ -17884,82 +20323,65 @@
/* */
1
);
- var EventContext = (
- /* */
- 2
- );
- var DiscreteEventContext = (
- /* */
- 4
- );
- var LegacyUnbatchedContext = (
- /* */
- 8
- );
var RenderContext = (
/* */
- 16
+ 2
);
var CommitContext = (
/* */
- 32
- );
- var RetryAfterError = (
- /* */
- 64
+ 4
);
- var RootIncomplete = 0;
+ var RootInProgress = 0;
var RootFatalErrored = 1;
var RootErrored = 2;
var RootSuspended = 3;
var RootSuspendedWithDelay = 4;
var RootCompleted = 5;
+ var RootDidNotComplete = 6;
var executionContext = NoContext;
var workInProgressRoot = null;
var workInProgress = null;
var workInProgressRootRenderLanes = NoLanes;
var subtreeRenderLanes = NoLanes;
var subtreeRenderLanesCursor = createCursor(NoLanes);
- var workInProgressRootExitStatus = RootIncomplete;
+ var workInProgressRootExitStatus = RootInProgress;
var workInProgressRootFatalError = null;
var workInProgressRootIncludedLanes = NoLanes;
var workInProgressRootSkippedLanes = NoLanes;
- var workInProgressRootUpdatedLanes = NoLanes;
+ var workInProgressRootInterleavedUpdatedLanes = NoLanes;
var workInProgressRootPingedLanes = NoLanes;
- var mostRecentlyUpdatedRoot = null;
+ var workInProgressRootConcurrentErrors = null;
+ var workInProgressRootRecoverableErrors = null;
var globalMostRecentFallbackTime = 0;
var FALLBACK_THROTTLE_MS = 500;
var workInProgressRootRenderTargetTime = Infinity;
var RENDER_TIMEOUT_MS = 500;
+ var workInProgressTransitions = null;
function resetRenderTimer() {
workInProgressRootRenderTargetTime = now() + RENDER_TIMEOUT_MS;
}
function getRenderTargetTime() {
return workInProgressRootRenderTargetTime;
}
- var nextEffect = null;
var hasUncaughtError = false;
var firstUncaughtError = null;
var legacyErrorBoundariesThatAlreadyFailed = null;
var rootDoesHavePassiveEffects = false;
var rootWithPendingPassiveEffects = null;
- var pendingPassiveEffectsRenderPriority = NoPriority$1;
var pendingPassiveEffectsLanes = NoLanes;
- var pendingPassiveHookEffectsMount = [];
- var pendingPassiveHookEffectsUnmount = [];
- var rootsWithPendingDiscreteUpdates = null;
+ var pendingPassiveProfilerEffects = [];
+ var pendingPassiveTransitions = null;
var NESTED_UPDATE_LIMIT = 50;
var nestedUpdateCount = 0;
var rootWithNestedUpdates = null;
+ var isFlushingPassiveEffects = false;
+ var didScheduleUpdateDuringPassiveEffects = false;
var NESTED_PASSIVE_UPDATE_LIMIT = 50;
var nestedPassiveUpdateCount = 0;
- var spawnedWorkDuringRender = null;
+ var rootWithPassiveNestedUpdates = null;
var currentEventTime = NoTimestamp;
- var currentEventWipLanes = NoLanes;
- var currentEventPendingLanes = NoLanes;
- var isFlushingPassiveEffects = false;
- var focusedInstanceHandle = null;
- var shouldFireAfterActiveInstanceBlur = false;
+ var currentEventTransitionLane = NoLanes;
+ var isRunningInsertionEffect = false;
function getWorkInProgressRoot() {
return workInProgressRoot;
}
@@ -17975,170 +20397,172 @@
}
function requestUpdateLane(fiber) {
var mode = fiber.mode;
- if ((mode & BlockingMode) === NoMode) {
+ if ((mode & ConcurrentMode) === NoMode) {
return SyncLane;
- } else if ((mode & ConcurrentMode) === NoMode) {
- return getCurrentPriorityLevel() === ImmediatePriority$1 ? SyncLane : SyncBatchedLane;
- }
- if (currentEventWipLanes === NoLanes) {
- currentEventWipLanes = workInProgressRootIncludedLanes;
+ } else if ((executionContext & RenderContext) !== NoContext && workInProgressRootRenderLanes !== NoLanes) {
+ return pickArbitraryLane(workInProgressRootRenderLanes);
}
var isTransition = requestCurrentTransition() !== NoTransition;
if (isTransition) {
- if (currentEventPendingLanes !== NoLanes) {
- currentEventPendingLanes = mostRecentlyUpdatedRoot !== null ? mostRecentlyUpdatedRoot.pendingLanes : NoLanes;
+ if (ReactCurrentBatchConfig$3.transition !== null) {
+ var transition = ReactCurrentBatchConfig$3.transition;
+ if (!transition._updatedFibers) {
+ transition._updatedFibers = /* @__PURE__ */ new Set();
+ }
+ transition._updatedFibers.add(fiber);
+ }
+ if (currentEventTransitionLane === NoLane) {
+ currentEventTransitionLane = claimNextTransitionLane();
}
- return findTransitionLane(currentEventWipLanes, currentEventPendingLanes);
+ return currentEventTransitionLane;
}
- var schedulerPriority = getCurrentPriorityLevel();
- var lane;
- if (
- // TODO: Temporary. We're removing the concept of discrete updates.
- (executionContext & DiscreteEventContext) !== NoContext && schedulerPriority === UserBlockingPriority$2
- ) {
- lane = findUpdateLane(InputDiscreteLanePriority, currentEventWipLanes);
- } else {
- var schedulerLanePriority = schedulerPriorityToLanePriority(schedulerPriority);
- lane = findUpdateLane(schedulerLanePriority, currentEventWipLanes);
+ var updateLane = getCurrentUpdatePriority();
+ if (updateLane !== NoLane) {
+ return updateLane;
}
- return lane;
+ var eventLane = getCurrentEventPriority();
+ return eventLane;
}
function requestRetryLane(fiber) {
var mode = fiber.mode;
- if ((mode & BlockingMode) === NoMode) {
+ if ((mode & ConcurrentMode) === NoMode) {
return SyncLane;
- } else if ((mode & ConcurrentMode) === NoMode) {
- return getCurrentPriorityLevel() === ImmediatePriority$1 ? SyncLane : SyncBatchedLane;
- }
- if (currentEventWipLanes === NoLanes) {
- currentEventWipLanes = workInProgressRootIncludedLanes;
}
- return findRetryLane(currentEventWipLanes);
+ return claimNextRetryLane();
}
- function scheduleUpdateOnFiber(fiber, lane, eventTime) {
+ function scheduleUpdateOnFiber(root2, fiber, lane, eventTime) {
checkForNestedUpdates();
- warnAboutRenderPhaseUpdatesInDEV(fiber);
- var root2 = markUpdateLaneFromFiberToRoot(fiber, lane);
- if (root2 === null) {
- warnAboutUpdateOnUnmountedFiberInDEV(fiber);
- return null;
- }
- markRootUpdated(root2, lane, eventTime);
- if (root2 === workInProgressRoot) {
- {
- workInProgressRootUpdatedLanes = mergeLanes(workInProgressRootUpdatedLanes, lane);
+ {
+ if (isRunningInsertionEffect) {
+ error("useInsertionEffect must not schedule updates.");
}
- if (workInProgressRootExitStatus === RootSuspendedWithDelay) {
- markRootSuspended$1(root2, workInProgressRootRenderLanes);
+ }
+ {
+ if (isFlushingPassiveEffects) {
+ didScheduleUpdateDuringPassiveEffects = true;
}
}
- var priorityLevel = getCurrentPriorityLevel();
- if (lane === SyncLane) {
- if (
- // Check if we're inside unbatchedUpdates
- (executionContext & LegacyUnbatchedContext) !== NoContext && // Check if we're not already rendering
- (executionContext & (RenderContext | CommitContext)) === NoContext
- ) {
- schedulePendingInteractions(root2, lane);
- performSyncWorkOnRoot(root2);
- } else {
- ensureRootIsScheduled(root2, eventTime);
- schedulePendingInteractions(root2, lane);
- if (executionContext === NoContext) {
- resetRenderTimer();
- flushSyncCallbackQueue();
+ markRootUpdated(root2, lane, eventTime);
+ if ((executionContext & RenderContext) !== NoLanes && root2 === workInProgressRoot) {
+ warnAboutRenderPhaseUpdatesInDEV(fiber);
+ } else {
+ {
+ if (isDevToolsPresent) {
+ addFiberToLanesMap(root2, fiber, lane);
}
}
- } else {
- if ((executionContext & DiscreteEventContext) !== NoContext && // Only updates at user-blocking priority or greater are considered
- // discrete, even inside a discrete event.
- (priorityLevel === UserBlockingPriority$2 || priorityLevel === ImmediatePriority$1)) {
- if (rootsWithPendingDiscreteUpdates === null) {
- rootsWithPendingDiscreteUpdates = /* @__PURE__ */ new Set([root2]);
- } else {
- rootsWithPendingDiscreteUpdates.add(root2);
+ warnIfUpdatesNotWrappedWithActDEV(fiber);
+ if (root2 === workInProgressRoot) {
+ if ((executionContext & RenderContext) === NoContext) {
+ workInProgressRootInterleavedUpdatedLanes = mergeLanes(workInProgressRootInterleavedUpdatedLanes, lane);
+ }
+ if (workInProgressRootExitStatus === RootSuspendedWithDelay) {
+ markRootSuspended$1(root2, workInProgressRootRenderLanes);
}
}
ensureRootIsScheduled(root2, eventTime);
- schedulePendingInteractions(root2, lane);
- }
- mostRecentlyUpdatedRoot = root2;
- }
- function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
- sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane);
- var alternate = sourceFiber.alternate;
- if (alternate !== null) {
- alternate.lanes = mergeLanes(alternate.lanes, lane);
- }
- {
- if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) {
- warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
- }
- }
- var node = sourceFiber;
- var parent = sourceFiber.return;
- while (parent !== null) {
- parent.childLanes = mergeLanes(parent.childLanes, lane);
- alternate = parent.alternate;
- if (alternate !== null) {
- alternate.childLanes = mergeLanes(alternate.childLanes, lane);
- } else {
- {
- if ((parent.flags & (Placement | Hydrating)) !== NoFlags) {
- warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
- }
- }
+ if (lane === SyncLane && executionContext === NoContext && (fiber.mode & ConcurrentMode) === NoMode && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode.
+ !ReactCurrentActQueue$1.isBatchingLegacy) {
+ resetRenderTimer();
+ flushSyncCallbacksOnlyInLegacyMode();
}
- node = parent;
- parent = parent.return;
- }
- if (node.tag === HostRoot) {
- var root2 = node.stateNode;
- return root2;
- } else {
- return null;
}
}
+ function scheduleInitialHydrationOnRoot(root2, lane, eventTime) {
+ var current2 = root2.current;
+ current2.lanes = lane;
+ markRootUpdated(root2, lane, eventTime);
+ ensureRootIsScheduled(root2, eventTime);
+ }
+ function isUnsafeClassRenderPhaseUpdate(fiber) {
+ return (
+ // TODO: Remove outdated deferRenderPhaseUpdateToNextBatch experiment. We
+ // decided not to enable it.
+ (executionContext & RenderContext) !== NoContext
+ );
+ }
function ensureRootIsScheduled(root2, currentTime) {
var existingCallbackNode = root2.callbackNode;
markStarvedLanesAsExpired(root2, currentTime);
var nextLanes = getNextLanes(root2, root2 === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes);
- var newCallbackPriority = returnNextLanesPriority();
if (nextLanes === NoLanes) {
if (existingCallbackNode !== null) {
- cancelCallback(existingCallbackNode);
- root2.callbackNode = null;
- root2.callbackPriority = NoLanePriority;
+ cancelCallback$1(existingCallbackNode);
}
+ root2.callbackNode = null;
+ root2.callbackPriority = NoLane;
return;
}
- if (existingCallbackNode !== null) {
- var existingCallbackPriority = root2.callbackPriority;
- if (existingCallbackPriority === newCallbackPriority) {
- return;
+ var newCallbackPriority = getHighestPriorityLane(nextLanes);
+ var existingCallbackPriority = root2.callbackPriority;
+ if (existingCallbackPriority === newCallbackPriority && // Special case related to `act`. If the currently scheduled task is a
+ // Scheduler task, rather than an `act` task, cancel it and re-scheduled
+ // on the `act` queue.
+ !(ReactCurrentActQueue$1.current !== null && existingCallbackNode !== fakeActCallbackNode)) {
+ {
+ if (existingCallbackNode == null && existingCallbackPriority !== SyncLane) {
+ error("Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.");
+ }
}
- cancelCallback(existingCallbackNode);
+ return;
+ }
+ if (existingCallbackNode != null) {
+ cancelCallback$1(existingCallbackNode);
}
var newCallbackNode;
- if (newCallbackPriority === SyncLanePriority) {
- newCallbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root2));
- } else if (newCallbackPriority === SyncBatchedLanePriority) {
- newCallbackNode = scheduleCallback(ImmediatePriority$1, performSyncWorkOnRoot.bind(null, root2));
+ if (newCallbackPriority === SyncLane) {
+ if (root2.tag === LegacyRoot) {
+ if (ReactCurrentActQueue$1.isBatchingLegacy !== null) {
+ ReactCurrentActQueue$1.didScheduleLegacyUpdate = true;
+ }
+ scheduleLegacySyncCallback(performSyncWorkOnRoot.bind(null, root2));
+ } else {
+ scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root2));
+ }
+ {
+ if (ReactCurrentActQueue$1.current !== null) {
+ ReactCurrentActQueue$1.current.push(flushSyncCallbacks);
+ } else {
+ scheduleMicrotask(function() {
+ if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
+ flushSyncCallbacks();
+ }
+ });
+ }
+ }
+ newCallbackNode = null;
} else {
- var schedulerPriorityLevel = lanePriorityToSchedulerPriority(newCallbackPriority);
- newCallbackNode = scheduleCallback(schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root2));
+ var schedulerPriorityLevel;
+ switch (lanesToEventPriority(nextLanes)) {
+ case DiscreteEventPriority:
+ schedulerPriorityLevel = ImmediatePriority;
+ break;
+ case ContinuousEventPriority:
+ schedulerPriorityLevel = UserBlockingPriority;
+ break;
+ case DefaultEventPriority:
+ schedulerPriorityLevel = NormalPriority;
+ break;
+ case IdleEventPriority:
+ schedulerPriorityLevel = IdlePriority;
+ break;
+ default:
+ schedulerPriorityLevel = NormalPriority;
+ break;
+ }
+ newCallbackNode = scheduleCallback$1(schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root2));
}
root2.callbackPriority = newCallbackPriority;
root2.callbackNode = newCallbackNode;
}
- function performConcurrentWorkOnRoot(root2) {
+ function performConcurrentWorkOnRoot(root2, didTimeout) {
+ {
+ resetNestedUpdateFlag();
+ }
currentEventTime = NoTimestamp;
- currentEventWipLanes = NoLanes;
- currentEventPendingLanes = NoLanes;
- if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
- {
- throw Error("Should not already be working.");
- }
+ currentEventTransitionLane = NoLanes;
+ if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
+ throw new Error("Should not already be working.");
}
var originalCallbackNode = root2.callbackNode;
var didFlushPassiveEffects = flushPassiveEffects();
@@ -18151,19 +20575,14 @@
if (lanes === NoLanes) {
return null;
}
- var exitStatus = renderRootConcurrent(root2, lanes);
- if (includesSomeLane(workInProgressRootIncludedLanes, workInProgressRootUpdatedLanes)) {
- prepareFreshStack(root2, NoLanes);
- } else if (exitStatus !== RootIncomplete) {
+ var shouldTimeSlice = !includesBlockingLane(root2, lanes) && !includesExpiredLane(root2, lanes) && !didTimeout;
+ var exitStatus = shouldTimeSlice ? renderRootConcurrent(root2, lanes) : renderRootSync(root2, lanes);
+ if (exitStatus !== RootInProgress) {
if (exitStatus === RootErrored) {
- executionContext |= RetryAfterError;
- if (root2.hydrate) {
- root2.hydrate = false;
- clearContainer(root2.containerInfo);
- }
- lanes = getLanesToRetrySynchronouslyOnError(root2);
- if (lanes !== NoLanes) {
- exitStatus = renderRootSync(root2, lanes);
+ var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root2);
+ if (errorRetryLanes !== NoLanes) {
+ lanes = errorRetryLanes;
+ exitStatus = recoverFromConcurrentError(root2, errorRetryLanes);
}
}
if (exitStatus === RootFatalErrored) {
@@ -18173,10 +20592,32 @@
ensureRootIsScheduled(root2, now());
throw fatalError;
}
- var finishedWork = root2.current.alternate;
- root2.finishedWork = finishedWork;
- root2.finishedLanes = lanes;
- finishConcurrentRender(root2, exitStatus, lanes);
+ if (exitStatus === RootDidNotComplete) {
+ markRootSuspended$1(root2, lanes);
+ } else {
+ var renderWasConcurrent = !includesBlockingLane(root2, lanes);
+ var finishedWork = root2.current.alternate;
+ if (renderWasConcurrent && !isRenderConsistentWithExternalStores(finishedWork)) {
+ exitStatus = renderRootSync(root2, lanes);
+ if (exitStatus === RootErrored) {
+ var _errorRetryLanes = getLanesToRetrySynchronouslyOnError(root2);
+ if (_errorRetryLanes !== NoLanes) {
+ lanes = _errorRetryLanes;
+ exitStatus = recoverFromConcurrentError(root2, _errorRetryLanes);
+ }
+ }
+ if (exitStatus === RootFatalErrored) {
+ var _fatalError = workInProgressRootFatalError;
+ prepareFreshStack(root2, NoLanes);
+ markRootSuspended$1(root2, lanes);
+ ensureRootIsScheduled(root2, now());
+ throw _fatalError;
+ }
+ }
+ root2.finishedWork = finishedWork;
+ root2.finishedLanes = lanes;
+ finishConcurrentRender(root2, exitStatus, lanes);
+ }
}
ensureRootIsScheduled(root2, now());
if (root2.callbackNode === originalCallbackNode) {
@@ -18184,18 +20625,40 @@
}
return null;
}
+ function recoverFromConcurrentError(root2, errorRetryLanes) {
+ var errorsFromFirstAttempt = workInProgressRootConcurrentErrors;
+ if (isRootDehydrated(root2)) {
+ var rootWorkInProgress = prepareFreshStack(root2, errorRetryLanes);
+ rootWorkInProgress.flags |= ForceClientRender;
+ {
+ errorHydratingContainer(root2.containerInfo);
+ }
+ }
+ var exitStatus = renderRootSync(root2, errorRetryLanes);
+ if (exitStatus !== RootErrored) {
+ var errorsFromSecondAttempt = workInProgressRootRecoverableErrors;
+ workInProgressRootRecoverableErrors = errorsFromFirstAttempt;
+ if (errorsFromSecondAttempt !== null) {
+ queueRecoverableErrors(errorsFromSecondAttempt);
+ }
+ }
+ return exitStatus;
+ }
+ function queueRecoverableErrors(errors) {
+ if (workInProgressRootRecoverableErrors === null) {
+ workInProgressRootRecoverableErrors = errors;
+ } else {
+ workInProgressRootRecoverableErrors.push.apply(workInProgressRootRecoverableErrors, errors);
+ }
+ }
function finishConcurrentRender(root2, exitStatus, lanes) {
switch (exitStatus) {
- case RootIncomplete:
+ case RootInProgress:
case RootFatalErrored: {
- {
- {
- throw Error("Root did not complete. This is a bug in React.");
- }
- }
+ throw new Error("Root did not complete. This is a bug in React.");
}
case RootErrored: {
- commitRoot(root2);
+ commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
break;
}
case RootSuspended: {
@@ -18214,11 +20677,11 @@
markRootPinged(root2, suspendedLanes);
break;
}
- root2.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root2), msUntilTimeout);
+ root2.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root2, workInProgressRootRecoverableErrors, workInProgressTransitions), msUntilTimeout);
break;
}
}
- commitRoot(root2);
+ commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
break;
}
case RootSuspendedWithDelay: {
@@ -18232,60 +20695,89 @@
var timeElapsedMs = now() - eventTimeMs;
var _msUntilTimeout = jnd(timeElapsedMs) - timeElapsedMs;
if (_msUntilTimeout > 10) {
- root2.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root2), _msUntilTimeout);
+ root2.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root2, workInProgressRootRecoverableErrors, workInProgressTransitions), _msUntilTimeout);
break;
}
}
- commitRoot(root2);
+ commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
break;
}
case RootCompleted: {
- commitRoot(root2);
+ commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
break;
}
default: {
- {
- {
- throw Error("Unknown root exit status.");
+ throw new Error("Unknown root exit status.");
+ }
+ }
+ }
+ function isRenderConsistentWithExternalStores(finishedWork) {
+ var node = finishedWork;
+ while (true) {
+ if (node.flags & StoreConsistency) {
+ var updateQueue = node.updateQueue;
+ if (updateQueue !== null) {
+ var checks = updateQueue.stores;
+ if (checks !== null) {
+ for (var i = 0; i < checks.length; i++) {
+ var check = checks[i];
+ var getSnapshot = check.getSnapshot;
+ var renderedValue = check.value;
+ try {
+ if (!objectIs(getSnapshot(), renderedValue)) {
+ return false;
+ }
+ } catch (error2) {
+ return false;
+ }
+ }
}
}
}
+ var child = node.child;
+ if (node.subtreeFlags & StoreConsistency && child !== null) {
+ child.return = node;
+ node = child;
+ continue;
+ }
+ if (node === finishedWork) {
+ return true;
+ }
+ while (node.sibling === null) {
+ if (node.return === null || node.return === finishedWork) {
+ return true;
+ }
+ node = node.return;
+ }
+ node.sibling.return = node.return;
+ node = node.sibling;
}
+ return true;
}
function markRootSuspended$1(root2, suspendedLanes) {
suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes);
- suspendedLanes = removeLanes(suspendedLanes, workInProgressRootUpdatedLanes);
+ suspendedLanes = removeLanes(suspendedLanes, workInProgressRootInterleavedUpdatedLanes);
markRootSuspended(root2, suspendedLanes);
}
function performSyncWorkOnRoot(root2) {
- if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
- {
- throw Error("Should not already be working.");
- }
+ {
+ syncNestedUpdateFlag();
+ }
+ if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
+ throw new Error("Should not already be working.");
}
flushPassiveEffects();
- var lanes;
- var exitStatus;
- if (root2 === workInProgressRoot && includesSomeLane(root2.expiredLanes, workInProgressRootRenderLanes)) {
- lanes = workInProgressRootRenderLanes;
- exitStatus = renderRootSync(root2, lanes);
- if (includesSomeLane(workInProgressRootIncludedLanes, workInProgressRootUpdatedLanes)) {
- lanes = getNextLanes(root2, lanes);
- exitStatus = renderRootSync(root2, lanes);
- }
- } else {
- lanes = getNextLanes(root2, NoLanes);
- exitStatus = renderRootSync(root2, lanes);
+ var lanes = getNextLanes(root2, NoLanes);
+ if (!includesSomeLane(lanes, SyncLane)) {
+ ensureRootIsScheduled(root2, now());
+ return null;
}
+ var exitStatus = renderRootSync(root2, lanes);
if (root2.tag !== LegacyRoot && exitStatus === RootErrored) {
- executionContext |= RetryAfterError;
- if (root2.hydrate) {
- root2.hydrate = false;
- clearContainer(root2.containerInfo);
- }
- lanes = getLanesToRetrySynchronouslyOnError(root2);
- if (lanes !== NoLanes) {
- exitStatus = renderRootSync(root2, lanes);
+ var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root2);
+ if (errorRetryLanes !== NoLanes) {
+ lanes = errorRetryLanes;
+ exitStatus = recoverFromConcurrentError(root2, errorRetryLanes);
}
}
if (exitStatus === RootFatalErrored) {
@@ -18295,35 +20787,25 @@
ensureRootIsScheduled(root2, now());
throw fatalError;
}
+ if (exitStatus === RootDidNotComplete) {
+ throw new Error("Root did not complete. This is a bug in React.");
+ }
var finishedWork = root2.current.alternate;
root2.finishedWork = finishedWork;
root2.finishedLanes = lanes;
- commitRoot(root2);
+ commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
ensureRootIsScheduled(root2, now());
return null;
}
- function flushDiscreteUpdates() {
- if ((executionContext & (BatchedContext | RenderContext | CommitContext)) !== NoContext) {
- {
- if ((executionContext & RenderContext) !== NoContext) {
- error("unstable_flushDiscreteUpdates: Cannot flush updates when React is already rendering.");
- }
+ function flushRoot(root2, lanes) {
+ if (lanes !== NoLanes) {
+ markRootEntangled(root2, mergeLanes(lanes, SyncLane));
+ ensureRootIsScheduled(root2, now());
+ if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
+ resetRenderTimer();
+ flushSyncCallbacks();
}
- return;
- }
- flushPendingDiscreteUpdates();
- flushPassiveEffects();
- }
- function flushPendingDiscreteUpdates() {
- if (rootsWithPendingDiscreteUpdates !== null) {
- var roots = rootsWithPendingDiscreteUpdates;
- rootsWithPendingDiscreteUpdates = null;
- roots.forEach(function(root2) {
- markDiscreteUpdatesExpired(root2);
- ensureRootIsScheduled(root2, now());
- });
}
- flushSyncCallbackQueue();
}
function batchedUpdates$1(fn, a) {
var prevExecutionContext = executionContext;
@@ -18332,75 +20814,55 @@
return fn(a);
} finally {
executionContext = prevExecutionContext;
- if (executionContext === NoContext) {
+ if (executionContext === NoContext && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode.
+ !ReactCurrentActQueue$1.isBatchingLegacy) {
resetRenderTimer();
- flushSyncCallbackQueue();
+ flushSyncCallbacksOnlyInLegacyMode();
}
}
}
- function batchedEventUpdates$1(fn, a) {
- var prevExecutionContext = executionContext;
- executionContext |= EventContext;
+ function discreteUpdates(fn, a, b, c, d) {
+ var previousPriority = getCurrentUpdatePriority();
+ var prevTransition = ReactCurrentBatchConfig$3.transition;
try {
- return fn(a);
+ ReactCurrentBatchConfig$3.transition = null;
+ setCurrentUpdatePriority(DiscreteEventPriority);
+ return fn(a, b, c, d);
} finally {
- executionContext = prevExecutionContext;
+ setCurrentUpdatePriority(previousPriority);
+ ReactCurrentBatchConfig$3.transition = prevTransition;
if (executionContext === NoContext) {
resetRenderTimer();
- flushSyncCallbackQueue();
}
}
}
- function discreteUpdates$1(fn, a, b, c, d) {
- var prevExecutionContext = executionContext;
- executionContext |= DiscreteEventContext;
- {
- try {
- return runWithPriority$1(UserBlockingPriority$2, fn.bind(null, a, b, c, d));
- } finally {
- executionContext = prevExecutionContext;
- if (executionContext === NoContext) {
- resetRenderTimer();
- flushSyncCallbackQueue();
- }
- }
+ function flushSync(fn) {
+ if (rootWithPendingPassiveEffects !== null && rootWithPendingPassiveEffects.tag === LegacyRoot && (executionContext & (RenderContext | CommitContext)) === NoContext) {
+ flushPassiveEffects();
}
- }
- function unbatchedUpdates(fn, a) {
var prevExecutionContext = executionContext;
- executionContext &= ~BatchedContext;
- executionContext |= LegacyUnbatchedContext;
+ executionContext |= BatchedContext;
+ var prevTransition = ReactCurrentBatchConfig$3.transition;
+ var previousPriority = getCurrentUpdatePriority();
try {
- return fn(a);
+ ReactCurrentBatchConfig$3.transition = null;
+ setCurrentUpdatePriority(DiscreteEventPriority);
+ if (fn) {
+ return fn();
+ } else {
+ return void 0;
+ }
} finally {
+ setCurrentUpdatePriority(previousPriority);
+ ReactCurrentBatchConfig$3.transition = prevTransition;
executionContext = prevExecutionContext;
- if (executionContext === NoContext) {
- resetRenderTimer();
- flushSyncCallbackQueue();
+ if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
+ flushSyncCallbacks();
}
}
}
- function flushSync(fn, a) {
- var prevExecutionContext = executionContext;
- if ((prevExecutionContext & (RenderContext | CommitContext)) !== NoContext) {
- {
- error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.");
- }
- return fn(a);
- }
- executionContext |= BatchedContext;
- {
- try {
- if (fn) {
- return runWithPriority$1(ImmediatePriority$1, fn.bind(null, a));
- } else {
- return void 0;
- }
- } finally {
- executionContext = prevExecutionContext;
- flushSyncCallbackQueue();
- }
- }
+ function isAlreadyRendering() {
+ return (executionContext & (RenderContext | CommitContext)) !== NoContext;
}
function pushRenderLanes(fiber, lanes) {
push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber);
@@ -18422,24 +20884,27 @@
if (workInProgress !== null) {
var interruptedWork = workInProgress.return;
while (interruptedWork !== null) {
- unwindInterruptedWork(interruptedWork);
+ var current2 = interruptedWork.alternate;
+ unwindInterruptedWork(current2, interruptedWork);
interruptedWork = interruptedWork.return;
}
}
workInProgressRoot = root2;
- workInProgress = createWorkInProgress(root2.current, null);
+ var rootWorkInProgress = createWorkInProgress(root2.current, null);
+ workInProgress = rootWorkInProgress;
workInProgressRootRenderLanes = subtreeRenderLanes = workInProgressRootIncludedLanes = lanes;
- workInProgressRootExitStatus = RootIncomplete;
+ workInProgressRootExitStatus = RootInProgress;
workInProgressRootFatalError = null;
workInProgressRootSkippedLanes = NoLanes;
- workInProgressRootUpdatedLanes = NoLanes;
+ workInProgressRootInterleavedUpdatedLanes = NoLanes;
workInProgressRootPingedLanes = NoLanes;
- {
- spawnedWorkDuringRender = null;
- }
+ workInProgressRootConcurrentErrors = null;
+ workInProgressRootRecoverableErrors = null;
+ finishQueueingConcurrentUpdates();
{
ReactStrictModeWarnings.discardPendingWarnings();
}
+ return rootWorkInProgress;
}
function handleError(root2, thrownValue) {
do {
@@ -18458,6 +20923,15 @@
if (enableProfilerTimer && erroredWork.mode & ProfileMode) {
stopProfilerTimerIfRunningAndRecordDelta(erroredWork, true);
}
+ if (enableSchedulingProfiler) {
+ markComponentRenderStopped();
+ if (thrownValue !== null && typeof thrownValue === "object" && typeof thrownValue.then === "function") {
+ var wakeable = thrownValue;
+ markComponentSuspended(erroredWork, wakeable, workInProgressRootRenderLanes);
+ } else {
+ markComponentErrored(erroredWork, thrownValue, workInProgressRootRenderLanes);
+ }
+ }
throwException(root2, erroredWork.return, erroredWork, thrownValue, workInProgressRootRenderLanes);
completeUnitOfWork(erroredWork);
} catch (yetAnotherThrownValue) {
@@ -18485,18 +20959,6 @@
function popDispatcher(prevDispatcher) {
ReactCurrentDispatcher$2.current = prevDispatcher;
}
- function pushInteractions(root2) {
- {
- var prevInteractions = tracing.__interactionsRef.current;
- tracing.__interactionsRef.current = root2.memoizedInteractions;
- return prevInteractions;
- }
- }
- function popInteractions(prevInteractions) {
- {
- tracing.__interactionsRef.current = prevInteractions;
- }
- }
function markCommitTimeOfFallback() {
globalMostRecentFallbackTime = now();
}
@@ -18504,35 +20966,52 @@
workInProgressRootSkippedLanes = mergeLanes(lane, workInProgressRootSkippedLanes);
}
function renderDidSuspend() {
- if (workInProgressRootExitStatus === RootIncomplete) {
+ if (workInProgressRootExitStatus === RootInProgress) {
workInProgressRootExitStatus = RootSuspended;
}
}
function renderDidSuspendDelayIfPossible() {
- if (workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended) {
+ if (workInProgressRootExitStatus === RootInProgress || workInProgressRootExitStatus === RootSuspended || workInProgressRootExitStatus === RootErrored) {
workInProgressRootExitStatus = RootSuspendedWithDelay;
}
- if (workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || includesNonIdleWork(workInProgressRootUpdatedLanes))) {
+ if (workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes))) {
markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes);
}
}
- function renderDidError() {
- if (workInProgressRootExitStatus !== RootCompleted) {
+ function renderDidError(error2) {
+ if (workInProgressRootExitStatus !== RootSuspendedWithDelay) {
workInProgressRootExitStatus = RootErrored;
}
+ if (workInProgressRootConcurrentErrors === null) {
+ workInProgressRootConcurrentErrors = [error2];
+ } else {
+ workInProgressRootConcurrentErrors.push(error2);
+ }
}
function renderHasNotSuspendedYet() {
- return workInProgressRootExitStatus === RootIncomplete;
+ return workInProgressRootExitStatus === RootInProgress;
}
function renderRootSync(root2, lanes) {
var prevExecutionContext = executionContext;
executionContext |= RenderContext;
var prevDispatcher = pushDispatcher();
if (workInProgressRoot !== root2 || workInProgressRootRenderLanes !== lanes) {
+ {
+ if (isDevToolsPresent) {
+ var memoizedUpdaters = root2.memoizedUpdaters;
+ if (memoizedUpdaters.size > 0) {
+ restorePendingUpdaters(root2, workInProgressRootRenderLanes);
+ memoizedUpdaters.clear();
+ }
+ movePendingFibersToMemoized(root2, lanes);
+ }
+ }
+ workInProgressTransitions = getTransitionsForLanes();
prepareFreshStack(root2, lanes);
- startWorkOnPendingInteractions(root2, lanes);
}
- var prevInteractions = pushInteractions(root2);
+ {
+ markRenderStarted(lanes);
+ }
do {
try {
workLoopSync();
@@ -18542,17 +21021,13 @@
}
} while (true);
resetContextDependencies();
- {
- popInteractions(prevInteractions);
- }
executionContext = prevExecutionContext;
popDispatcher(prevDispatcher);
if (workInProgress !== null) {
- {
- {
- throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");
- }
- }
+ throw new Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");
+ }
+ {
+ markRenderStopped();
}
workInProgressRoot = null;
workInProgressRootRenderLanes = NoLanes;
@@ -18568,11 +21043,23 @@
executionContext |= RenderContext;
var prevDispatcher = pushDispatcher();
if (workInProgressRoot !== root2 || workInProgressRootRenderLanes !== lanes) {
+ {
+ if (isDevToolsPresent) {
+ var memoizedUpdaters = root2.memoizedUpdaters;
+ if (memoizedUpdaters.size > 0) {
+ restorePendingUpdaters(root2, workInProgressRootRenderLanes);
+ memoizedUpdaters.clear();
+ }
+ movePendingFibersToMemoized(root2, lanes);
+ }
+ }
+ workInProgressTransitions = getTransitionsForLanes();
resetRenderTimer();
prepareFreshStack(root2, lanes);
- startWorkOnPendingInteractions(root2, lanes);
}
- var prevInteractions = pushInteractions(root2);
+ {
+ markRenderStarted(lanes);
+ }
do {
try {
workLoopConcurrent();
@@ -18582,14 +21069,17 @@
}
} while (true);
resetContextDependencies();
- {
- popInteractions(prevInteractions);
- }
popDispatcher(prevDispatcher);
executionContext = prevExecutionContext;
if (workInProgress !== null) {
- return RootIncomplete;
+ {
+ markRenderYielded();
+ }
+ return RootInProgress;
} else {
+ {
+ markRenderStopped();
+ }
workInProgressRoot = null;
workInProgressRootRenderLanes = NoLanes;
return workInProgressRootExitStatus;
@@ -18640,30 +21130,8 @@
workInProgress = next;
return;
}
- resetChildLanes(completedWork);
- if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete
- (returnFiber.flags & Incomplete) === NoFlags) {
- if (returnFiber.firstEffect === null) {
- returnFiber.firstEffect = completedWork.firstEffect;
- }
- if (completedWork.lastEffect !== null) {
- if (returnFiber.lastEffect !== null) {
- returnFiber.lastEffect.nextEffect = completedWork.firstEffect;
- }
- returnFiber.lastEffect = completedWork.lastEffect;
- }
- var flags = completedWork.flags;
- if (flags > PerformedWork) {
- if (returnFiber.lastEffect !== null) {
- returnFiber.lastEffect.nextEffect = completedWork;
- } else {
- returnFiber.firstEffect = completedWork;
- }
- returnFiber.lastEffect = completedWork;
- }
- }
} else {
- var _next = unwindWork(completedWork);
+ var _next = unwindWork(current2, completedWork);
if (_next !== null) {
_next.flags &= HostEffectMask;
workInProgress = _next;
@@ -18680,8 +21148,13 @@
completedWork.actualDuration = actualDuration;
}
if (returnFiber !== null) {
- returnFiber.firstEffect = returnFiber.lastEffect = null;
returnFiber.flags |= Incomplete;
+ returnFiber.subtreeFlags = NoFlags;
+ returnFiber.deletions = null;
+ } else {
+ workInProgressRootExitStatus = RootDidNotComplete;
+ workInProgress = null;
+ return;
}
}
var siblingFiber = completedWork.sibling;
@@ -18692,168 +21165,100 @@
completedWork = returnFiber;
workInProgress = completedWork;
} while (completedWork !== null);
- if (workInProgressRootExitStatus === RootIncomplete) {
+ if (workInProgressRootExitStatus === RootInProgress) {
workInProgressRootExitStatus = RootCompleted;
}
}
- function resetChildLanes(completedWork) {
- if (
- // TODO: Move this check out of the hot path by moving `resetChildLanes`
- // to switch statement in `completeWork`.
- (completedWork.tag === LegacyHiddenComponent || completedWork.tag === OffscreenComponent) && completedWork.memoizedState !== null && !includesSomeLane(subtreeRenderLanes, OffscreenLane) && (completedWork.mode & ConcurrentMode) !== NoLanes
- ) {
- return;
- }
- var newChildLanes = NoLanes;
- if ((completedWork.mode & ProfileMode) !== NoMode) {
- var actualDuration = completedWork.actualDuration;
- var treeBaseDuration = completedWork.selfBaseDuration;
- var shouldBubbleActualDurations = completedWork.alternate === null || completedWork.child !== completedWork.alternate.child;
- var child = completedWork.child;
- while (child !== null) {
- newChildLanes = mergeLanes(newChildLanes, mergeLanes(child.lanes, child.childLanes));
- if (shouldBubbleActualDurations) {
- actualDuration += child.actualDuration;
- }
- treeBaseDuration += child.treeBaseDuration;
- child = child.sibling;
- }
- var isTimedOutSuspense = completedWork.tag === SuspenseComponent && completedWork.memoizedState !== null;
- if (isTimedOutSuspense) {
- var primaryChildFragment = completedWork.child;
- if (primaryChildFragment !== null) {
- treeBaseDuration -= primaryChildFragment.treeBaseDuration;
- }
- }
- completedWork.actualDuration = actualDuration;
- completedWork.treeBaseDuration = treeBaseDuration;
- } else {
- var _child = completedWork.child;
- while (_child !== null) {
- newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child.lanes, _child.childLanes));
- _child = _child.sibling;
- }
+ function commitRoot(root2, recoverableErrors, transitions) {
+ var previousUpdateLanePriority = getCurrentUpdatePriority();
+ var prevTransition = ReactCurrentBatchConfig$3.transition;
+ try {
+ ReactCurrentBatchConfig$3.transition = null;
+ setCurrentUpdatePriority(DiscreteEventPriority);
+ commitRootImpl(root2, recoverableErrors, transitions, previousUpdateLanePriority);
+ } finally {
+ ReactCurrentBatchConfig$3.transition = prevTransition;
+ setCurrentUpdatePriority(previousUpdateLanePriority);
}
- completedWork.childLanes = newChildLanes;
- }
- function commitRoot(root2) {
- var renderPriorityLevel = getCurrentPriorityLevel();
- runWithPriority$1(ImmediatePriority$1, commitRootImpl.bind(null, root2, renderPriorityLevel));
return null;
}
- function commitRootImpl(root2, renderPriorityLevel) {
+ function commitRootImpl(root2, recoverableErrors, transitions, renderPriorityLevel) {
do {
flushPassiveEffects();
} while (rootWithPendingPassiveEffects !== null);
flushRenderPhaseStrictModeWarningsInDEV();
- if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
- {
- throw Error("Should not already be working.");
- }
+ if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
+ throw new Error("Should not already be working.");
}
var finishedWork = root2.finishedWork;
var lanes = root2.finishedLanes;
+ {
+ markCommitStarted(lanes);
+ }
if (finishedWork === null) {
+ {
+ markCommitStopped();
+ }
return null;
+ } else {
+ {
+ if (lanes === NoLanes) {
+ error("root.finishedLanes should not be empty during a commit. This is a bug in React.");
+ }
+ }
}
root2.finishedWork = null;
root2.finishedLanes = NoLanes;
- if (!(finishedWork !== root2.current)) {
- {
- throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");
- }
+ if (finishedWork === root2.current) {
+ throw new Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");
}
root2.callbackNode = null;
+ root2.callbackPriority = NoLane;
var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes);
markRootFinished(root2, remainingLanes);
- if (rootsWithPendingDiscreteUpdates !== null) {
- if (!hasDiscreteLanes(remainingLanes) && rootsWithPendingDiscreteUpdates.has(root2)) {
- rootsWithPendingDiscreteUpdates.delete(root2);
- }
- }
if (root2 === workInProgressRoot) {
workInProgressRoot = null;
workInProgress = null;
workInProgressRootRenderLanes = NoLanes;
}
- var firstEffect;
- if (finishedWork.flags > PerformedWork) {
- if (finishedWork.lastEffect !== null) {
- finishedWork.lastEffect.nextEffect = finishedWork;
- firstEffect = finishedWork.firstEffect;
- } else {
- firstEffect = finishedWork;
+ if ((finishedWork.subtreeFlags & PassiveMask) !== NoFlags || (finishedWork.flags & PassiveMask) !== NoFlags) {
+ if (!rootDoesHavePassiveEffects) {
+ rootDoesHavePassiveEffects = true;
+ pendingPassiveTransitions = transitions;
+ scheduleCallback$1(NormalPriority, function() {
+ flushPassiveEffects();
+ return null;
+ });
}
- } else {
- firstEffect = finishedWork.firstEffect;
}
- if (firstEffect !== null) {
+ var subtreeHasEffects = (finishedWork.subtreeFlags & (BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !== NoFlags;
+ var rootHasEffect = (finishedWork.flags & (BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !== NoFlags;
+ if (subtreeHasEffects || rootHasEffect) {
+ var prevTransition = ReactCurrentBatchConfig$3.transition;
+ ReactCurrentBatchConfig$3.transition = null;
+ var previousPriority = getCurrentUpdatePriority();
+ setCurrentUpdatePriority(DiscreteEventPriority);
var prevExecutionContext = executionContext;
executionContext |= CommitContext;
- var prevInteractions = pushInteractions(root2);
ReactCurrentOwner$2.current = null;
- focusedInstanceHandle = prepareForCommit(root2.containerInfo);
- shouldFireAfterActiveInstanceBlur = false;
- nextEffect = firstEffect;
- do {
- {
- invokeGuardedCallback(null, commitBeforeMutationEffects, null);
- if (hasCaughtError()) {
- if (!(nextEffect !== null)) {
- {
- throw Error("Should be working on an effect.");
- }
- }
- var error2 = clearCaughtError();
- captureCommitPhaseError(nextEffect, error2);
- nextEffect = nextEffect.nextEffect;
- }
- }
- } while (nextEffect !== null);
- focusedInstanceHandle = null;
+ var shouldFireAfterActiveInstanceBlur2 = commitBeforeMutationEffects(root2, finishedWork);
{
recordCommitTime();
}
- nextEffect = firstEffect;
- do {
- {
- invokeGuardedCallback(null, commitMutationEffects, null, root2, renderPriorityLevel);
- if (hasCaughtError()) {
- if (!(nextEffect !== null)) {
- {
- throw Error("Should be working on an effect.");
- }
- }
- var _error = clearCaughtError();
- captureCommitPhaseError(nextEffect, _error);
- nextEffect = nextEffect.nextEffect;
- }
- }
- } while (nextEffect !== null);
+ commitMutationEffects(root2, finishedWork, lanes);
resetAfterCommit(root2.containerInfo);
root2.current = finishedWork;
- nextEffect = firstEffect;
- do {
- {
- invokeGuardedCallback(null, commitLayoutEffects, null, root2, lanes);
- if (hasCaughtError()) {
- if (!(nextEffect !== null)) {
- {
- throw Error("Should be working on an effect.");
- }
- }
- var _error2 = clearCaughtError();
- captureCommitPhaseError(nextEffect, _error2);
- nextEffect = nextEffect.nextEffect;
- }
- }
- } while (nextEffect !== null);
- nextEffect = null;
- requestPaint();
{
- popInteractions(prevInteractions);
+ markLayoutEffectsStarted(lanes);
+ }
+ commitLayoutEffects(finishedWork, root2, lanes);
+ {
+ markLayoutEffectsStopped();
}
+ requestPaint();
executionContext = prevExecutionContext;
+ setCurrentUpdatePriority(previousPriority);
+ ReactCurrentBatchConfig$3.transition = prevTransition;
} else {
root2.current = finishedWork;
{
@@ -18865,299 +21270,161 @@
rootDoesHavePassiveEffects = false;
rootWithPendingPassiveEffects = root2;
pendingPassiveEffectsLanes = lanes;
- pendingPassiveEffectsRenderPriority = renderPriorityLevel;
} else {
- nextEffect = firstEffect;
- while (nextEffect !== null) {
- var nextNextEffect = nextEffect.nextEffect;
- nextEffect.nextEffect = null;
- if (nextEffect.flags & Deletion) {
- detachFiberAfterEffects(nextEffect);
- }
- nextEffect = nextNextEffect;
+ {
+ nestedPassiveUpdateCount = 0;
+ rootWithPassiveNestedUpdates = null;
}
}
remainingLanes = root2.pendingLanes;
- if (remainingLanes !== NoLanes) {
- {
- if (spawnedWorkDuringRender !== null) {
- var expirationTimes = spawnedWorkDuringRender;
- spawnedWorkDuringRender = null;
- for (var i = 0; i < expirationTimes.length; i++) {
- scheduleInteractions(root2, expirationTimes[i], root2.memoizedInteractions);
- }
- }
- schedulePendingInteractions(root2, remainingLanes);
- }
- } else {
+ if (remainingLanes === NoLanes) {
legacyErrorBoundariesThatAlreadyFailed = null;
}
{
if (!rootDidHavePassiveEffects) {
- finishPendingInteractions(root2, lanes);
+ commitDoubleInvokeEffectsInDEV(root2.current, false);
}
}
- if (remainingLanes === SyncLane) {
- if (root2 === rootWithNestedUpdates) {
- nestedUpdateCount++;
- } else {
- nestedUpdateCount = 0;
- rootWithNestedUpdates = root2;
+ onCommitRoot(finishedWork.stateNode, renderPriorityLevel);
+ {
+ if (isDevToolsPresent) {
+ root2.memoizedUpdaters.clear();
}
- } else {
- nestedUpdateCount = 0;
}
- onCommitRoot(finishedWork.stateNode, renderPriorityLevel);
{
onCommitRoot$1();
}
ensureRootIsScheduled(root2, now());
+ if (recoverableErrors !== null) {
+ var onRecoverableError = root2.onRecoverableError;
+ for (var i = 0; i < recoverableErrors.length; i++) {
+ var recoverableError = recoverableErrors[i];
+ var componentStack = recoverableError.stack;
+ var digest = recoverableError.digest;
+ onRecoverableError(recoverableError.value, {
+ componentStack,
+ digest
+ });
+ }
+ }
if (hasUncaughtError) {
hasUncaughtError = false;
- var _error3 = firstUncaughtError;
+ var error$1 = firstUncaughtError;
firstUncaughtError = null;
- throw _error3;
+ throw error$1;
}
- if ((executionContext & LegacyUnbatchedContext) !== NoContext) {
- return null;
- }
- flushSyncCallbackQueue();
- return null;
- }
- function commitBeforeMutationEffects() {
- while (nextEffect !== null) {
- var current2 = nextEffect.alternate;
- if (!shouldFireAfterActiveInstanceBlur && focusedInstanceHandle !== null) {
- if ((nextEffect.flags & Deletion) !== NoFlags) {
- if (doesFiberContain(nextEffect, focusedInstanceHandle)) {
- shouldFireAfterActiveInstanceBlur = true;
- }
- } else {
- if (nextEffect.tag === SuspenseComponent && isSuspenseBoundaryBeingHidden(current2, nextEffect) && doesFiberContain(nextEffect, focusedInstanceHandle)) {
- shouldFireAfterActiveInstanceBlur = true;
- }
- }
- }
- var flags = nextEffect.flags;
- if ((flags & Snapshot) !== NoFlags) {
- setCurrentFiber(nextEffect);
- commitBeforeMutationLifeCycles(current2, nextEffect);
- resetCurrentFiber();
- }
- if ((flags & Passive) !== NoFlags) {
- if (!rootDoesHavePassiveEffects) {
- rootDoesHavePassiveEffects = true;
- scheduleCallback(NormalPriority$1, function() {
- flushPassiveEffects();
- return null;
- });
- }
- }
- nextEffect = nextEffect.nextEffect;
+ if (includesSomeLane(pendingPassiveEffectsLanes, SyncLane) && root2.tag !== LegacyRoot) {
+ flushPassiveEffects();
}
- }
- function commitMutationEffects(root2, renderPriorityLevel) {
- while (nextEffect !== null) {
- setCurrentFiber(nextEffect);
- var flags = nextEffect.flags;
- if (flags & ContentReset) {
- commitResetTextContent(nextEffect);
- }
- if (flags & Ref) {
- var current2 = nextEffect.alternate;
- if (current2 !== null) {
- commitDetachRef(current2);
- }
+ remainingLanes = root2.pendingLanes;
+ if (includesSomeLane(remainingLanes, SyncLane)) {
+ {
+ markNestedUpdateScheduled();
}
- var primaryFlags = flags & (Placement | Update | Deletion | Hydrating);
- switch (primaryFlags) {
- case Placement: {
- commitPlacement(nextEffect);
- nextEffect.flags &= ~Placement;
- break;
- }
- case PlacementAndUpdate: {
- commitPlacement(nextEffect);
- nextEffect.flags &= ~Placement;
- var _current = nextEffect.alternate;
- commitWork(_current, nextEffect);
- break;
- }
- case Hydrating: {
- nextEffect.flags &= ~Hydrating;
- break;
- }
- case HydratingAndUpdate: {
- nextEffect.flags &= ~Hydrating;
- var _current2 = nextEffect.alternate;
- commitWork(_current2, nextEffect);
- break;
- }
- case Update: {
- var _current3 = nextEffect.alternate;
- commitWork(_current3, nextEffect);
- break;
- }
- case Deletion: {
- commitDeletion(root2, nextEffect);
- break;
- }
+ if (root2 === rootWithNestedUpdates) {
+ nestedUpdateCount++;
+ } else {
+ nestedUpdateCount = 0;
+ rootWithNestedUpdates = root2;
}
- resetCurrentFiber();
- nextEffect = nextEffect.nextEffect;
+ } else {
+ nestedUpdateCount = 0;
}
- }
- function commitLayoutEffects(root2, committedLanes) {
- while (nextEffect !== null) {
- setCurrentFiber(nextEffect);
- var flags = nextEffect.flags;
- if (flags & (Update | Callback)) {
- var current2 = nextEffect.alternate;
- commitLifeCycles(root2, current2, nextEffect);
- }
- {
- if (flags & Ref) {
- commitAttachRef(nextEffect);
- }
- }
- resetCurrentFiber();
- nextEffect = nextEffect.nextEffect;
+ flushSyncCallbacks();
+ {
+ markCommitStopped();
}
+ return null;
}
function flushPassiveEffects() {
- if (pendingPassiveEffectsRenderPriority !== NoPriority$1) {
- var priorityLevel = pendingPassiveEffectsRenderPriority > NormalPriority$1 ? NormalPriority$1 : pendingPassiveEffectsRenderPriority;
- pendingPassiveEffectsRenderPriority = NoPriority$1;
- {
- return runWithPriority$1(priorityLevel, flushPassiveEffectsImpl);
+ if (rootWithPendingPassiveEffects !== null) {
+ var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes);
+ var priority = lowerEventPriority(DefaultEventPriority, renderPriority);
+ var prevTransition = ReactCurrentBatchConfig$3.transition;
+ var previousPriority = getCurrentUpdatePriority();
+ try {
+ ReactCurrentBatchConfig$3.transition = null;
+ setCurrentUpdatePriority(priority);
+ return flushPassiveEffectsImpl();
+ } finally {
+ setCurrentUpdatePriority(previousPriority);
+ ReactCurrentBatchConfig$3.transition = prevTransition;
}
}
return false;
}
- function enqueuePendingPassiveHookEffectMount(fiber, effect4) {
- pendingPassiveHookEffectsMount.push(effect4, fiber);
- if (!rootDoesHavePassiveEffects) {
- rootDoesHavePassiveEffects = true;
- scheduleCallback(NormalPriority$1, function() {
- flushPassiveEffects();
- return null;
- });
- }
- }
- function enqueuePendingPassiveHookEffectUnmount(fiber, effect4) {
- pendingPassiveHookEffectsUnmount.push(effect4, fiber);
+ function enqueuePendingPassiveProfilerEffect(fiber) {
{
- fiber.flags |= PassiveUnmountPendingDev;
- var alternate = fiber.alternate;
- if (alternate !== null) {
- alternate.flags |= PassiveUnmountPendingDev;
+ pendingPassiveProfilerEffects.push(fiber);
+ if (!rootDoesHavePassiveEffects) {
+ rootDoesHavePassiveEffects = true;
+ scheduleCallback$1(NormalPriority, function() {
+ flushPassiveEffects();
+ return null;
+ });
}
}
- if (!rootDoesHavePassiveEffects) {
- rootDoesHavePassiveEffects = true;
- scheduleCallback(NormalPriority$1, function() {
- flushPassiveEffects();
- return null;
- });
- }
- }
- function invokePassiveEffectCreate(effect4) {
- var create = effect4.create;
- effect4.destroy = create();
}
function flushPassiveEffectsImpl() {
if (rootWithPendingPassiveEffects === null) {
return false;
}
+ var transitions = pendingPassiveTransitions;
+ pendingPassiveTransitions = null;
var root2 = rootWithPendingPassiveEffects;
var lanes = pendingPassiveEffectsLanes;
rootWithPendingPassiveEffects = null;
pendingPassiveEffectsLanes = NoLanes;
- if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
- {
- throw Error("Cannot flush passive effects while already rendering.");
- }
+ if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
+ throw new Error("Cannot flush passive effects while already rendering.");
}
{
isFlushingPassiveEffects = true;
+ didScheduleUpdateDuringPassiveEffects = false;
+ }
+ {
+ markPassiveEffectsStarted(lanes);
}
var prevExecutionContext = executionContext;
executionContext |= CommitContext;
- var prevInteractions = pushInteractions(root2);
- var unmountEffects = pendingPassiveHookEffectsUnmount;
- pendingPassiveHookEffectsUnmount = [];
- for (var i = 0; i < unmountEffects.length; i += 2) {
- var _effect = unmountEffects[i];
- var fiber = unmountEffects[i + 1];
- var destroy = _effect.destroy;
- _effect.destroy = void 0;
- {
- fiber.flags &= ~PassiveUnmountPendingDev;
- var alternate = fiber.alternate;
- if (alternate !== null) {
- alternate.flags &= ~PassiveUnmountPendingDev;
- }
- }
- if (typeof destroy === "function") {
- {
- setCurrentFiber(fiber);
- {
- invokeGuardedCallback(null, destroy, null);
- }
- if (hasCaughtError()) {
- if (!(fiber !== null)) {
- {
- throw Error("Should be working on an effect.");
- }
- }
- var error2 = clearCaughtError();
- captureCommitPhaseError(fiber, error2);
- }
- resetCurrentFiber();
- }
- }
- }
- var mountEffects = pendingPassiveHookEffectsMount;
- pendingPassiveHookEffectsMount = [];
- for (var _i = 0; _i < mountEffects.length; _i += 2) {
- var _effect2 = mountEffects[_i];
- var _fiber = mountEffects[_i + 1];
- {
- setCurrentFiber(_fiber);
- {
- invokeGuardedCallback(null, invokePassiveEffectCreate, null, _effect2);
- }
- if (hasCaughtError()) {
- if (!(_fiber !== null)) {
- {
- throw Error("Should be working on an effect.");
- }
- }
- var _error4 = clearCaughtError();
- captureCommitPhaseError(_fiber, _error4);
- }
- resetCurrentFiber();
+ commitPassiveUnmountEffects(root2.current);
+ commitPassiveMountEffects(root2, root2.current, lanes, transitions);
+ {
+ var profilerEffects = pendingPassiveProfilerEffects;
+ pendingPassiveProfilerEffects = [];
+ for (var i = 0; i < profilerEffects.length; i++) {
+ var _fiber = profilerEffects[i];
+ commitPassiveEffectDurations(root2, _fiber);
}
}
- var effect4 = root2.current.firstEffect;
- while (effect4 !== null) {
- var nextNextEffect = effect4.nextEffect;
- effect4.nextEffect = null;
- if (effect4.flags & Deletion) {
- detachFiberAfterEffects(effect4);
- }
- effect4 = nextNextEffect;
+ {
+ markPassiveEffectsStopped();
}
{
- popInteractions(prevInteractions);
- finishPendingInteractions(root2, lanes);
+ commitDoubleInvokeEffectsInDEV(root2.current, true);
}
+ executionContext = prevExecutionContext;
+ flushSyncCallbacks();
{
+ if (didScheduleUpdateDuringPassiveEffects) {
+ if (root2 === rootWithPassiveNestedUpdates) {
+ nestedPassiveUpdateCount++;
+ } else {
+ nestedPassiveUpdateCount = 0;
+ rootWithPassiveNestedUpdates = root2;
+ }
+ } else {
+ nestedPassiveUpdateCount = 0;
+ }
isFlushingPassiveEffects = false;
+ didScheduleUpdateDuringPassiveEffects = false;
+ }
+ onPostCommitRoot(root2);
+ {
+ var stateNode = root2.current.stateNode;
+ stateNode.effectDuration = 0;
+ stateNode.passiveEffectDuration = 0;
}
- executionContext = prevExecutionContext;
- flushSyncCallbackQueue();
- nestedPassiveUpdateCount = rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1;
return true;
}
function isAlreadyFailedLegacyErrorBoundary(instance) {
@@ -19178,53 +21445,52 @@
}
var onUncaughtError = prepareToThrowUncaughtError;
function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error2) {
- var errorInfo = createCapturedValue(error2, sourceFiber);
+ var errorInfo = createCapturedValueAtFiber(error2, sourceFiber);
var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane);
- enqueueUpdate(rootFiber, update);
+ var root2 = enqueueUpdate(rootFiber, update, SyncLane);
var eventTime = requestEventTime();
- var root2 = markUpdateLaneFromFiberToRoot(rootFiber, SyncLane);
if (root2 !== null) {
markRootUpdated(root2, SyncLane, eventTime);
ensureRootIsScheduled(root2, eventTime);
- schedulePendingInteractions(root2, SyncLane);
}
}
- function captureCommitPhaseError(sourceFiber, error2) {
+ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error$1) {
+ {
+ reportUncaughtErrorInDEV(error$1);
+ setIsRunningInsertionEffect(false);
+ }
if (sourceFiber.tag === HostRoot) {
- captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error2);
+ captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error$1);
return;
}
- var fiber = sourceFiber.return;
+ var fiber = null;
+ {
+ fiber = nearestMountedAncestor;
+ }
while (fiber !== null) {
if (fiber.tag === HostRoot) {
- captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error2);
+ captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error$1);
return;
} else if (fiber.tag === ClassComponent) {
var ctor = fiber.type;
var instance = fiber.stateNode;
if (typeof ctor.getDerivedStateFromError === "function" || typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance)) {
- var errorInfo = createCapturedValue(error2, sourceFiber);
+ var errorInfo = createCapturedValueAtFiber(error$1, sourceFiber);
var update = createClassErrorUpdate(fiber, errorInfo, SyncLane);
- enqueueUpdate(fiber, update);
+ var root2 = enqueueUpdate(fiber, update, SyncLane);
var eventTime = requestEventTime();
- var root2 = markUpdateLaneFromFiberToRoot(fiber, SyncLane);
if (root2 !== null) {
markRootUpdated(root2, SyncLane, eventTime);
ensureRootIsScheduled(root2, eventTime);
- schedulePendingInteractions(root2, SyncLane);
- } else {
- if (typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance)) {
- try {
- instance.componentDidCatch(error2, errorInfo);
- } catch (errorToIgnore) {
- }
- }
}
return;
}
}
fiber = fiber.return;
}
+ {
+ error("Internal React error: Attempted to capture a commit phase error inside a detached tree. This indicates a bug in React. Likely causes include deleting the same fiber more than once, committing an already-finished tree, or an inconsistent return pointer.\n\nError message:\n\n%s", error$1);
+ }
}
function pingSuspendedRoot(root2, wakeable, pingedLanes) {
var pingCache = root2.pingCache;
@@ -19233,6 +21499,7 @@
}
var eventTime = requestEventTime();
markRootPinged(root2, pingedLanes);
+ warnIfSuspenseResolutionNotWrappedWithActDEV(root2);
if (workInProgressRoot === root2 && isSubsetOfLanes(workInProgressRootRenderLanes, pingedLanes)) {
if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) {
prepareFreshStack(root2, NoLanes);
@@ -19241,25 +21508,42 @@
}
}
ensureRootIsScheduled(root2, eventTime);
- schedulePendingInteractions(root2, pingedLanes);
}
function retryTimedOutBoundary(boundaryFiber, retryLane) {
if (retryLane === NoLane) {
retryLane = requestRetryLane(boundaryFiber);
}
var eventTime = requestEventTime();
- var root2 = markUpdateLaneFromFiberToRoot(boundaryFiber, retryLane);
+ var root2 = enqueueConcurrentRenderForLane(boundaryFiber, retryLane);
if (root2 !== null) {
markRootUpdated(root2, retryLane, eventTime);
ensureRootIsScheduled(root2, eventTime);
- schedulePendingInteractions(root2, retryLane);
}
}
+ function retryDehydratedSuspenseBoundary(boundaryFiber) {
+ var suspenseState = boundaryFiber.memoizedState;
+ var retryLane = NoLane;
+ if (suspenseState !== null) {
+ retryLane = suspenseState.retryLane;
+ }
+ retryTimedOutBoundary(boundaryFiber, retryLane);
+ }
function resolveRetryWakeable(boundaryFiber, wakeable) {
var retryLane = NoLane;
var retryCache;
- {
- retryCache = boundaryFiber.stateNode;
+ switch (boundaryFiber.tag) {
+ case SuspenseComponent:
+ retryCache = boundaryFiber.stateNode;
+ var suspenseState = boundaryFiber.memoizedState;
+ if (suspenseState !== null) {
+ retryLane = suspenseState.retryLane;
+ }
+ break;
+ case SuspenseListComponent:
+ retryCache = boundaryFiber.stateNode;
+ break;
+ default:
+ throw new Error("Pinged unknown suspense boundary type. This is probably a bug in React.");
}
if (retryCache !== null) {
retryCache.delete(wakeable);
@@ -19273,15 +21557,12 @@
if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
nestedUpdateCount = 0;
rootWithNestedUpdates = null;
- {
- {
- throw Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.");
- }
- }
+ throw new Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.");
}
{
if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) {
nestedPassiveUpdateCount = 0;
+ rootWithPassiveNestedUpdates = null;
error("Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.");
}
}
@@ -19294,20 +21575,55 @@
}
}
}
+ function commitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) {
+ {
+ setCurrentFiber(fiber);
+ invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV);
+ if (hasPassiveEffects) {
+ invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectUnmountInDEV);
+ }
+ invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectMountInDEV);
+ if (hasPassiveEffects) {
+ invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV);
+ }
+ resetCurrentFiber();
+ }
+ }
+ function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) {
+ {
+ var current2 = firstChild;
+ var subtreeRoot = null;
+ while (current2 !== null) {
+ var primarySubtreeFlag = current2.subtreeFlags & fiberFlags;
+ if (current2 !== subtreeRoot && current2.child !== null && primarySubtreeFlag !== NoFlags) {
+ current2 = current2.child;
+ } else {
+ if ((current2.flags & fiberFlags) !== NoFlags) {
+ invokeEffectFn(current2);
+ }
+ if (current2.sibling !== null) {
+ current2 = current2.sibling;
+ } else {
+ current2 = subtreeRoot = current2.return;
+ }
+ }
+ }
+ }
+ }
var didWarnStateUpdateForNotYetMountedComponent = null;
function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) {
{
if ((executionContext & RenderContext) !== NoContext) {
return;
}
- if (!(fiber.mode & (BlockingMode | ConcurrentMode))) {
+ if (!(fiber.mode & ConcurrentMode)) {
return;
}
var tag = fiber.tag;
- if (tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent && tag !== Block) {
+ if (tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent) {
return;
}
- var componentName = getComponentName(fiber.type) || "ReactComponent";
+ var componentName = getComponentNameFromFiber(fiber) || "ReactComponent";
if (didWarnStateUpdateForNotYetMountedComponent !== null) {
if (didWarnStateUpdateForNotYetMountedComponent.has(componentName)) {
return;
@@ -19329,42 +21645,6 @@
}
}
}
- var didWarnStateUpdateForUnmountedComponent = null;
- function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
- {
- var tag = fiber.tag;
- if (tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent && tag !== Block) {
- return;
- }
- if ((fiber.flags & PassiveUnmountPendingDev) !== NoFlags) {
- return;
- }
- var componentName = getComponentName(fiber.type) || "ReactComponent";
- if (didWarnStateUpdateForUnmountedComponent !== null) {
- if (didWarnStateUpdateForUnmountedComponent.has(componentName)) {
- return;
- }
- didWarnStateUpdateForUnmountedComponent.add(componentName);
- } else {
- didWarnStateUpdateForUnmountedComponent = /* @__PURE__ */ new Set([componentName]);
- }
- if (isFlushingPassiveEffects)
- ;
- else {
- var previousFiber = current;
- try {
- setCurrentFiber(fiber);
- error("Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in %s.", tag === ClassComponent ? "the componentWillUnmount method" : "a useEffect cleanup function");
- } finally {
- if (previousFiber) {
- setCurrentFiber(fiber);
- } else {
- resetCurrentFiber();
- }
- }
- }
- }
- }
var beginWork$1;
{
var dummyFiber = null;
@@ -19373,12 +21653,12 @@
try {
return beginWork(current2, unitOfWork, lanes);
} catch (originalError) {
- if (originalError !== null && typeof originalError === "object" && typeof originalError.then === "function") {
+ if (didSuspendOrErrorWhileHydratingDEV() || originalError !== null && typeof originalError === "object" && typeof originalError.then === "function") {
throw originalError;
}
resetContextDependencies();
resetHooksAfterThrow();
- unwindInterruptedWork(unitOfWork);
+ unwindInterruptedWork(current2, unitOfWork);
assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy);
if (unitOfWork.mode & ProfileMode) {
startProfilerTimer(unitOfWork);
@@ -19386,10 +21666,11 @@
invokeGuardedCallback(null, beginWork, null, current2, unitOfWork, lanes);
if (hasCaughtError()) {
var replayError = clearCaughtError();
- throw replayError;
- } else {
- throw originalError;
+ if (typeof replayError === "object" && replayError !== null && replayError._suppressLogging && typeof originalError === "object" && originalError !== null && !originalError._suppressLogging) {
+ originalError._suppressLogging = true;
+ }
}
+ throw originalError;
}
};
}
@@ -19400,16 +21681,16 @@
}
function warnAboutRenderPhaseUpdatesInDEV(fiber) {
{
- if (isRendering && (executionContext & RenderContext) !== NoContext && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) {
+ if (isRendering && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) {
switch (fiber.tag) {
case FunctionComponent:
case ForwardRef:
case SimpleMemoComponent: {
- var renderingComponentName = workInProgress && getComponentName(workInProgress.type) || "Unknown";
+ var renderingComponentName = workInProgress && getComponentNameFromFiber(workInProgress) || "Unknown";
var dedupeKey = renderingComponentName;
if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) {
didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey);
- var setStateComponentName = getComponentName(fiber.type) || "Unknown";
+ var setStateComponentName = getComponentNameFromFiber(fiber) || "Unknown";
error("Cannot update a component (`%s`) while rendering a different component (`%s`). To locate the bad setState() call inside `%s`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render", setStateComponentName, renderingComponentName, renderingComponentName);
}
break;
@@ -19425,40 +21706,59 @@
}
}
}
- var IsThisRendererActing = {
- current: false
- };
- function warnIfNotScopedWithMatchingAct(fiber) {
+ function restorePendingUpdaters(root2, lanes) {
{
- if (IsSomeRendererActing.current === true && IsThisRendererActing.current !== true) {
- var previousFiber = current;
- try {
- setCurrentFiber(fiber);
- error("It looks like you're using the wrong act() around your test interactions.\nBe sure to use the matching version of act() corresponding to your renderer:\n\n// for react-dom:\nimport {act} from 'react-dom/test-utils';\n// ...\nact(() => ...);\n\n// for react-test-renderer:\nimport TestRenderer from react-test-renderer';\nconst {act} = TestRenderer;\n// ...\nact(() => ...);");
- } finally {
- if (previousFiber) {
- setCurrentFiber(fiber);
- } else {
- resetCurrentFiber();
- }
- }
+ if (isDevToolsPresent) {
+ var memoizedUpdaters = root2.memoizedUpdaters;
+ memoizedUpdaters.forEach(function(schedulingFiber) {
+ addFiberToLanesMap(root2, schedulingFiber, lanes);
+ });
}
}
}
- function warnIfNotCurrentlyActingEffectsInDEV(fiber) {
+ var fakeActCallbackNode = {};
+ function scheduleCallback$1(priorityLevel, callback) {
{
- if ((fiber.mode & StrictMode) !== NoMode && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
- error("An update to %s ran an effect, but was not wrapped in act(...).\n\nWhen testing, code that causes React state updates should be wrapped into act(...):\n\nact(() => {\n /* fire events that update state */\n});\n/* assert on the output */\n\nThis ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act", getComponentName(fiber.type));
+ var actQueue = ReactCurrentActQueue$1.current;
+ if (actQueue !== null) {
+ actQueue.push(callback);
+ return fakeActCallbackNode;
+ } else {
+ return scheduleCallback(priorityLevel, callback);
}
}
}
- function warnIfNotCurrentlyActingUpdatesInDEV(fiber) {
+ function cancelCallback$1(callbackNode) {
+ if (callbackNode === fakeActCallbackNode) {
+ return;
+ }
+ return cancelCallback(callbackNode);
+ }
+ function shouldForceFlushFallbacksInDEV() {
+ return ReactCurrentActQueue$1.current !== null;
+ }
+ function warnIfUpdatesNotWrappedWithActDEV(fiber) {
{
- if (executionContext === NoContext && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
+ if (fiber.mode & ConcurrentMode) {
+ if (!isConcurrentActEnvironment()) {
+ return;
+ }
+ } else {
+ if (!isLegacyActEnvironment()) {
+ return;
+ }
+ if (executionContext !== NoContext) {
+ return;
+ }
+ if (fiber.tag !== FunctionComponent && fiber.tag !== ForwardRef && fiber.tag !== SimpleMemoComponent) {
+ return;
+ }
+ }
+ if (ReactCurrentActQueue$1.current === null) {
var previousFiber = current;
try {
setCurrentFiber(fiber);
- error("An update to %s inside a test was not wrapped in act(...).\n\nWhen testing, code that causes React state updates should be wrapped into act(...):\n\nact(() => {\n /* fire events that update state */\n});\n/* assert on the output */\n\nThis ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act", getComponentName(fiber.type));
+ error("An update to %s inside a test was not wrapped in act(...).\n\nWhen testing, code that causes React state updates should be wrapped into act(...):\n\nact(() => {\n /* fire events that update state */\n});\n/* assert on the output */\n\nThis ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act", getComponentNameFromFiber(fiber));
} finally {
if (previousFiber) {
setCurrentFiber(fiber);
@@ -19469,124 +21769,18 @@
}
}
}
- var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV;
- var didWarnAboutUnmockedScheduler = false;
- function warnIfUnmockedScheduler(fiber) {
+ function warnIfSuspenseResolutionNotWrappedWithActDEV(root2) {
{
- if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === void 0) {
- if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {
- didWarnAboutUnmockedScheduler = true;
- error(`In Concurrent or Sync modes, the "scheduler" module needs to be mocked to guarantee consistent behaviour across tests and browsers. For example, with jest:
-jest.mock('scheduler', () => require('scheduler/unstable_mock'));
-
-For more info, visit https://reactjs.org/link/mock-scheduler`);
- }
- }
- }
- }
- function computeThreadID(root2, lane) {
- return lane * 1e3 + root2.interactionThreadID;
- }
- function markSpawnedWork(lane) {
- if (spawnedWorkDuringRender === null) {
- spawnedWorkDuringRender = [lane];
- } else {
- spawnedWorkDuringRender.push(lane);
- }
- }
- function scheduleInteractions(root2, lane, interactions) {
- if (interactions.size > 0) {
- var pendingInteractionMap = root2.pendingInteractionMap;
- var pendingInteractions = pendingInteractionMap.get(lane);
- if (pendingInteractions != null) {
- interactions.forEach(function(interaction) {
- if (!pendingInteractions.has(interaction)) {
- interaction.__count++;
- }
- pendingInteractions.add(interaction);
- });
- } else {
- pendingInteractionMap.set(lane, new Set(interactions));
- interactions.forEach(function(interaction) {
- interaction.__count++;
- });
- }
- var subscriber = tracing.__subscriberRef.current;
- if (subscriber !== null) {
- var threadID = computeThreadID(root2, lane);
- subscriber.onWorkScheduled(interactions, threadID);
- }
- }
- }
- function schedulePendingInteractions(root2, lane) {
- scheduleInteractions(root2, lane, tracing.__interactionsRef.current);
- }
- function startWorkOnPendingInteractions(root2, lanes) {
- var interactions = /* @__PURE__ */ new Set();
- root2.pendingInteractionMap.forEach(function(scheduledInteractions, scheduledLane) {
- if (includesSomeLane(lanes, scheduledLane)) {
- scheduledInteractions.forEach(function(interaction) {
- return interactions.add(interaction);
- });
- }
- });
- root2.memoizedInteractions = interactions;
- if (interactions.size > 0) {
- var subscriber = tracing.__subscriberRef.current;
- if (subscriber !== null) {
- var threadID = computeThreadID(root2, lanes);
- try {
- subscriber.onWorkStarted(interactions, threadID);
- } catch (error2) {
- scheduleCallback(ImmediatePriority$1, function() {
- throw error2;
- });
- }
+ if (root2.tag !== LegacyRoot && isConcurrentActEnvironment() && ReactCurrentActQueue$1.current === null) {
+ error("A suspended resource finished loading inside a test, but the event was not wrapped in act(...).\n\nWhen testing, code that resolves suspended data should be wrapped into act(...):\n\nact(() => {\n /* finish loading suspended data */\n});\n/* assert on the output */\n\nThis ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act");
}
}
}
- function finishPendingInteractions(root2, committedLanes) {
- var remainingLanesAfterCommit = root2.pendingLanes;
- var subscriber;
- try {
- subscriber = tracing.__subscriberRef.current;
- if (subscriber !== null && root2.memoizedInteractions.size > 0) {
- var threadID = computeThreadID(root2, committedLanes);
- subscriber.onWorkStopped(root2.memoizedInteractions, threadID);
- }
- } catch (error2) {
- scheduleCallback(ImmediatePriority$1, function() {
- throw error2;
- });
- } finally {
- var pendingInteractionMap = root2.pendingInteractionMap;
- pendingInteractionMap.forEach(function(scheduledInteractions, lane) {
- if (!includesSomeLane(remainingLanesAfterCommit, lane)) {
- pendingInteractionMap.delete(lane);
- scheduledInteractions.forEach(function(interaction) {
- interaction.__count--;
- if (subscriber !== null && interaction.__count === 0) {
- try {
- subscriber.onInteractionScheduledWorkCompleted(interaction);
- } catch (error2) {
- scheduleCallback(ImmediatePriority$1, function() {
- throw error2;
- });
- }
- }
- });
- }
- });
+ function setIsRunningInsertionEffect(isRunning) {
+ {
+ isRunningInsertionEffect = isRunning;
}
}
- function shouldForceFlushFallbacksInDEV() {
- return actingUpdatesScopeDepth > 0;
- }
- var actingUpdatesScopeDepth = 0;
- function detachFiberAfterEffects(fiber) {
- fiber.sibling = null;
- fiber.stateNode = null;
- }
var resolveFamily = null;
var failedBoundaries = null;
var setRefreshHandler = function(handler) {
@@ -19766,7 +21960,10 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
fiber._debugNeedsRemount = true;
}
if (needsRemount || needsRender) {
- scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
+ var _root = enqueueConcurrentRenderForLane(fiber, SyncLane);
+ if (_root !== null) {
+ scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp);
+ }
}
if (child !== null && !needsRemount) {
scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies);
@@ -19883,7 +22080,6 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
hasBadMapPolyfill = true;
}
}
- var debugCounter = 1;
function FiberNode(tag, pendingProps, key, mode) {
this.tag = tag;
this.key = key;
@@ -19902,9 +22098,8 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
this.dependencies = null;
this.mode = mode;
this.flags = NoFlags;
- this.nextEffect = null;
- this.firstEffect = null;
- this.lastEffect = null;
+ this.subtreeFlags = NoFlags;
+ this.deletions = null;
this.lanes = NoLanes;
this.childLanes = NoLanes;
this.alternate = null;
@@ -19919,7 +22114,6 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
this.treeBaseDuration = 0;
}
{
- this._debugID = debugCounter++;
this._debugSource = null;
this._debugOwner = null;
this._debugNeedsRemount = false;
@@ -19961,7 +22155,6 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
workInProgress2.type = current2.type;
workInProgress2.stateNode = current2.stateNode;
{
- workInProgress2._debugID = current2._debugID;
workInProgress2._debugSource = current2._debugSource;
workInProgress2._debugOwner = current2._debugOwner;
workInProgress2._debugHookTypes = current2._debugHookTypes;
@@ -19972,14 +22165,14 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
workInProgress2.pendingProps = pendingProps;
workInProgress2.type = current2.type;
workInProgress2.flags = NoFlags;
- workInProgress2.nextEffect = null;
- workInProgress2.firstEffect = null;
- workInProgress2.lastEffect = null;
+ workInProgress2.subtreeFlags = NoFlags;
+ workInProgress2.deletions = null;
{
workInProgress2.actualDuration = 0;
workInProgress2.actualStartTime = -1;
}
}
+ workInProgress2.flags = current2.flags & StaticMask;
workInProgress2.childLanes = current2.childLanes;
workInProgress2.lanes = current2.lanes;
workInProgress2.child = current2.child;
@@ -20017,15 +22210,13 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
return workInProgress2;
}
function resetWorkInProgress(workInProgress2, renderLanes2) {
- workInProgress2.flags &= Placement;
- workInProgress2.nextEffect = null;
- workInProgress2.firstEffect = null;
- workInProgress2.lastEffect = null;
+ workInProgress2.flags &= StaticMask | Placement;
var current2 = workInProgress2.alternate;
if (current2 === null) {
workInProgress2.childLanes = NoLanes;
workInProgress2.lanes = renderLanes2;
workInProgress2.child = null;
+ workInProgress2.subtreeFlags = NoFlags;
workInProgress2.memoizedProps = null;
workInProgress2.memoizedState = null;
workInProgress2.updateQueue = null;
@@ -20039,6 +22230,8 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
workInProgress2.childLanes = current2.childLanes;
workInProgress2.lanes = current2.lanes;
workInProgress2.child = current2.child;
+ workInProgress2.subtreeFlags = NoFlags;
+ workInProgress2.deletions = null;
workInProgress2.memoizedProps = current2.memoizedProps;
workInProgress2.memoizedState = current2.memoizedState;
workInProgress2.updateQueue = current2.updateQueue;
@@ -20055,12 +22248,16 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
}
return workInProgress2;
}
- function createHostRootFiber(tag) {
+ function createHostRootFiber(tag, isStrictMode, concurrentUpdatesByDefaultOverride) {
var mode;
if (tag === ConcurrentRoot) {
- mode = ConcurrentMode | BlockingMode | StrictMode;
- } else if (tag === BlockingRoot) {
- mode = BlockingMode | StrictMode;
+ mode = ConcurrentMode;
+ if (isStrictMode === true) {
+ mode |= StrictLegacyMode;
+ {
+ mode |= StrictEffectsMode;
+ }
+ }
} else {
mode = NoMode;
}
@@ -20090,13 +22287,12 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
switch (type) {
case REACT_FRAGMENT_TYPE:
return createFiberFromFragment(pendingProps.children, mode, lanes, key);
- case REACT_DEBUG_TRACING_MODE_TYPE:
- fiberTag = Mode;
- mode |= DebugTracingMode;
- break;
case REACT_STRICT_MODE_TYPE:
fiberTag = Mode;
- mode |= StrictMode;
+ mode |= StrictLegacyMode;
+ if ((mode & ConcurrentMode) !== NoMode) {
+ mode |= StrictEffectsMode;
+ }
break;
case REACT_PROFILER_TYPE:
return createFiberFromProfiler(pendingProps, mode, lanes, key);
@@ -20107,8 +22303,10 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
case REACT_OFFSCREEN_TYPE:
return createFiberFromOffscreen(pendingProps, mode, lanes, key);
case REACT_LEGACY_HIDDEN_TYPE:
- return createFiberFromLegacyHidden(pendingProps, mode, lanes, key);
case REACT_SCOPE_TYPE:
+ case REACT_CACHE_TYPE:
+ case REACT_TRACING_MARKER_TYPE:
+ case REACT_DEBUG_TRACING_MODE_TYPE:
default: {
if (typeof type === "object" && type !== null) {
switch (type.$$typeof) {
@@ -20131,9 +22329,6 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
fiberTag = LazyComponent;
resolvedType = null;
break getTag;
- case REACT_BLOCK_TYPE:
- fiberTag = Block;
- break getTag;
}
}
var info = "";
@@ -20141,16 +22336,12 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
}
- var ownerName = owner ? getComponentName(owner.type) : null;
+ var ownerName = owner ? getComponentNameFromFiber(owner) : null;
if (ownerName) {
info += "\n\nCheck the render method of `" + ownerName + "`.";
}
}
- {
- {
- throw Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (type == null ? type : typeof type) + "." + info);
- }
- }
+ throw new Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) " + ("but got: " + (type == null ? type : typeof type) + "." + info));
}
}
}
@@ -20186,12 +22377,11 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
function createFiberFromProfiler(pendingProps, mode, lanes, key) {
{
if (typeof pendingProps.id !== "string") {
- error('Profiler must specify an "id" as a prop');
+ error('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.', typeof pendingProps.id);
}
}
var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
fiber.elementType = REACT_PROFILER_TYPE;
- fiber.type = REACT_PROFILER_TYPE;
fiber.lanes = lanes;
{
fiber.stateNode = {
@@ -20203,36 +22393,24 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
}
function createFiberFromSuspense(pendingProps, mode, lanes, key) {
var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
- fiber.type = REACT_SUSPENSE_TYPE;
fiber.elementType = REACT_SUSPENSE_TYPE;
fiber.lanes = lanes;
return fiber;
}
function createFiberFromSuspenseList(pendingProps, mode, lanes, key) {
var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode);
- {
- fiber.type = REACT_SUSPENSE_LIST_TYPE;
- }
fiber.elementType = REACT_SUSPENSE_LIST_TYPE;
fiber.lanes = lanes;
return fiber;
}
function createFiberFromOffscreen(pendingProps, mode, lanes, key) {
var fiber = createFiber(OffscreenComponent, pendingProps, key, mode);
- {
- fiber.type = REACT_OFFSCREEN_TYPE;
- }
fiber.elementType = REACT_OFFSCREEN_TYPE;
fiber.lanes = lanes;
- return fiber;
- }
- function createFiberFromLegacyHidden(pendingProps, mode, lanes, key) {
- var fiber = createFiber(LegacyHiddenComponent, pendingProps, key, mode);
- {
- fiber.type = REACT_LEGACY_HIDDEN_TYPE;
- }
- fiber.elementType = REACT_LEGACY_HIDDEN_TYPE;
- fiber.lanes = lanes;
+ var primaryChildInstance = {
+ isHidden: false
+ };
+ fiber.stateNode = primaryChildInstance;
return fiber;
}
function createFiberFromText(content, mode, lanes) {
@@ -20243,7 +22421,11 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
function createFiberFromHostInstanceForDeletion() {
var fiber = createFiber(HostComponent, null, null, NoMode);
fiber.elementType = "DELETED";
- fiber.type = "DELETED";
+ return fiber;
+ }
+ function createFiberFromDehydratedFragment(dehydratedNode) {
+ var fiber = createFiber(DehydratedFragment, null, null, NoMode);
+ fiber.stateNode = dehydratedNode;
return fiber;
}
function createFiberFromPortal(portal, mode, lanes) {
@@ -20279,9 +22461,8 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
target.dependencies = source.dependencies;
target.mode = source.mode;
target.flags = source.flags;
- target.nextEffect = source.nextEffect;
- target.firstEffect = source.firstEffect;
- target.lastEffect = source.lastEffect;
+ target.subtreeFlags = source.subtreeFlags;
+ target.deletions = source.deletions;
target.lanes = source.lanes;
target.childLanes = source.childLanes;
target.alternate = source.alternate;
@@ -20291,14 +22472,13 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
target.selfBaseDuration = source.selfBaseDuration;
target.treeBaseDuration = source.treeBaseDuration;
}
- target._debugID = source._debugID;
target._debugSource = source._debugSource;
target._debugOwner = source._debugOwner;
target._debugNeedsRemount = source._debugNeedsRemount;
target._debugHookTypes = source._debugHookTypes;
return target;
}
- function FiberRootNode(containerInfo, tag, hydrate2) {
+ function FiberRootNode(containerInfo, tag, hydrate2, identifierPrefix, onRecoverableError) {
this.tag = tag;
this.containerInfo = containerInfo;
this.pendingChildren = null;
@@ -20308,9 +22488,8 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
this.timeoutHandle = noTimeout;
this.context = null;
this.pendingContext = null;
- this.hydrate = hydrate2;
this.callbackNode = null;
- this.callbackPriority = NoLanePriority;
+ this.callbackPriority = NoLane;
this.eventTimes = createLaneMap(NoLanes);
this.expirationTimes = createLaneMap(NoTimestamp);
this.pendingLanes = NoLanes;
@@ -20321,47 +22500,58 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
this.finishedLanes = NoLanes;
this.entangledLanes = NoLanes;
this.entanglements = createLaneMap(NoLanes);
+ this.identifierPrefix = identifierPrefix;
+ this.onRecoverableError = onRecoverableError;
{
this.mutableSourceEagerHydrationData = null;
}
{
- this.interactionThreadID = tracing.unstable_getThreadID();
- this.memoizedInteractions = /* @__PURE__ */ new Set();
- this.pendingInteractionMap = /* @__PURE__ */ new Map();
+ this.effectDuration = 0;
+ this.passiveEffectDuration = 0;
+ }
+ {
+ this.memoizedUpdaters = /* @__PURE__ */ new Set();
+ var pendingUpdatersLaneMap = this.pendingUpdatersLaneMap = [];
+ for (var _i = 0; _i < TotalLanes; _i++) {
+ pendingUpdatersLaneMap.push(/* @__PURE__ */ new Set());
+ }
}
{
switch (tag) {
- case BlockingRoot:
- this._debugRootType = "createBlockingRoot()";
- break;
case ConcurrentRoot:
- this._debugRootType = "createRoot()";
+ this._debugRootType = hydrate2 ? "hydrateRoot()" : "createRoot()";
break;
case LegacyRoot:
- this._debugRootType = "createLegacyRoot()";
+ this._debugRootType = hydrate2 ? "hydrate()" : "render()";
break;
}
}
}
- function createFiberRoot(containerInfo, tag, hydrate2, hydrationCallbacks) {
- var root2 = new FiberRootNode(containerInfo, tag, hydrate2);
- var uninitializedFiber = createHostRootFiber(tag);
+ function createFiberRoot(containerInfo, tag, hydrate2, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) {
+ var root2 = new FiberRootNode(containerInfo, tag, hydrate2, identifierPrefix, onRecoverableError);
+ var uninitializedFiber = createHostRootFiber(tag, isStrictMode);
root2.current = uninitializedFiber;
uninitializedFiber.stateNode = root2;
+ {
+ var _initialState = {
+ element: initialChildren,
+ isDehydrated: hydrate2,
+ cache: null,
+ // not enabled yet
+ transitions: null,
+ pendingSuspenseBoundaries: null
+ };
+ uninitializedFiber.memoizedState = _initialState;
+ }
initializeUpdateQueue(uninitializedFiber);
return root2;
}
- function registerMutableSourceForHydration(root2, mutableSource) {
- var getVersion = mutableSource._getVersion;
- var version = getVersion(mutableSource._source);
- if (root2.mutableSourceEagerHydrationData == null) {
- root2.mutableSourceEagerHydrationData = [mutableSource, version];
- } else {
- root2.mutableSourceEagerHydrationData.push(mutableSource, version);
- }
- }
+ var ReactVersion = "18.2.0";
function createPortal2(children, containerInfo, implementation) {
var key = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
+ {
+ checkKeyStringCoercion(key);
+ }
return {
// This tag allow us to uniquely identify this as a React Portal
$$typeof: REACT_PORTAL_TYPE,
@@ -20396,31 +22586,24 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
var fiber = get(component);
if (fiber === void 0) {
if (typeof component.render === "function") {
- {
- {
- throw Error("Unable to find node on an unmounted component.");
- }
- }
+ throw new Error("Unable to find node on an unmounted component.");
} else {
- {
- {
- throw Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component));
- }
- }
+ var keys = Object.keys(component).join(",");
+ throw new Error("Argument appears to not be a ReactComponent. Keys: " + keys);
}
}
var hostFiber = findCurrentHostFiber(fiber);
if (hostFiber === null) {
return null;
}
- if (hostFiber.mode & StrictMode) {
- var componentName = getComponentName(fiber.type) || "Component";
+ if (hostFiber.mode & StrictLegacyMode) {
+ var componentName = getComponentNameFromFiber(fiber) || "Component";
if (!didWarnAboutFindNodeInStrictMode[componentName]) {
didWarnAboutFindNodeInStrictMode[componentName] = true;
var previousFiber = current;
try {
setCurrentFiber(hostFiber);
- if (fiber.mode & StrictMode) {
+ if (fiber.mode & StrictLegacyMode) {
error("%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node", methodName, methodName, componentName);
} else {
error("%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node", methodName, methodName, componentName);
@@ -20437,8 +22620,23 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
return hostFiber.stateNode;
}
}
- function createContainer(containerInfo, tag, hydrate2, hydrationCallbacks) {
- return createFiberRoot(containerInfo, tag, hydrate2);
+ function createContainer(containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) {
+ var hydrate2 = false;
+ var initialChildren = null;
+ return createFiberRoot(containerInfo, tag, hydrate2, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
+ }
+ function createHydrationContainer(initialChildren, callback, containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) {
+ var hydrate2 = true;
+ var root2 = createFiberRoot(containerInfo, tag, hydrate2, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
+ root2.context = getContextForSubtree(null);
+ var current2 = root2.current;
+ var eventTime = requestEventTime();
+ var lane = requestUpdateLane(current2);
+ var update = createUpdate(eventTime, lane);
+ update.callback = callback !== void 0 && callback !== null ? callback : null;
+ enqueueUpdate(current2, update, lane);
+ scheduleInitialHydrationOnRoot(root2, lane, eventTime);
+ return root2;
}
function updateContainer(element, container, parentComponent, callback) {
{
@@ -20446,13 +22644,10 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
}
var current$1 = container.current;
var eventTime = requestEventTime();
+ var lane = requestUpdateLane(current$1);
{
- if ("undefined" !== typeof jest) {
- warnIfUnmockedScheduler(current$1);
- warnIfNotScopedWithMatchingAct(current$1);
- }
+ markRenderScheduled(lane);
}
- var lane = requestUpdateLane(current$1);
var context = getContextForSubtree(parentComponent);
if (container.context === null) {
container.context = context;
@@ -20462,7 +22657,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
{
if (isRendering && current !== null && !didWarnAboutNestedUpdates) {
didWarnAboutNestedUpdates = true;
- error("Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate.\n\nCheck the render method of %s.", getComponentName(current.type) || "Unknown");
+ error("Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate.\n\nCheck the render method of %s.", getComponentNameFromFiber(current) || "Unknown");
}
}
var update = createUpdate(eventTime, lane);
@@ -20478,8 +22673,11 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
}
update.callback = callback;
}
- enqueueUpdate(current$1, update);
- scheduleUpdateOnFiber(current$1, lane, eventTime);
+ var root2 = enqueueUpdate(current$1, update, lane);
+ if (root2 !== null) {
+ scheduleUpdateOnFiber(root2, current$1, lane, eventTime);
+ entangleTransitions(root2, current$1, lane);
+ }
return lane;
}
function getPublicRootInstance(container) {
@@ -20494,6 +22692,30 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
return containerFiber.child.stateNode;
}
}
+ function attemptSynchronousHydration$1(fiber) {
+ switch (fiber.tag) {
+ case HostRoot: {
+ var root2 = fiber.stateNode;
+ if (isRootDehydrated(root2)) {
+ var lanes = getHighestPriorityPendingLanes(root2);
+ flushRoot(root2, lanes);
+ }
+ break;
+ }
+ case SuspenseComponent: {
+ flushSync(function() {
+ var root3 = enqueueConcurrentRenderForLane(fiber, SyncLane);
+ if (root3 !== null) {
+ var eventTime = requestEventTime();
+ scheduleUpdateOnFiber(root3, fiber, SyncLane, eventTime);
+ }
+ });
+ var retryLane = SyncLane;
+ markRetryLaneIfNotHydrated(fiber, retryLane);
+ break;
+ }
+ }
+ }
function markRetryLaneImpl(fiber, retryLane) {
var suspenseState = fiber.memoizedState;
if (suspenseState !== null && suspenseState.dehydrated !== null) {
@@ -20507,50 +22729,43 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
markRetryLaneImpl(alternate, retryLane);
}
}
- function attemptUserBlockingHydration$1(fiber) {
- if (fiber.tag !== SuspenseComponent) {
- return;
- }
- var eventTime = requestEventTime();
- var lane = InputDiscreteHydrationLane;
- scheduleUpdateOnFiber(fiber, lane, eventTime);
- markRetryLaneIfNotHydrated(fiber, lane);
- }
function attemptContinuousHydration$1(fiber) {
if (fiber.tag !== SuspenseComponent) {
return;
}
- var eventTime = requestEventTime();
var lane = SelectiveHydrationLane;
- scheduleUpdateOnFiber(fiber, lane, eventTime);
+ var root2 = enqueueConcurrentRenderForLane(fiber, lane);
+ if (root2 !== null) {
+ var eventTime = requestEventTime();
+ scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
+ }
markRetryLaneIfNotHydrated(fiber, lane);
}
function attemptHydrationAtCurrentPriority$1(fiber) {
if (fiber.tag !== SuspenseComponent) {
return;
}
- var eventTime = requestEventTime();
var lane = requestUpdateLane(fiber);
- scheduleUpdateOnFiber(fiber, lane, eventTime);
- markRetryLaneIfNotHydrated(fiber, lane);
- }
- function runWithPriority$2(priority, fn) {
- try {
- setCurrentUpdateLanePriority(priority);
- return fn();
- } finally {
+ var root2 = enqueueConcurrentRenderForLane(fiber, lane);
+ if (root2 !== null) {
+ var eventTime = requestEventTime();
+ scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
}
+ markRetryLaneIfNotHydrated(fiber, lane);
}
function findHostInstanceWithNoPortals(fiber) {
var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
if (hostFiber === null) {
return null;
}
- if (hostFiber.tag === FundamentalComponent) {
- return hostFiber.stateNode.instance;
- }
return hostFiber.stateNode;
}
+ var shouldErrorImpl = function(fiber) {
+ return null;
+ };
+ function shouldError(fiber) {
+ return shouldErrorImpl(fiber);
+ }
var shouldSuspendImpl = function(fiber) {
return false;
};
@@ -20564,13 +22779,14 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
var overridePropsDeletePath = null;
var overridePropsRenamePath = null;
var scheduleUpdate = null;
+ var setErrorHandler = null;
var setSuspenseHandler = null;
{
var copyWithDeleteImpl = function(obj, path, index2) {
var key = path[index2];
- var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
+ var updated = isArray(obj) ? obj.slice() : assign({}, obj);
if (index2 + 1 === path.length) {
- if (Array.isArray(updated)) {
+ if (isArray(updated)) {
updated.splice(key, 1);
} else {
delete updated[key];
@@ -20585,11 +22801,11 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
};
var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
var oldKey = oldPath[index2];
- var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
+ var updated = isArray(obj) ? obj.slice() : assign({}, obj);
if (index2 + 1 === oldPath.length) {
var newKey = newPath[index2];
updated[newKey] = updated[oldKey];
- if (Array.isArray(updated)) {
+ if (isArray(updated)) {
updated.splice(oldKey, 1);
} else {
delete updated[oldKey];
@@ -20624,7 +22840,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
return value;
}
var key = path[index2];
- var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
+ var updated = isArray(obj) ? obj.slice() : assign({}, obj);
updated[key] = copyWithSetImpl(obj[key], path, index2 + 1, value);
return updated;
};
@@ -20645,8 +22861,11 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
var newState = copyWithSet(hook.memoizedState, path, value);
hook.memoizedState = newState;
hook.baseState = newState;
- fiber.memoizedProps = _assign({}, fiber.memoizedProps);
- scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
+ fiber.memoizedProps = assign({}, fiber.memoizedProps);
+ var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
+ if (root2 !== null) {
+ scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
+ }
}
};
overrideHookStateDeletePath = function(fiber, id, path) {
@@ -20655,8 +22874,11 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
var newState = copyWithDelete(hook.memoizedState, path);
hook.memoizedState = newState;
hook.baseState = newState;
- fiber.memoizedProps = _assign({}, fiber.memoizedProps);
- scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
+ fiber.memoizedProps = assign({}, fiber.memoizedProps);
+ var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
+ if (root2 !== null) {
+ scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
+ }
}
};
overrideHookStateRenamePath = function(fiber, id, oldPath, newPath) {
@@ -20665,8 +22887,11 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
var newState = copyWithRename(hook.memoizedState, oldPath, newPath);
hook.memoizedState = newState;
hook.baseState = newState;
- fiber.memoizedProps = _assign({}, fiber.memoizedProps);
- scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
+ fiber.memoizedProps = assign({}, fiber.memoizedProps);
+ var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
+ if (root2 !== null) {
+ scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
+ }
}
};
overrideProps = function(fiber, path, value) {
@@ -20674,24 +22899,39 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
if (fiber.alternate) {
fiber.alternate.pendingProps = fiber.pendingProps;
}
- scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
+ var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
+ if (root2 !== null) {
+ scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
+ }
};
overridePropsDeletePath = function(fiber, path) {
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path);
if (fiber.alternate) {
fiber.alternate.pendingProps = fiber.pendingProps;
}
- scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
+ var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
+ if (root2 !== null) {
+ scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
+ }
};
overridePropsRenamePath = function(fiber, oldPath, newPath) {
fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
if (fiber.alternate) {
fiber.alternate.pendingProps = fiber.pendingProps;
}
- scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
+ var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
+ if (root2 !== null) {
+ scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
+ }
};
scheduleUpdate = function(fiber) {
- scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp);
+ var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
+ if (root2 !== null) {
+ scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
+ }
+ };
+ setErrorHandler = function(newShouldErrorImpl) {
+ shouldErrorImpl = newShouldErrorImpl;
};
setSuspenseHandler = function(newShouldSuspendImpl) {
shouldSuspendImpl = newShouldSuspendImpl;
@@ -20724,6 +22964,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
overrideProps,
overridePropsDeletePath,
overridePropsRenamePath,
+ setErrorHandler,
setSuspenseHandler,
scheduleUpdate,
currentDispatcherRef: ReactCurrentDispatcher2,
@@ -20735,20 +22976,34 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
scheduleRoot,
setRefreshHandler,
// Enables DevTools to append owner stacks to error messages in DEV mode.
- getCurrentFiber: getCurrentFiberForDevTools
+ getCurrentFiber: getCurrentFiberForDevTools,
+ // Enables DevTools to detect reconciler version rather than renderer version
+ // which may not match for third party renderers.
+ reconcilerVersion: ReactVersion
});
}
- function ReactDOMRoot(container, options2) {
- this._internalRoot = createRootImpl(container, ConcurrentRoot, options2);
- }
- function ReactDOMBlockingRoot(container, tag, options2) {
- this._internalRoot = createRootImpl(container, tag, options2);
+ var defaultOnRecoverableError = typeof reportError === "function" ? (
+ // In modern browsers, reportError will dispatch an error event,
+ // emulating an uncaught JavaScript error.
+ reportError
+ ) : function(error2) {
+ console["error"](error2);
+ };
+ function ReactDOMRoot(internalRoot) {
+ this._internalRoot = internalRoot;
}
- ReactDOMRoot.prototype.render = ReactDOMBlockingRoot.prototype.render = function(children) {
+ ReactDOMHydrationRoot.prototype.render = ReactDOMRoot.prototype.render = function(children) {
var root2 = this._internalRoot;
+ if (root2 === null) {
+ throw new Error("Cannot update an unmounted root.");
+ }
{
if (typeof arguments[1] === "function") {
error("render(...): does not support the second callback argument. To execute a side effect after rendering, declare it in a component body with useEffect().");
+ } else if (isValidContainer(arguments[1])) {
+ error("You passed a container to the second argument of root.render(...). You don't need to pass it again since you already passed it to create the root.");
+ } else if (typeof arguments[1] !== "undefined") {
+ error("You passed a second argument to root.render(...) but it only accepts one argument.");
}
var container = root2.containerInfo;
if (container.nodeType !== COMMENT_NODE) {
@@ -20762,50 +23017,139 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
}
updateContainer(children, root2, null, null);
};
- ReactDOMRoot.prototype.unmount = ReactDOMBlockingRoot.prototype.unmount = function() {
+ ReactDOMHydrationRoot.prototype.unmount = ReactDOMRoot.prototype.unmount = function() {
{
if (typeof arguments[0] === "function") {
error("unmount(...): does not support a callback argument. To execute a side effect after rendering, declare it in a component body with useEffect().");
}
}
var root2 = this._internalRoot;
- var container = root2.containerInfo;
- updateContainer(null, root2, null, function() {
+ if (root2 !== null) {
+ this._internalRoot = null;
+ var container = root2.containerInfo;
+ {
+ if (isAlreadyRendering()) {
+ error("Attempted to synchronously unmount a root while React was already rendering. React cannot finish unmounting the root until the current render has completed, which may lead to a race condition.");
+ }
+ }
+ flushSync(function() {
+ updateContainer(null, root2, null, null);
+ });
unmarkContainerAsRoot(container);
- });
+ }
};
- function createRootImpl(container, tag, options2) {
- var hydrate2 = options2 != null && options2.hydrate === true;
- var hydrationCallbacks = options2 != null && options2.hydrationOptions || null;
- var mutableSources = options2 != null && options2.hydrationOptions != null && options2.hydrationOptions.mutableSources || null;
- var root2 = createContainer(container, tag, hydrate2);
+ function createRoot2(container, options2) {
+ if (!isValidContainer(container)) {
+ throw new Error("createRoot(...): Target container is not a DOM element.");
+ }
+ warnIfReactDOMContainerInDEV(container);
+ var isStrictMode = false;
+ var concurrentUpdatesByDefaultOverride = false;
+ var identifierPrefix = "";
+ var onRecoverableError = defaultOnRecoverableError;
+ var transitionCallbacks = null;
+ if (options2 !== null && options2 !== void 0) {
+ {
+ if (options2.hydrate) {
+ warn("hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead.");
+ } else {
+ if (typeof options2 === "object" && options2 !== null && options2.$$typeof === REACT_ELEMENT_TYPE) {
+ error("You passed a JSX element to createRoot. You probably meant to call root.render instead. Example usage:\n\n let root = createRoot(domContainer);\n root.render(<App />);");
+ }
+ }
+ }
+ if (options2.unstable_strictMode === true) {
+ isStrictMode = true;
+ }
+ if (options2.identifierPrefix !== void 0) {
+ identifierPrefix = options2.identifierPrefix;
+ }
+ if (options2.onRecoverableError !== void 0) {
+ onRecoverableError = options2.onRecoverableError;
+ }
+ if (options2.transitionCallbacks !== void 0) {
+ transitionCallbacks = options2.transitionCallbacks;
+ }
+ }
+ var root2 = createContainer(container, ConcurrentRoot, null, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
markContainerAsRoot(root2.current, container);
- var containerNodeType = container.nodeType;
+ var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
+ listenToAllSupportedEvents(rootContainerElement);
+ return new ReactDOMRoot(root2);
+ }
+ function ReactDOMHydrationRoot(internalRoot) {
+ this._internalRoot = internalRoot;
+ }
+ function scheduleHydration(target) {
+ if (target) {
+ queueExplicitHydrationTarget(target);
+ }
+ }
+ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = scheduleHydration;
+ function hydrateRoot(container, initialChildren, options2) {
+ if (!isValidContainer(container)) {
+ throw new Error("hydrateRoot(...): Target container is not a DOM element.");
+ }
+ warnIfReactDOMContainerInDEV(container);
{
- var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
- listenToAllSupportedEvents(rootContainerElement);
+ if (initialChildren === void 0) {
+ error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");
+ }
}
+ var hydrationCallbacks = options2 != null ? options2 : null;
+ var mutableSources = options2 != null && options2.hydratedSources || null;
+ var isStrictMode = false;
+ var concurrentUpdatesByDefaultOverride = false;
+ var identifierPrefix = "";
+ var onRecoverableError = defaultOnRecoverableError;
+ if (options2 !== null && options2 !== void 0) {
+ if (options2.unstable_strictMode === true) {
+ isStrictMode = true;
+ }
+ if (options2.identifierPrefix !== void 0) {
+ identifierPrefix = options2.identifierPrefix;
+ }
+ if (options2.onRecoverableError !== void 0) {
+ onRecoverableError = options2.onRecoverableError;
+ }
+ }
+ var root2 = createHydrationContainer(initialChildren, null, container, ConcurrentRoot, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
+ markContainerAsRoot(root2.current, container);
+ listenToAllSupportedEvents(container);
if (mutableSources) {
for (var i = 0; i < mutableSources.length; i++) {
var mutableSource = mutableSources[i];
registerMutableSourceForHydration(root2, mutableSource);
}
}
- return root2;
- }
- function createLegacyRoot(container, options2) {
- return new ReactDOMBlockingRoot(container, LegacyRoot, options2);
+ return new ReactDOMHydrationRoot(root2);
}
function isValidContainer(node) {
+ return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || !disableCommentsAsDOMContainers));
+ }
+ function isValidContainerLegacy(node) {
return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === " react-mount-point-unstable "));
}
+ function warnIfReactDOMContainerInDEV(container) {
+ {
+ if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === "BODY") {
+ error("createRoot(): Creating roots directly with document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try using a container element created for your app.");
+ }
+ if (isContainerMarkedAsRoot(container)) {
+ if (container._reactRootContainer) {
+ error("You are calling ReactDOMClient.createRoot() on a container that was previously passed to ReactDOM.render(). This is not supported.");
+ } else {
+ error("You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before. Instead, call root.render() on the existing root instead if you want to update it.");
+ }
+ }
+ }
+ }
var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
var topLevelUpdateWarnings;
- var warnedAboutHydrateAPI = false;
{
topLevelUpdateWarnings = function(container) {
if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
- var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
+ var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer.current);
if (hostInstance) {
if (hostInstance.parentNode !== container) {
error("render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.");
@@ -20833,34 +23177,72 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
return container.firstChild;
}
}
- function shouldHydrateDueToLegacyHeuristic(container) {
- var rootElement = getReactRootElementInContainer(container);
- return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
+ function noopOnRecoverableError() {
}
- function legacyCreateRootFromDOMContainer(container, forceHydrate) {
- var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container);
- if (!shouldHydrate) {
- var warned = false;
+ function legacyCreateRootFromDOMContainer(container, initialChildren, parentComponent, callback, isHydrationContainer) {
+ if (isHydrationContainer) {
+ if (typeof callback === "function") {
+ var originalCallback = callback;
+ callback = function() {
+ var instance = getPublicRootInstance(root2);
+ originalCallback.call(instance);
+ };
+ }
+ var root2 = createHydrationContainer(
+ initialChildren,
+ callback,
+ container,
+ LegacyRoot,
+ null,
+ // hydrationCallbacks
+ false,
+ // isStrictMode
+ false,
+ // concurrentUpdatesByDefaultOverride,
+ "",
+ // identifierPrefix
+ noopOnRecoverableError
+ );
+ container._reactRootContainer = root2;
+ markContainerAsRoot(root2.current, container);
+ var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
+ listenToAllSupportedEvents(rootContainerElement);
+ flushSync();
+ return root2;
+ } else {
var rootSibling;
while (rootSibling = container.lastChild) {
- {
- if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) {
- warned = true;
- error("render(): Target node has markup rendered by React, but there are unrelated nodes as well. This is most commonly caused by white-space inserted around server-rendered markup.");
- }
- }
container.removeChild(rootSibling);
}
- }
- {
- if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
- warnedAboutHydrateAPI = true;
- warn("render(): Calling ReactDOM.render() to hydrate server-rendered markup will stop working in React v18. Replace the ReactDOM.render() call with ReactDOM.hydrate() if you want React to attach to the server HTML.");
+ if (typeof callback === "function") {
+ var _originalCallback = callback;
+ callback = function() {
+ var instance = getPublicRootInstance(_root);
+ _originalCallback.call(instance);
+ };
}
+ var _root = createContainer(
+ container,
+ LegacyRoot,
+ null,
+ // hydrationCallbacks
+ false,
+ // isStrictMode
+ false,
+ // concurrentUpdatesByDefaultOverride,
+ "",
+ // identifierPrefix
+ noopOnRecoverableError
+ );
+ container._reactRootContainer = _root;
+ markContainerAsRoot(_root.current, container);
+ var _rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
+ listenToAllSupportedEvents(_rootContainerElement);
+ flushSync(function() {
+ updateContainer(initialChildren, _root, parentComponent, callback);
+ });
+ return _root;
}
- return createLegacyRoot(container, shouldHydrate ? {
- hydrate: true
- } : void 0);
}
function warnOnInvalidCallback$1(callback, callerName) {
{
@@ -20874,33 +23256,22 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
topLevelUpdateWarnings(container);
warnOnInvalidCallback$1(callback === void 0 ? null : callback, "render");
}
- var root2 = container._reactRootContainer;
- var fiberRoot;
- if (!root2) {
- root2 = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate);
- fiberRoot = root2._internalRoot;
+ var maybeRoot = container._reactRootContainer;
+ var root2;
+ if (!maybeRoot) {
+ root2 = legacyCreateRootFromDOMContainer(container, children, parentComponent, callback, forceHydrate);
+ } else {
+ root2 = maybeRoot;
if (typeof callback === "function") {
var originalCallback = callback;
callback = function() {
- var instance = getPublicRootInstance(fiberRoot);
+ var instance = getPublicRootInstance(root2);
originalCallback.call(instance);
};
}
- unbatchedUpdates(function() {
- updateContainer(children, fiberRoot, parentComponent, callback);
- });
- } else {
- fiberRoot = root2._internalRoot;
- if (typeof callback === "function") {
- var _originalCallback = callback;
- callback = function() {
- var instance = getPublicRootInstance(fiberRoot);
- _originalCallback.call(instance);
- };
- }
- updateContainer(children, fiberRoot, parentComponent, callback);
+ updateContainer(children, root2, parentComponent, callback);
}
- return getPublicRootInstance(fiberRoot);
+ return getPublicRootInstance(root2);
}
function findDOMNode2(componentOrElement) {
{
@@ -20908,7 +23279,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
if (owner !== null && owner.stateNode !== null) {
var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
if (!warnedAboutRefsInRender) {
- error("%s is accessing findDOMNode inside its render(). render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.", getComponentName(owner.type) || "A component");
+ error("%s is accessing findDOMNode inside its render(). render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.", getComponentNameFromType(owner.type) || "A component");
}
owner.stateNode._warnedAboutRefsInRender = true;
}
@@ -20924,56 +23295,55 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
}
}
function hydrate(element, container, callback) {
- if (!isValidContainer(container)) {
- {
- throw Error("Target container is not a DOM element.");
- }
+ {
+ error("ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot");
+ }
+ if (!isValidContainerLegacy(container)) {
+ throw new Error("Target container is not a DOM element.");
}
{
var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === void 0;
if (isModernRoot) {
- error("You are calling ReactDOM.hydrate() on a container that was previously passed to ReactDOM.createRoot(). This is not supported. Did you mean to call createRoot(container, {hydrate: true}).render(element)?");
+ error("You are calling ReactDOM.hydrate() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call hydrateRoot(container, element)?");
}
}
return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
}
function render(element, container, callback) {
- if (!isValidContainer(container)) {
- {
- throw Error("Target container is not a DOM element.");
- }
+ {
+ error("ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot");
+ }
+ if (!isValidContainerLegacy(container)) {
+ throw new Error("Target container is not a DOM element.");
}
{
var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === void 0;
if (isModernRoot) {
- error("You are calling ReactDOM.render() on a container that was previously passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.render(element)?");
+ error("You are calling ReactDOM.render() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.render(element)?");
}
}
return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
}
function unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
- if (!isValidContainer(containerNode)) {
- {
- throw Error("Target container is not a DOM element.");
- }
+ {
+ error("ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported in React 18. Consider using a portal instead. Until you switch to the createRoot API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot");
}
- if (!(parentComponent != null && has(parentComponent))) {
- {
- throw Error("parentComponent must be a valid React Component");
- }
+ if (!isValidContainerLegacy(containerNode)) {
+ throw new Error("Target container is not a DOM element.");
+ }
+ if (parentComponent == null || !has(parentComponent)) {
+ throw new Error("parentComponent must be a valid React Component");
}
return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
}
function unmountComponentAtNode(container) {
- if (!isValidContainer(container)) {
- {
- throw Error("unmountComponentAtNode(...): Target container is not a DOM element.");
- }
+ if (!isValidContainerLegacy(container)) {
+ throw new Error("unmountComponentAtNode(...): Target container is not a DOM element.");
}
{
var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === void 0;
if (isModernRoot) {
- error("You are calling ReactDOM.unmountComponentAtNode() on a container that was previously passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.unmount()?");
+ error("You are calling ReactDOM.unmountComponentAtNode() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.unmount()?");
}
}
if (container._reactRootContainer) {
@@ -20984,7 +23354,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
error("unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React.");
}
}
- unbatchedUpdates(function() {
+ flushSync(function() {
legacyRenderSubtreeIntoContainer(null, null, container, false, function() {
container._reactRootContainer = null;
unmarkContainerAsRoot(container);
@@ -20995,7 +23365,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
{
var _rootEl = getReactRootElementInContainer(container);
var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode(_rootEl));
- var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
+ var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainerLegacy(container.parentNode) && !!container.parentNode._reactRootContainer;
if (hasNonRootReactChild) {
error("unmountComponentAtNode(): The node you're attempting to unmount was rendered by React and is not a top-level container. %s", isContainerReactRoot ? "You may have accidentally passed in a React root node instead of its container." : "Instead, have the parent component update its state and rerender in order to remove this component.");
}
@@ -21003,11 +23373,11 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
return false;
}
}
- setAttemptUserBlockingHydration(attemptUserBlockingHydration$1);
+ setAttemptSynchronousHydration(attemptSynchronousHydration$1);
setAttemptContinuousHydration(attemptContinuousHydration$1);
setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1);
- setAttemptHydrationAtPriority(runWithPriority$2);
- var didWarnAboutUnstableCreatePortal = false;
+ setGetCurrentUpdatePriority(getCurrentUpdatePriority);
+ setAttemptHydrationAtPriority(runWithPriority);
{
if (typeof Map !== "function" || // $FlowIssue Flow incorrectly thinks Map has no prototype
Map.prototype == null || typeof Map.prototype.forEach !== "function" || typeof Set !== "function" || // $FlowIssue Flow incorrectly thinks Set has no prototype
@@ -21016,43 +23386,47 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
}
}
setRestoreImplementation(restoreControlledState$3);
- setBatchingImplementation(batchedUpdates$1, discreteUpdates$1, flushDiscreteUpdates, batchedEventUpdates$1);
+ setBatchingImplementation(batchedUpdates$1, discreteUpdates, flushSync);
function createPortal$1(children, container) {
var key = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
if (!isValidContainer(container)) {
- {
- throw Error("Target container is not a DOM element.");
- }
+ throw new Error("Target container is not a DOM element.");
}
return createPortal2(children, container, null, key);
}
function renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
return unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback);
}
- function unstable_createPortal(children, container) {
- var key = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
+ var Internals = {
+ usingClientEntryPoint: false,
+ // Keep in sync with ReactTestUtils.js.
+ // This is an array for better minification.
+ Events: [getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, restoreStateIfNeeded, batchedUpdates$1]
+ };
+ function createRoot$1(container, options2) {
{
- if (!didWarnAboutUnstableCreatePortal) {
- didWarnAboutUnstableCreatePortal = true;
- warn('The ReactDOM.unstable_createPortal() alias has been deprecated, and will be removed in React 18+. Update your code to use ReactDOM.createPortal() instead. It has the exact same API, but without the "unstable_" prefix.');
+ if (!Internals.usingClientEntryPoint && true) {
+ error('You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".');
}
}
- return createPortal$1(children, container, key);
+ return createRoot2(container, options2);
+ }
+ function hydrateRoot$1(container, initialChildren, options2) {
+ {
+ if (!Internals.usingClientEntryPoint && true) {
+ error('You are importing hydrateRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".');
+ }
+ }
+ return hydrateRoot(container, initialChildren, options2);
+ }
+ function flushSync$1(fn) {
+ {
+ if (isAlreadyRendering()) {
+ error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.");
+ }
+ }
+ return flushSync(fn);
}
- var Internals = {
- // Keep in sync with ReactTestUtils.js, and ReactTestUtilsAct.js.
- // This is an array for better minification.
- Events: [
- getInstanceFromNode,
- getNodeFromInstance,
- getFiberCurrentPropsFromNode,
- enqueueStateRestore,
- restoreStateIfNeeded,
- flushPassiveEffects,
- // TODO: This is related to `act`, not events. Move to separate key?
- IsThisRendererActing
- ]
- };
var foundDevTools = injectIntoDevTools({
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 1,
@@ -21071,15 +23445,19 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
}
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
exports.createPortal = createPortal$1;
+ exports.createRoot = createRoot$1;
exports.findDOMNode = findDOMNode2;
- exports.flushSync = flushSync;
+ exports.flushSync = flushSync$1;
exports.hydrate = hydrate;
+ exports.hydrateRoot = hydrateRoot$1;
exports.render = render;
exports.unmountComponentAtNode = unmountComponentAtNode;
exports.unstable_batchedUpdates = batchedUpdates$1;
- exports.unstable_createPortal = unstable_createPortal;
exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer;
exports.version = ReactVersion;
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
+ }
})();
}
}
@@ -21098,19 +23476,50 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
}
});
+ // node_modules/react-dom/client.js
+ var require_client = __commonJS({
+ "node_modules/react-dom/client.js"(exports) {
+ "use strict";
+ var m = require_react_dom();
+ if (false) {
+ exports.createRoot = m.createRoot;
+ exports.hydrateRoot = m.hydrateRoot;
+ } else {
+ i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+ exports.createRoot = function(c, o) {
+ i.usingClientEntryPoint = true;
+ try {
+ return m.createRoot(c, o);
+ } finally {
+ i.usingClientEntryPoint = false;
+ }
+ };
+ exports.hydrateRoot = function(c, h, o) {
+ i.usingClientEntryPoint = true;
+ try {
+ return m.hydrateRoot(c, h, o);
+ } finally {
+ i.usingClientEntryPoint = false;
+ }
+ };
+ }
+ var i;
+ }
+ });
+
// node_modules/@patternfly/react-styles/css/components/Card/card.css
- var require_ = __commonJS({
+ var require_card = __commonJS({
"node_modules/@patternfly/react-styles/css/components/Card/card.css"(exports, module) {
module.exports = {};
}
});
// node_modules/@patternfly/react-styles/css/components/Card/card.js
- var require_card = __commonJS({
+ var require_card2 = __commonJS({
"node_modules/@patternfly/react-styles/css/components/Card/card.js"(exports) {
"use strict";
exports.__esModule = true;
- require_();
+ require_card();
exports.default = {
"card": "pf-v5-c-card",
"cardActions": "pf-v5-c-card__actions",
@@ -21157,18 +23566,18 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
});
// node_modules/@patternfly/react-styles/css/components/Button/button.css
- var require_2 = __commonJS({
+ var require_button = __commonJS({
"node_modules/@patternfly/react-styles/css/components/Button/button.css"(exports, module) {
module.exports = {};
}
});
// node_modules/@patternfly/react-styles/css/components/Button/button.js
- var require_button = __commonJS({
+ var require_button2 = __commonJS({
"node_modules/@patternfly/react-styles/css/components/Button/button.js"(exports) {
"use strict";
exports.__esModule = true;
- require_2();
+ require_button();
exports.default = {
"badge": "pf-v5-c-badge",
"button": "pf-v5-c-button",
@@ -21205,18 +23614,18 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
});
// node_modules/@patternfly/react-styles/css/components/Spinner/spinner.css
- var require_3 = __commonJS({
+ var require_spinner = __commonJS({
"node_modules/@patternfly/react-styles/css/components/Spinner/spinner.css"(exports, module) {
module.exports = {};
}
});
// node_modules/@patternfly/react-styles/css/components/Spinner/spinner.js
- var require_spinner = __commonJS({
+ var require_spinner2 = __commonJS({
"node_modules/@patternfly/react-styles/css/components/Spinner/spinner.js"(exports) {
"use strict";
exports.__esModule = true;
- require_3();
+ require_spinner();
exports.default = {
"modifiers": {
"inline": "pf-m-inline",
@@ -21232,18 +23641,18 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
});
// node_modules/@patternfly/react-styles/css/components/Badge/badge.css
- var require_4 = __commonJS({
+ var require_badge = __commonJS({
"node_modules/@patternfly/react-styles/css/components/Badge/badge.css"(exports, module) {
module.exports = {};
}
});
// node_modules/@patternfly/react-styles/css/components/Badge/badge.js
- var require_badge = __commonJS({
+ var require_badge2 = __commonJS({
"node_modules/@patternfly/react-styles/css/components/Badge/badge.js"(exports) {
"use strict";
exports.__esModule = true;
- require_4();
+ require_badge();
exports.default = {
"badge": "pf-v5-c-badge",
"modifiers": {
@@ -21256,18 +23665,18 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
});
// node_modules/@patternfly/react-styles/css/components/Radio/radio.css
- var require_5 = __commonJS({
+ var require_radio = __commonJS({
"node_modules/@patternfly/react-styles/css/components/Radio/radio.css"(exports, module) {
module.exports = {};
}
});
// node_modules/@patternfly/react-styles/css/components/Radio/radio.js
- var require_radio = __commonJS({
+ var require_radio2 = __commonJS({
"node_modules/@patternfly/react-styles/css/components/Radio/radio.js"(exports) {
"use strict";
exports.__esModule = true;
- require_5();
+ require_radio();
exports.default = {
"modifiers": {
"standalone": "pf-m-standalone",
@@ -21283,18 +23692,18 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
});
// node_modules/@patternfly/react-styles/css/components/Check/check.css
- var require_6 = __commonJS({
+ var require_check = __commonJS({
"node_modules/@patternfly/react-styles/css/components/Check/check.css"(exports, module) {
module.exports = {};
}
});
// node_modules/@patternfly/react-styles/css/components/Check/check.js
- var require_check = __commonJS({
+ var require_check2 = __commonJS({
"node_modules/@patternfly/react-styles/css/components/Check/check.js"(exports) {
"use strict";
exports.__esModule = true;
- require_6();
+ require_check();
exports.default = {
"check": "pf-v5-c-check",
"checkBody": "pf-v5-c-check__body",
@@ -21353,7 +23762,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// src/index.js
var import_react3 = __toESM(require_react(), 1);
- var import_react_dom = __toESM(require_react_dom(), 1);
+ var import_client = __toESM(require_client(), 1);
// pkg/lib/cockpit.js
var url_root;
@@ -21586,8 +23995,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
if (!suffix)
suffix = "socket";
const window_loc = window.location.toString();
- const meta_websocket_root = document.head.querySelector("meta[name='websocket-root']");
- let _url_root = meta_websocket_root ? meta_websocket_root.content.replace(/^\/+|\/+$/g, "") : url_root;
+ let _url_root = url_root;
if (window.mock?.url)
return window.mock.url;
if (window.mock?.url_root)
@@ -21698,12 +24106,6 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
if (window.parent !== window && window.name.indexOf("cockpit1:") === 0)
ws = new ParentWebSocket(window.parent);
let check_health_timer;
- try {
- if (!ws && window.parent !== window && window.parent.options && window.parent.options.protocol == "cockpit1") {
- ws = new ParentWebSocket(window.parent);
- }
- } catch (ex) {
- }
if (!ws) {
const ws_loc = calculate_url();
transport_debug("connecting to " + ws_loc);
@@ -24793,7 +27195,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// node_modules/@patternfly/react-core/dist/esm/components/Card/Card.js
var React8 = __toESM(require_react());
- var import_card = __toESM(require_card());
+ var import_card = __toESM(require_card2());
// node_modules/@patternfly/react-styles/dist/esm/index.js
function css(...args) {
@@ -25008,14 +27410,27 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
}
return candidates;
};
- var getTabindex = function getTabindex2(node, isScope) {
+ var hasTabIndex = function hasTabIndex2(node) {
+ return !isNaN(parseInt(node.getAttribute("tabindex"), 10));
+ };
+ var getTabIndex = function getTabIndex2(node) {
+ if (!node) {
+ throw new Error("No node provided");
+ }
if (node.tabIndex < 0) {
- if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && isNaN(parseInt(node.getAttribute("tabindex"), 10))) {
+ if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
return 0;
}
}
return node.tabIndex;
};
+ var getSortOrderTabIndex = function getSortOrderTabIndex2(node, isScope) {
+ var tabIndex = getTabIndex(node);
+ if (tabIndex < 0 && isScope && !hasTabIndex(node)) {
+ return 0;
+ }
+ return tabIndex;
+ };
var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
};
@@ -25155,7 +27570,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
return true;
};
var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
- if (isNonTabbableRadio(node) || getTabindex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
+ if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
return false;
}
return true;
@@ -25173,7 +27588,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
candidates.forEach(function(item, i) {
var isScope = !!item.scopeParent;
var element = isScope ? item.scopeParent : item;
- var candidateTabindex = getTabindex(element, isScope);
+ var candidateTabindex = getSortOrderTabIndex(element, isScope);
var elements = isScope ? sortByOrder2(item.candidates) : element;
if (candidateTabindex === 0) {
isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
@@ -25192,32 +27607,32 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
return acc;
}, []).concat(regularTabbables);
};
- var tabbable = function tabbable2(el, options) {
+ var tabbable = function tabbable2(container, options) {
options = options || {};
var candidates;
if (options.getShadowRoot) {
- candidates = getCandidatesIteratively([el], options.includeContainer, {
+ candidates = getCandidatesIteratively([container], options.includeContainer, {
filter: isNodeMatchingSelectorTabbable.bind(null, options),
flatten: false,
getShadowRoot: options.getShadowRoot,
shadowRootFilter: isValidShadowRootTabbable
});
} else {
- candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
+ candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
}
return sortByOrder(candidates);
};
- var focusable = function focusable2(el, options) {
+ var focusable = function focusable2(container, options) {
options = options || {};
var candidates;
if (options.getShadowRoot) {
- candidates = getCandidatesIteratively([el], options.includeContainer, {
+ candidates = getCandidatesIteratively([container], options.includeContainer, {
filter: isNodeMatchingSelectorFocusable.bind(null, options),
flatten: true,
getShadowRoot: options.getShadowRoot
});
} else {
- candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
+ candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
}
return candidates;
};
@@ -27704,7 +30119,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// node_modules/@patternfly/react-core/dist/esm/components/Card/CardBody.js
var React9 = __toESM(require_react());
- var import_card2 = __toESM(require_card());
+ var import_card2 = __toESM(require_card2());
var CardBody = (_a) => {
var { children, className, component = "div", isFilled = true } = _a, props = __rest(_a, ["children", "className", "component", "isFilled"]);
const Component7 = component;
@@ -27714,7 +30129,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// node_modules/@patternfly/react-core/dist/esm/components/Card/CardExpandableContent.js
var React10 = __toESM(require_react());
- var import_card3 = __toESM(require_card());
+ var import_card3 = __toESM(require_card2());
var CardExpandableContent = (_a) => {
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
return React10.createElement(CardContext.Consumer, null, ({ isExpanded }) => isExpanded ? React10.createElement("div", Object.assign({ className: css(import_card3.default.cardExpandableContent, className) }, props), children) : null);
@@ -27723,7 +30138,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// node_modules/@patternfly/react-core/dist/esm/components/Card/CardFooter.js
var React11 = __toESM(require_react());
- var import_card4 = __toESM(require_card());
+ var import_card4 = __toESM(require_card2());
var CardFooter = (_a) => {
var { children, className, component = "div" } = _a, props = __rest(_a, ["children", "className", "component"]);
const Component7 = component;
@@ -27733,7 +30148,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// node_modules/@patternfly/react-core/dist/esm/components/Card/CardTitle.js
var React12 = __toESM(require_react());
- var import_card5 = __toESM(require_card());
+ var import_card5 = __toESM(require_card2());
var CardTitle = (_a) => {
var { children, className, component = "div" } = _a, props = __rest(_a, ["children", "className", "component"]);
const { cardId, registerTitleId } = React12.useContext(CardContext);
@@ -27753,11 +30168,11 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// node_modules/@patternfly/react-core/dist/esm/components/Card/CardHeader.js
var React22 = __toESM(require_react());
- var import_card9 = __toESM(require_card());
+ var import_card9 = __toESM(require_card2());
// node_modules/@patternfly/react-core/dist/esm/components/Card/CardHeaderMain.js
var React13 = __toESM(require_react());
- var import_card6 = __toESM(require_card());
+ var import_card6 = __toESM(require_card2());
var CardHeaderMain = (_a) => {
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
return React13.createElement("div", Object.assign({ className: css(import_card6.default.cardHeaderMain, className) }, props), children);
@@ -27766,7 +30181,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// node_modules/@patternfly/react-core/dist/esm/components/Card/CardActions.js
var React14 = __toESM(require_react());
- var import_card7 = __toESM(require_card());
+ var import_card7 = __toESM(require_card2());
var CardActions = (_a) => {
var { children, className, hasNoOffset = false } = _a, props = __rest(_a, ["children", "className", "hasNoOffset"]);
return React14.createElement("div", Object.assign({ className: css(import_card7.default.cardActions, hasNoOffset && import_card7.default.modifiers.noOffset, className) }, props), children);
@@ -27775,7 +30190,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// node_modules/@patternfly/react-core/dist/esm/components/Card/CardSelectableActions.js
var React15 = __toESM(require_react());
- var import_card8 = __toESM(require_card());
+ var import_card8 = __toESM(require_card2());
var CardSelectableActions = (_a) => {
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
return React15.createElement("div", Object.assign({ className: css(import_card8.default.cardSelectableActions, className) }, props), children);
@@ -27784,11 +30199,11 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// node_modules/@patternfly/react-core/dist/esm/components/Button/Button.js
var React18 = __toESM(require_react());
- var import_button = __toESM(require_button());
+ var import_button = __toESM(require_button2());
// node_modules/@patternfly/react-core/dist/esm/components/Spinner/Spinner.js
var React16 = __toESM(require_react());
- var import_spinner = __toESM(require_spinner());
+ var import_spinner = __toESM(require_spinner2());
var spinnerSize;
(function(spinnerSize2) {
spinnerSize2["sm"] = "sm";
@@ -27817,7 +30232,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// node_modules/@patternfly/react-core/dist/esm/components/Badge/Badge.js
var React17 = __toESM(require_react());
- var import_badge = __toESM(require_badge());
+ var import_badge = __toESM(require_badge2());
var Badge = (_a) => {
var { isRead = false, className = "", children = "", screenReaderText } = _a, props = __rest(_a, ["isRead", "className", "children", "screenReaderText"]);
return React17.createElement(
@@ -27932,8 +30347,8 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// node_modules/@patternfly/react-core/dist/esm/components/Radio/Radio.js
var React20 = __toESM(require_react());
- var import_radio = __toESM(require_radio());
- var Radio = class extends React20.Component {
+ var import_radio = __toESM(require_radio2());
+ var Radio = class _Radio extends React20.Component {
constructor(props) {
super(props);
this.handleChange = (event) => {
@@ -27943,7 +30358,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
console.error("Radio:", "Radio requires an aria-label to be specified");
}
this.state = {
- ouiaStateId: getDefaultOUIAId(Radio.displayName)
+ ouiaStateId: getDefaultOUIAId(_Radio.displayName)
};
}
render() {
@@ -27969,7 +30384,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
if (!props.id) {
console.error("Radio:", "id is required to make input accessible");
}
- const inputRendered = React20.createElement("input", Object.assign({}, props, { className: css(import_radio.default.radioInput, inputClassName), type: "radio", onChange: this.handleChange, "aria-invalid": !isValid, disabled: isDisabled, checked: checked || isChecked }, checked === void 0 && { defaultChecked }, !label && { "aria-label": ariaLabel }, getOUIAProps(Radio.displayName, ouiaId !== void 0 ? ouiaId : this.state.ouiaStateId, ouiaSafe)));
+ const inputRendered = React20.createElement("input", Object.assign({}, props, { className: css(import_radio.default.radioInput, inputClassName), type: "radio", onChange: this.handleChange, "aria-invalid": !isValid, disabled: isDisabled, checked: checked || isChecked }, checked === void 0 && { defaultChecked }, !label && { "aria-label": ariaLabel }, getOUIAProps(_Radio.displayName, ouiaId !== void 0 ? ouiaId : this.state.ouiaStateId, ouiaSafe)));
let labelRendered = null;
if (label && isLabelWrapped) {
labelRendered = React20.createElement("span", { className: css(import_radio.default.radioLabel, isDisabled && import_radio.default.modifiers.disabled) }, label);
@@ -28007,17 +30422,17 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
// node_modules/@patternfly/react-core/dist/esm/components/Checkbox/Checkbox.js
var React21 = __toESM(require_react());
- var import_check = __toESM(require_check());
+ var import_check = __toESM(require_check2());
var defaultOnChange = () => {
};
- var Checkbox = class extends React21.Component {
+ var Checkbox = class _Checkbox extends React21.Component {
constructor(props) {
super(props);
this.handleChange = (event) => {
this.props.onChange(event, event.currentTarget.checked);
};
this.state = {
- ouiaStateId: getDefaultOUIAId(Checkbox.displayName)
+ ouiaStateId: getDefaultOUIAId(_Checkbox.displayName)
};
}
render() {
@@ -28039,7 +30454,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
return React21.createElement(
Component7,
{ className: css(import_check.default.check, !label && import_check.default.modifiers.standalone, className) },
- React21.createElement("input", Object.assign({}, props, { className: css(import_check.default.checkInput, inputClassName), type: "checkbox", onChange: this.handleChange, "aria-invalid": !isValid, "aria-label": ariaLabel, disabled: isDisabled, required: isRequired, ref: (elem) => elem && (elem.indeterminate = isChecked === null) }, checkedProps, getOUIAProps(Checkbox.displayName, ouiaId !== void 0 ? ouiaId : this.state.ouiaStateId, ouiaSafe))),
+ React21.createElement("input", Object.assign({}, props, { className: css(import_check.default.checkInput, inputClassName), type: "checkbox", onChange: this.handleChange, "aria-invalid": !isValid, "aria-label": ariaLabel, disabled: isDisabled, required: isRequired, ref: (elem) => elem && (elem.indeterminate = isChecked === null) }, checkedProps, getOUIAProps(_Checkbox.displayName, ouiaId !== void 0 ? ouiaId : this.state.ouiaStateId, ouiaSafe))),
label && React21.createElement(
"label",
{ className: css(import_check.default.checkLabel, isDisabled && import_check.default.modifiers.disabled), htmlFor: props.id },
@@ -28143,7 +30558,7 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
componentDidMount() {
const populatePlaybookList = () => {
const playbookDropdown = document.getElementById("playbook");
- const command = `ls ${this.state.playbookFolder} |grep -e .yml -e .yaml`;
+ const command = `ls ${this.state.playbookFolder} | grep -e .yml -e .yaml`;
const process2 = cockpit_default.spawn(["bash", "-c", command], { superuser: "require", err: "message" });
process2.done((data) => {
const playbooks = data.split("\n");
@@ -28162,21 +30577,11 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
});
};
const populateImageList = () => {
- const imageNameDropdown = document.getElementById("image-name");
const command = 'podman image list --filter label=ansible_execution_environment --noheading --format "table {{.Repository}}"';
const process2 = cockpit_default.spawn(["bash", "-c", command], { superuser: "require", err: "message" });
process2.done((data) => {
const images = data.split("\n");
- this.setState({ imageList: images.filter((image) => image !== "") });
- imageNameDropdown.innerHTML = "";
- images.forEach(function(image) {
- if (image !== "") {
- const option = document.createElement("option");
- option.value = image;
- option.textContent = image;
- imageNameDropdown.appendChild(option);
- }
- });
+ this.setState({ imageList: images.filter((image) => image.trim() !== "") });
});
process2.fail(function(error) {
console.error("Error fetching images:", error);
@@ -28224,13 +30629,13 @@ For more info, visit https://reactjs.org/link/mock-scheduler`);
populateImageList();
}
render() {
- return /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement(Card, null, /* @__PURE__ */ import_react2.default.createElement(CardTitle, null, "Run Ansible Playbook"), /* @__PURE__ */ import_react2.default.createElement(CardBody, null, /* @__PURE__ */ import_react2.default.createElement("form", { id: "ansible-form" }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react2.default.createElement("label", { htmlFor: "playbook-folder" }, "Playbook Folder:"), /* @__PURE__ */ import_react2.default.createElement("input", { type: "text", id: "playbook-folder", className: "form-control", placeholder: "/opt/playbooks" })), /* @__PURE__ */ import_react2.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react2.default.createElement("label", { htmlFor: "playbook" }, "Select Playbook:"), /* @__PURE__ */ import_react2.default.createElement("select", { id: "playbook", className: "form-control" }, /* @__PURE__ */ import_react2.default.createElement("option", { value: "" }, "Choose a playbook"))), /* @__PURE__ */ import_react2.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react2.default.createElement("label", { htmlFor: "extra-args" }, "Extra Arguments:"), /* @__PURE__ */ import_react2.default.createElement("input", { type: "text", id: "extra-args", className: "form-control", placeholder: "Enter extra arguments" })), /* @__PURE__ */ import_react2.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react2.default.createElement("label", { htmlFor: "image-name" }, "Container Image:"), /* @__PURE__ */ import_react2.default.createElement("select", { id: "image-name", className: "form-control" }, this.state.imageList.map((image, index) => /* @__PURE__ */ import_react2.default.createElement("option", { key: index, value: image }, image)))), /* @__PURE__ */ import_react2.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react2.default.createElement("label", { htmlFor: "run-in-container" }, "Run in Container:"), /* @__PURE__ */ import_react2.default.createElement("input", { type: "checkbox", id: "run-in-container", className: "form-control" })), /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", className: "btn btn-primary", id: "load-playbooks-btn" }, "Load Playbooks"), /* @__PURE__ */ import_react2.default.createElement("button", { type: "submit", className: "btn btn-primary" }, "Run Playbook")))), /* @__PURE__ */ import_react2.default.createElement(Card, null, /* @__PURE__ */ import_react2.default.createElement(CardTitle, null, "Output"), /* @__PURE__ */ import_react2.default.createElement(CardBody, null, /* @__PURE__ */ import_react2.default.createElement("pre", { id: "output" }))));
+ return /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement(Card, null, /* @__PURE__ */ import_react2.default.createElement(CardTitle, null, "Run Ansible Playbook"), /* @__PURE__ */ import_react2.default.createElement(CardBody, null, /* @__PURE__ */ import_react2.default.createElement("form", { id: "ansible-form" }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react2.default.createElement("label", { htmlFor: "playbook-folder" }, "Playbook Folder:"), /* @__PURE__ */ import_react2.default.createElement("input", { type: "text", id: "playbook-folder", className: "form-control", placeholder: "/opt/playbooks" })), /* @__PURE__ */ import_react2.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react2.default.createElement("label", { htmlFor: "playbook" }, "Select Playbook:"), /* @__PURE__ */ import_react2.default.createElement("select", { id: "playbook", className: "form-control" }, /* @__PURE__ */ import_react2.default.createElement("option", { value: "" }, "Choose a playbook"))), /* @__PURE__ */ import_react2.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react2.default.createElement("label", { htmlFor: "extra-args" }, "Extra Arguments:"), /* @__PURE__ */ import_react2.default.createElement("input", { type: "text", id: "extra-args", className: "form-control", placeholder: "Enter extra arguments" })), /* @__PURE__ */ import_react2.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react2.default.createElement("label", { htmlFor: "image-name" }, "Container Image:"), /* @__PURE__ */ import_react2.default.createElement("select", { id: "image-name", className: "form-control" }, this.state.imageList.map((image, index) => /* @__PURE__ */ import_react2.default.createElement("option", { key: index, value: image }, image)))), /* @__PURE__ */ import_react2.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react2.default.createElement("label", { htmlFor: "run-in-container" }, "Run in Container:"), /* @__PURE__ */ import_react2.default.createElement("input", { type: "checkbox", id: "run-in-container", className: "form-control" })), /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", className: "btn btn-primary", id: "load-playbooks-btn" }, "Load Playbooks"), /* @__PURE__ */ import_react2.default.createElement("button", { type: "submit", className: "btn btn-primary" }, "Run Playbook")))), /* @__PURE__ */ import_react2.default.createElement(Card, null, /* @__PURE__ */ import_react2.default.createElement(CardTitle, null, "Output"), /* @__PURE__ */ import_react2.default.createElement(CardBody, null, /* @__PURE__ */ import_react2.default.createElement("div", { id: "output-container", style: { height: "calc(100vh - 400px)", overflow: "auto" } }, /* @__PURE__ */ import_react2.default.createElement("pre", { id: "output" })))));
}
};
// src/index.js
- document.addEventListener("DOMContentLoaded", function() {
- import_react_dom.default.render(import_react3.default.createElement(Application, {}), document.getElementById("app"));
+ document.addEventListener("DOMContentLoaded", () => {
+ (0, import_client.createRoot)(document.getElementById("app")).render(/* @__PURE__ */ import_react3.default.createElement(Application, null));
});
})();
//# sourceMappingURL=index.js.map