diff --git a/Libraries/Renderer/REVISION b/Libraries/Renderer/REVISION index 188feb01ce3f8f..97d8977a5a38e1 100644 --- a/Libraries/Renderer/REVISION +++ b/Libraries/Renderer/REVISION @@ -1 +1 @@ -e8feb11b62e869804970258fa629922edbfc836b \ No newline at end of file +afcb9cdc9343ddc134b03dcf4d7fbc0810b6002b \ No newline at end of file diff --git a/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 7de2d2c90ac8d7..6bc84b6f4956f5 100644 --- a/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<65d072c3d2937f89a7fadc55450af2f7>> + * @generated SignedSource<> */ 'use strict'; @@ -75,10 +75,10 @@ function printWarning(level, format, args) { if (stack !== "") { format += "%s"; args = args.concat([stack]); - } + } // eslint-disable-next-line react-internal/safe-string-coercion var argsWithFormat = args.map(function(item) { - return "" + item; + return String(item); }); // Careful: RN currently depends on this prefix argsWithFormat.unshift("Warning: " + format); // We intentionally don't use spread (or .apply) directly because it @@ -145,9 +145,15 @@ var invokeGuardedCallbackImpl = invokeGuardedCallbackProd; // when we call document.createEvent(). However this can cause confusing // errors: https://github.com/facebook/create-react-app/issues/3482 // So we preemptively throw with a better message instead. - 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") { + 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." ); } @@ -253,6 +259,7 @@ var invokeGuardedCallbackImpl = invokeGuardedCallbackProd; if (didCall && didError) { if (!didSetError) { // The callback errored, but the error event never fired. + // eslint-disable-next-line react-internal/prod-error-codes error = new Error( "An error was thrown inside one of your components, but React " + "doesn't know what it was. This is likely due to browser " + @@ -264,6 +271,7 @@ var invokeGuardedCallbackImpl = invokeGuardedCallbackProd; "actually an issue with React, please file an issue." ); } else if (isCrossOriginError) { + // eslint-disable-next-line react-internal/prod-error-codes error = new Error( "A cross-origin error was thrown. React doesn't have access to " + "the actual error object in development. " + @@ -376,11 +384,10 @@ function clearCaughtError() { caughtError = null; return error; } 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." + ); } } @@ -537,8 +544,8 @@ function executeDirectDispatch(event) { var dispatchListener = event._dispatchListeners; var dispatchInstance = event._dispatchInstances; - if (!!isArray(dispatchListener)) { - throw Error("executeDirectDispatch(...): Invalid `event`."); + if (isArray(dispatchListener)) { + throw new Error("executeDirectDispatch(...): Invalid `event`."); } event.currentTarget = dispatchListener @@ -559,6 +566,7 @@ function hasDispatches(event) { return !!event._dispatchListeners; } +/* eslint valid-typeof: 0 */ var EVENT_POOL_SIZE = 10; /** * @interface Event @@ -885,7 +893,7 @@ function releasePooledEvent(event) { var EventConstructor = this; if (!(event instanceof EventConstructor)) { - throw Error( + throw new Error( "Trying to release an event instance into a pool of a different type." ); } @@ -994,8 +1002,8 @@ function resetTouchRecord(touchRecord, touch) { function getTouchIdentifier(_ref) { var identifier = _ref.identifier; - if (!(identifier != null)) { - throw Error("Touch object is missing identifier."); + if (identifier == null) { + throw new Error("Touch object is missing identifier."); } { @@ -1153,8 +1161,8 @@ var ResponderTouchHistoryStore = { */ function accumulate(current, next) { - if (!(next != null)) { - throw Error( + if (next == null) { + throw new Error( "accumulate(...): Accumulated items must not be null or undefined." ); } @@ -1189,8 +1197,8 @@ function accumulate(current, next) { */ function accumulateInto(current, next) { - if (!(next != null)) { - throw Error( + if (next == null) { + throw new Error( "accumulateInto(...): Accumulated items must not be null or undefined." ); } @@ -1496,8 +1504,8 @@ function getListener(inst, registrationName) { var listener = props[registrationName]; - if (!(!listener || typeof listener === "function")) { - throw Error( + if (listener && typeof listener !== "function") { + throw new Error( "Expected `" + registrationName + "` listener to be a function, instead got a value of `" + @@ -2079,11 +2087,10 @@ function recomputePluginOrdering() { var pluginModule = namesToPlugins[pluginName]; var pluginIndex = eventPluginOrder.indexOf(pluginName); - if (!(pluginIndex > -1)) { - throw Error( - "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + - pluginName + - "`." + if (pluginIndex <= -1) { + throw new Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in " + + ("the plugin ordering, `" + pluginName + "`.") ); } @@ -2092,10 +2099,9 @@ function recomputePluginOrdering() { } if (!pluginModule.extractEvents) { - throw Error( - "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + - pluginName + - "` does not." + throw new Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` " + + ("method, but `" + pluginName + "` does not.") ); } @@ -2110,7 +2116,7 @@ function recomputePluginOrdering() { eventName ) ) { - throw Error( + throw new Error( "EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + @@ -2131,11 +2137,10 @@ function recomputePluginOrdering() { */ function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { - if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { - throw Error( - "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + - eventName + - "`." + if (eventNameDispatchConfigs.hasOwnProperty(eventName)) { + throw new Error( + "EventPluginRegistry: More than one plugin attempted to publish the same " + + ("event name, `" + eventName + "`.") ); } @@ -2175,11 +2180,10 @@ function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { */ function publishRegistrationName(registrationName, pluginModule, eventName) { - if (!!registrationNameModules[registrationName]) { - throw Error( - "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + - registrationName + - "`." + if (registrationNameModules[registrationName]) { + throw new Error( + "EventPluginRegistry: More than one plugin attempted to publish the same " + + ("registration name, `" + registrationName + "`.") ); } @@ -2226,9 +2230,10 @@ var registrationNameDependencies = {}; */ function injectEventPluginOrder(injectedEventPluginOrder) { - if (!!eventPluginOrder) { - throw Error( - "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + if (eventPluginOrder) { + throw new Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than " + + "once. You are likely trying to load more than one copy of React." ); } // Clone the ordering so it cannot be dynamically mutated. @@ -2259,11 +2264,10 @@ function injectEventPluginsByName(injectedNamesToPlugins) { !namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule ) { - if (!!namesToPlugins[pluginName]) { - throw Error( - "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName + - "`." + if (namesToPlugins[pluginName]) { + throw new Error( + "EventPluginRegistry: Cannot inject two different event plugins " + + ("using the same name, `" + pluginName + "`.") ); } @@ -2294,8 +2298,8 @@ function getListener$1(inst, registrationName) { var listener = props[registrationName]; - if (!(!listener || typeof listener === "function")) { - throw Error( + if (listener && typeof listener !== "function") { + throw new Error( "Expected `" + registrationName + "` listener to be a function, instead got a value of `" + @@ -2443,8 +2447,8 @@ var ReactNativeBridgeEventPlugin = { var bubbleDispatchConfig = customBubblingEventTypes[topLevelType]; var directDispatchConfig = customDirectEventTypes[topLevelType]; - if (!(bubbleDispatchConfig || directDispatchConfig)) { - throw Error( + if (!bubbleDispatchConfig && !directDispatchConfig) { + throw new Error( // $FlowFixMe - Flow doesn't like this string coercion because DOMTopLevelEventType is opaque 'Unsupported top level event type "' + topLevelType + '" dispatched' ); } @@ -2502,7 +2506,7 @@ function getTagFromInstance(inst) { var nativeInstance = inst.stateNode.canonical; if (!nativeInstance._nativeTag) { - throw Error("All native instances should have a tag."); + throw new Error("All native instances should have a tag."); } return nativeInstance; @@ -2849,6 +2853,7 @@ function getComponentNameFromFiber(fiber) { var enablePersistentOffscreenHostContainer = dynamicFlags.enablePersistentOffscreenHostContainer; // The rest of the flags are static for better dead code elimination. +var enableSchedulingProfiler = false; var enableProfilerTimer = true; var enableProfilerCommitHooks = true; var enableLazyElements = false; @@ -2888,41 +2893,41 @@ var DidCapture = 128; var Ref = /* */ - 256; + 512; var Snapshot = /* */ - 512; + 1024; var Passive = /* */ - 1024; + 2048; var Hydrating = /* */ - 2048; + 4096; var HydratingAndUpdate = /* */ Hydrating | Update; var Visibility = /* */ - 4096; + 8192; var StoreConsistency = /* */ - 8192; + 16384; var LifecycleEffectMask = Passive | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) var HostEffectMask = /* */ - 16383; // These are not really side effects, but we still reuse this field. + 32767; // These are not really side effects, but we still reuse this field. var Incomplete = /* */ - 16384; + 32768; var ShouldCapture = /* */ - 32768; + 65536; var ForceUpdateForLegacySuspense = /* */ - 65536; + 131072; // e.g. a fiber uses a passive effect (even if there are no updates on this particular render). // This enables us to defer more work in the unmount case, // since we can defer traversing the tree during layout to look for Passive effects, @@ -2930,22 +2935,22 @@ var ForceUpdateForLegacySuspense = var RefStatic = /* */ - 524288; + 1048576; var LayoutStatic = /* */ - 1048576; + 2097152; var PassiveStatic = /* */ - 2097152; // These flags allow us to traverse to fibers that have effects on mount + 4194304; // These flags allow us to traverse to fibers that have effects on mount // without traversing the entire tree after every commit for // double invoking var MountLayoutDev = /* */ - 4194304; + 8388608; var MountPassiveDev = /* */ - 8388608; // Groups of flags that are used in the commit phase to skip over trees that + 16777216; // Groups of flags that are used in the commit phase to skip over trees that // don't contain effects, by checking subtreeFlags. var BeforeMutationMask = // TODO: Remove Update flag from before mutation phase by re-landing Visibility @@ -3040,8 +3045,8 @@ function isMounted(component) { } 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."); } } @@ -3052,8 +3057,8 @@ function findCurrentFiberUsingSlowPath(fiber) { // If there is no alternate, then we only need to check if it is mounted. 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) { @@ -3115,9 +3120,7 @@ function findCurrentFiberUsingSlowPath(fiber) { } // We should never have an alternate for any mounting node. So the only // way this could possibly happen is if this was unmounted, if at all. - { - 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) { @@ -3177,23 +3180,25 @@ function findCurrentFiberUsingSlowPath(fiber) { } 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 the root is not a host container, we're in a disconnected tree. I.e. // unmounted. - 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) { @@ -3791,9 +3796,10 @@ function runEventsInBatch(events) { forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); - if (!!eventQueue) { - throw Error( - "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + if (eventQueue) { + throw new Error( + "processEventQueue(): Additional events were enqueued while processing " + + "an event queue. Support for this has not yet been implemented." ); } // This would be a good time to rethrow if any of the event handlers threw. @@ -3888,6 +3894,103 @@ var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; var NormalPriority = Scheduler.unstable_NormalPriority; var IdlePriority = Scheduler.unstable_IdlePriority; +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; + +function disabledLog() {} + +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ + } + + disabledDepth++; + } +} +function reenableLogs() { + { + disabledDepth--; + + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + log: Object.assign({}, props, { + value: prevLog + }), + info: Object.assign({}, props, { + value: prevInfo + }), + warn: Object.assign({}, props, { + value: prevWarn + }), + error: Object.assign({}, props, { + value: prevError + }), + group: Object.assign({}, props, { + value: prevGroup + }), + groupCollapsed: Object.assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: Object.assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } + + if (disabledDepth < 0) { + error( + "disabledDepth fell below zero. " + + "This is a bug in React. Please file an issue." + ); + } + } +} + var rendererID = null; var injectedHook = null; var hasLoggedError = false; @@ -4039,6 +4142,15 @@ function onCommitUnmount(fiber) { } } } +function setIsStrictModeForDevtools(newIsStrictMode) { + { + if (newIsStrictMode) { + disableLogs(); + } else { + reenableLogs(); + } + } +} var NoMode = /* */ @@ -4794,28 +4906,28 @@ function lanesToEventPriority(lanes) { return IdleEventPriority; } +// Renderers that don't support mutation // can re-export everything from this module. - function shim() { - { - throw Error( - "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." - ); - } + throw new Error( + "The current renderer does not support mutation. " + + "This error is likely caused by a bug in React. " + + "Please file an issue." + ); } // Mutation (when unsupported) var supportsMutation = false; var commitMount = shim; var clearContainer = shim; +// Renderers that don't support hydration // can re-export everything from this module. - function shim$1() { - { - throw Error( - "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." - ); - } + throw new Error( + "The current renderer does not support hydration. " + + "This error is likely caused by a bug in React. " + + "Please file an issue." + ); } // Hydration (when unsupported) var isSuspenseInstancePending = shim$1; var isSuspenseInstanceFallback = shim$1; @@ -5195,103 +5307,6 @@ function preparePortalMount(portalInstance) { // noop } -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - log: Object.assign({}, props, { - value: prevLog - }), - info: Object.assign({}, props, { - value: prevInfo - }), - warn: Object.assign({}, props, { - value: prevWarn - }), - error: Object.assign({}, props, { - value: prevError - }), - group: Object.assign({}, props, { - value: prevGroup - }), - groupCollapsed: Object.assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: Object.assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error( - "disabledDepth fell below zero. " + - "This is a bug in React. Please file an issue." - ); - } - } -} - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; function describeBuiltInComponentFrame(name, source, ownerFn) { { @@ -5451,6 +5466,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, element) { // This is intentionally an invariant that gets caught. It's the same // behavior as without this statement except with a better message. if (typeof typeSpecs[typeSpecName] !== "function") { + // eslint-disable-next-line react-internal/prod-error-codes var err = Error( (componentName || "React class") + ": " + @@ -5682,9 +5698,10 @@ function popTopLevelContextObject(fiber) { 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." ); } @@ -5723,7 +5740,7 @@ function processChildContext(fiber, type, parentContext) { for (var contextKey in childContext) { if (!(contextKey in childContextTypes)) { - throw Error( + throw new Error( (getComponentNameFromFiber(fiber) || "Unknown") + '.getChildContext(): key "' + contextKey + @@ -5768,8 +5785,9 @@ function invalidateContextProvider(workInProgress, type, didChange) { var instance = workInProgress.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." ); } @@ -5801,9 +5819,10 @@ function findCurrentUnmaskedContext(fiber) { { // Currently this is only used with renderSubtreeIntoContainer; not sure if it // makes sense elsewhere - 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." ); } @@ -5828,11 +5847,10 @@ function findCurrentUnmaskedContext(fiber) { 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." + ); } } @@ -5920,7 +5938,12 @@ function flushSyncCallbacks() { return null; } -var ReactVersion = "18.0.0-e8feb11b6-20210915"; +var ReactVersion = "18.0.0-afcb9cdc9-20211008"; + +function markComponentRenderStopped() {} +function markComponentErrored(fiber, thrownValue, lanes) {} + +function markComponentSuspended(fiber, wakeable, lanes) {} var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; var NoTransition = 0; @@ -6419,6 +6442,105 @@ var ReactStrictModeWarnings = { }; } +/* + * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol + * and Temporal.* types. See https://github.com/facebook/react/pull/22064. + * + * The functions in this module will throw an easier-to-understand, + * easier-to-debug exception with a clear errors message message explaining the + * problem. (Instead of a confusing exception thrown inside the implementation + * of the `value` object). + */ +// $FlowFixMe only called in DEV, so void return is not possible. + +function typeName(value) { + { + // toStringTag is needed for namespaced types like Temporal.Instant + var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; + var type = + (hasToStringTag && value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + return type; + } +} // $FlowFixMe only called in DEV, so void return is not possible. + +function willCoercionThrow(value) { + { + if ( + value !== null && + typeof value === "object" && + value.$$typeof === REACT_OPAQUE_ID_TYPE + ) { + // OpaqueID type is expected to throw, so React will handle it. Not sure if + // it's expected that string coercion will throw, but we'll assume it's OK. + // See https://github.com/facebook/react/issues/20127. + return; + } + + try { + testStringCoercion(value); + return false; + } catch (e) { + return true; + } + } +} + +function testStringCoercion(value) { + // If you ended up here by following an exception call stack, here's what's + // happened: you supplied an object or symbol value to React (as a prop, key, + // DOM attribute, CSS property, string ref, etc.) and when React tried to + // coerce it to a string using `'' + value`, an exception was thrown. + // + // The most common types that will cause this exception are `Symbol` instances + // and Temporal objects like `Temporal.Instant`. But any object that has a + // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this + // exception. (Library authors do this to prevent users from using built-in + // numeric operators like `+` or comparison operators like `>=` because custom + // methods are needed to perform accurate arithmetic or comparison.) + // + // To fix the problem, coerce this object or symbol value to a string before + // passing it to React. The most reliable way is usually `String(value)`. + // + // To find which value is throwing, check the browser or debugger console. + // Before this exception was thrown, there should be `console.error` output + // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the + // problem and how that type was used: key, atrribute, input value prop, etc. + // In most cases, this console output also shows the component and its + // ancestor components where the exception happened. + // + // eslint-disable-next-line react-internal/safe-string-coercion + 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); // throw (to help callers find troubleshooting comments) + } + } +} +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); // throw (to help callers find troubleshooting comments) + } + } +} + function resolveDefaultProps(Component, baseProps) { if (Component && Component.defaultProps) { // Resolve default props. Taken from ReactElement @@ -6683,9 +6805,12 @@ function readContext(context) { }; 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()." ); } // This is the first dependency for this component. Create a new list. @@ -7253,10 +7378,10 @@ function processUpdateQueue(workInProgress, props, instance, renderLanes) { } 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) ); } @@ -7355,11 +7480,14 @@ var didWarnAboutInvalidateContextType; 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); @@ -8439,9 +8567,10 @@ var warnForMissingKey = function(child, returnFiber) {}; 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." ); } @@ -8510,9 +8639,12 @@ function coerceRef(returnFiber, current, element) { 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" ); } @@ -8520,11 +8652,18 @@ function coerceRef(returnFiber, current, element) { } if (!inst) { - throw Error( + throw new Error( "Missing owner for string ref " + mixedRef + - ". This error is likely caused by a bug in React. Please file an issue." + ". This error is likely caused by a " + + "bug in React. Please file an issue." ); + } // Assigning this to a const so Flow knows it won't change in the closure + + var resolvedInst = inst; + + { + checkPropStringCoercion(mixedRef, "ref"); } var stringRef = "" + mixedRef; // Check if previous string ref matches new string ref @@ -8539,11 +8678,11 @@ function coerceRef(returnFiber, current, element) { } var ref = function(value) { - var refs = inst.refs; + var refs = resolvedInst.refs; if (refs === emptyRefsObject) { // This is a lazy pooled frozen object, so we need to initialize. - refs = inst.refs = {}; + refs = resolvedInst.refs = {}; } if (value === null) { @@ -8556,17 +8695,22 @@ function coerceRef(returnFiber, current, element) { ref._stringRef = stringRef; return ref; } else { - if (!(typeof mixedRef === "string")) { - throw Error( + 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( + 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." + ") but no owner was set. This could happen for one of" + + " the following reasons:\n" + + "1. You may be adding a ref to a function component\n" + + "2. You may be adding a ref to a component that was not created inside a component's render method\n" + + "3. You have multiple copies of React loaded\n" + + "See https://reactjs.org/link/refs-must-have-owner for more information." ); } } @@ -8577,16 +8721,15 @@ function coerceRef(returnFiber, current, element) { function throwOnInvalidObjectType(returnFiber, newChild) { var childString = Object.prototype.toString.call(newChild); - - { - throw 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." - ); - } + 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) { @@ -9202,9 +9345,10 @@ function ChildReconciler(shouldTrackSideEffects) { // but using the iterator instead. 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." ); } @@ -9256,8 +9400,8 @@ function ChildReconciler(shouldTrackSideEffects) { 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; @@ -9634,8 +9778,8 @@ function ChildReconciler(shouldTrackSideEffects) { var reconcileChildFibers = ChildReconciler(true); var mountChildFibers = ChildReconciler(false); function cloneChildFibers(current, workInProgress) { - if (!(current === null || workInProgress.child === current.child)) { - throw Error("Resuming work not yet implemented."); + if (current !== null && workInProgress.child !== current.child) { + throw new Error("Resuming work not yet implemented."); } if (workInProgress.child === null) { @@ -9674,9 +9818,10 @@ 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." ); } @@ -9893,21 +10038,19 @@ function prepareToHydrateHostInstance( hostContext ) { { - { - throw Error( - "Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." - ); - } + throw new Error( + "Expected prepareToHydrateHostInstance() to never be called. " + + "This error is likely caused by a bug in React. Please file an issue." + ); } } function prepareToHydrateHostTextInstance(fiber) { { - { - throw Error( - "Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." - ); - } + throw new Error( + "Expected prepareToHydrateHostTextInstance() to never be called. " + + "This error is likely caused by a bug in React. Please file an issue." + ); } var shouldUpdate = hydrateTextInstance(); } @@ -10109,11 +10252,14 @@ function warnOnHookMismatchInDev(currentHookName) { } 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:\n" + + "1. You might have mismatching versions of React and the renderer (such as React DOM)\n" + + "2. You might be breaking the Rules of Hooks\n" + + "3. You might have more than one copy of React in the same app\n" + + "See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." + ); } function areHookInputsEqual(nextDeps, prevDeps) { @@ -10221,9 +10367,10 @@ function renderWithHooks( 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." + if (numberOfReRenders >= RE_RENDER_LIMIT) { + throw new Error( + "Too many re-renders. React limits the number of renders to prevent " + + "an infinite loop." ); } @@ -10289,9 +10436,10 @@ function renderWithHooks( 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." ); } @@ -10413,8 +10561,8 @@ function updateWorkInProgressHook() { currentHook = nextCurrentHook; } else { // Clone from the current hook. - 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; @@ -10470,7 +10618,7 @@ function mountReducer(reducer, initialArg, init) { lastRenderedState: initialState }; hook.queue = queue; - var dispatch = (queue.dispatch = dispatchAction.bind( + var dispatch = (queue.dispatch = dispatchReducerAction.bind( null, currentlyRenderingFiber$1, queue @@ -10482,8 +10630,8 @@ function updateReducer(reducer, initialArg, init) { var hook = updateWorkInProgressHook(); var queue = hook.queue; - if (!(queue !== null)) { - throw Error( + if (queue === null) { + throw new Error( "Should have a queue. This is likely a bug in React. Please file an issue." ); } @@ -10540,7 +10688,7 @@ function updateReducer(reducer, initialArg, init) { var clone = { lane: updateLane, action: update.action, - eagerReducer: update.eagerReducer, + hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }; @@ -10568,16 +10716,16 @@ function updateReducer(reducer, initialArg, init) { // 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; } // Process this update. - if (update.eagerReducer === reducer) { - // If this update was processed eagerly, and its reducer matches the - // current reducer, we can use the eagerly computed state. + if (update.hasEagerState) { + // If this update is a state update (not a reducer) and was processed eagerly, + // we can use the eagerly computed state newState = update.eagerState; } else { var action = update.action; @@ -10635,8 +10783,8 @@ function rerenderReducer(reducer, initialArg, init) { var hook = updateWorkInProgressHook(); var queue = hook.queue; - if (!(queue !== null)) { - throw Error( + if (queue === null) { + throw new Error( "Should have a queue. This is likely a bug in React. Please file an issue." ); } @@ -10756,56 +10904,20 @@ function readFromUnsubscribedMutableSource(root, source, getSnapshot) { // the synchronous retry, it will block interleaved mutations, so we should // get a consistent read. Therefore, the following error should never be // visible to the user. - // - // If it were to become visible to the user, it suggests one of two things: - // a bug in React, or (more likely), a mutation during the render phase that - // caused the second re-render attempt to be different from the first. - // - // We know it's the second case if the logs are currently disabled. So in - // dev, we can present a more accurate error message. - - { - // eslint-disable-next-line react-internal/no-production-logging - if (getIsStrictModeForDevtools()) { - // If getIsStrictModeForDevtools is true, this is the dev-only double render - // This is only reachable if there was a mutation during render. Show a helpful - // error message. - // - // Something interesting to note: because we only double render in - // development, this error will never happen during production. This is - // actually true of all errors that occur during a double render, - // because if the first render had thrown, we would have exited the - // begin phase without double rendering. We should consider suppressing - // any error from a double render (with a warning) to more closely match - // the production behavior. - var componentName = getComponentNameFromFiber( - currentlyRenderingFiber$1 - ); - - { - throw Error( - "A mutable source was mutated while the " + - componentName + - " component was rendering. This is not supported. Move any mutations into event handlers or effects." - ); - } - } - } // We expect this error not to be thrown during the synchronous retry, + // We expect this error not to be thrown during the synchronous retry, // because we blocked interleaved mutations. - { - throw Error( - "Cannot read from mutable source during the current render without tearing. This may be a bug in React. Please file an issue." - ); - } + throw new Error( + "Cannot read from mutable source during the current render without tearing. This may be a bug in React. Please file an issue." + ); } } function useMutableSource(hook, source, getSnapshot, subscribe) { var root = getWorkInProgressRoot(); - if (!(root !== null)) { - throw Error( + if (root === null) { + throw new Error( "Expected a work-in-progress root. This is a bug in React. Please file an issue." ); } @@ -10937,7 +11049,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { lastRenderedReducer: basicStateReducer, lastRenderedState: snapshot }; - newQueue.dispatch = setSnapshot = dispatchAction.bind( + newQueue.dispatch = setSnapshot = dispatchSetState.bind( null, currentlyRenderingFiber$1, newQueue @@ -10969,25 +11081,46 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } -function mountSyncExternalStore(subscribe, getSnapshot) { +function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { var fiber = currentlyRenderingFiber$1; - var hook = mountWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the - // normal rules of React, and only works because store updates are - // always synchronous. - - var nextSnapshot = getSnapshot(); + var hook = mountWorkInProgressHook(); + var nextSnapshot; { - if (!didWarnUncachedGetSnapshot) { - if (nextSnapshot !== getSnapshot()) { - error( - "The result of getSnapshot should be cached to avoid an infinite loop" - ); + nextSnapshot = getSnapshot(); - didWarnUncachedGetSnapshot = true; + { + if (!didWarnUncachedGetSnapshot) { + if (nextSnapshot !== getSnapshot()) { + error( + "The result of getSnapshot should be cached to avoid an infinite loop" + ); + + didWarnUncachedGetSnapshot = true; + } } + } // Unless we're rendering a blocking lane, schedule a consistency check. + // Right before committing, we will walk the tree and check if any of the + // stores were mutated. + // + // We won't do this if we're hydrating server-rendered content, because if + // the content is stale, it's already visible anyway. Instead we'll patch + // it up in a passive effect. + + var root = getWorkInProgressRoot(); + + if (root === null) { + throw new Error( + "Expected a work-in-progress root. This is a bug in React. Please file an issue." + ); } - } + + if (!includesBlockingLane(root, renderLanes)) { + pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); + } + } // Read the current snapshot from the store on every render. This breaks the + // normal rules of React, and only works because store updates are + // always synchronous. hook.memoizedState = nextSnapshot; var inst = { @@ -11010,26 +11143,11 @@ function mountSyncExternalStore(subscribe, getSnapshot) { updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), undefined, null - ); // Unless we're rendering a blocking lane, schedule a consistency check. Right - // before committing, we will walk the tree and check if any of the stores - // were mutated. - - var root = getWorkInProgressRoot(); - - if (!(root !== null)) { - throw Error( - "Expected a work-in-progress root. This is a bug in React. Please file an issue." - ); - } - - if (!includesBlockingLane(root, renderLanes)) { - pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); - } - + ); return nextSnapshot; } -function updateSyncExternalStore(subscribe, getSnapshot) { +function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { var fiber = currentlyRenderingFiber$1; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are @@ -11084,8 +11202,8 @@ function updateSyncExternalStore(subscribe, getSnapshot) { var root = getWorkInProgressRoot(); - if (!(root !== null)) { - throw Error( + if (root === null) { + throw new Error( "Expected a work-in-progress root. This is a bug in React. Please file an issue." ); } @@ -11182,7 +11300,7 @@ function mountState(initialState) { lastRenderedState: initialState }; hook.queue = queue; - var dispatch = (queue.dispatch = dispatchAction.bind( + var dispatch = (queue.dispatch = dispatchSetState.bind( null, currentlyRenderingFiber$1, queue @@ -11646,7 +11764,7 @@ function rerenderOpaqueIdentifier() { return id; } -function dispatchAction(fiber, queue, action) { +function dispatchReducerAction(fiber, queue, action) { { if (typeof arguments[3] === "function") { error( @@ -11657,65 +11775,54 @@ function dispatchAction(fiber, queue, action) { } } - var eventTime = requestEventTime(); var lane = requestUpdateLane(fiber); var update = { lane: lane, action: action, - eagerReducer: null, + hasEagerState: false, eagerState: null, next: null }; - var alternate = fiber.alternate; - - if ( - fiber === currentlyRenderingFiber$1 || - (alternate !== null && alternate === currentlyRenderingFiber$1) - ) { - // This is a render phase update. Stash it in a lazily-created map of - // queue -> linked list of updates. After this render pass, we'll restart - // and apply the stashed updates on top of the work-in-progress hook. - didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true; - var pending = queue.pending; - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; + if (isRenderPhaseUpdate(fiber)) { + enqueueRenderPhaseUpdate(queue, update); } else { - if (isInterleavedUpdate(fiber)) { - var interleaved = queue.interleaved; + enqueueUpdate$1(fiber, queue, update); - if (interleaved === null) { - // This is the first update. Create a circular list. - update.next = update; // At the end of the current render, this queue's interleaved updates will - // be transferred to the pending queue. + var eventTime = requestEventTime(); + var root = scheduleUpdateOnFiber(fiber, lane, eventTime); - pushInterleavedQueue(queue); - } else { - update.next = interleaved.next; - interleaved.next = update; - } + if (root !== null) { + entangleTransitionUpdate(root, queue, lane); + } + } +} - queue.interleaved = update; - } else { - var _pending = queue.pending; +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()." + ); + } + } - if (_pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = _pending.next; - _pending.next = update; - } + var lane = requestUpdateLane(fiber); + var update = { + lane: lane, + action: action, + hasEagerState: false, + eagerState: null, + next: null + }; - queue.pending = update; - } + if (isRenderPhaseUpdate(fiber)) { + enqueueRenderPhaseUpdate(queue, update); + } else { + enqueueUpdate$1(fiber, queue, update); + var alternate = fiber.alternate; if ( fiber.lanes === NoLanes && @@ -11741,44 +11848,108 @@ function dispatchAction(fiber, queue, action) { // time we enter the render phase, then the eager state can be used // without calling the reducer again. - update.eagerReducer = lastRenderedReducer; - update.eagerState = eagerState; + update.hasEagerState = true; + update.eagerState = eagerState; + + if (objectIs(eagerState, currentState)) { + // Fast path. We can bail out without scheduling React to re-render. + // It's still possible that we'll need to rebase this update later, + // if the component re-renders for a different reason and by that + // time the reducer has changed. + return; + } + } catch (error) { + // Suppress the error. It will throw again in the render phase. + } finally { + { + ReactCurrentDispatcher$1.current = prevDispatcher; + } + } + } + } + + var eventTime = requestEventTime(); + var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + + if (root !== null) { + entangleTransitionUpdate(root, queue, lane); + } + } +} + +function isRenderPhaseUpdate(fiber) { + var alternate = fiber.alternate; + return ( + fiber === currentlyRenderingFiber$1 || + (alternate !== null && alternate === currentlyRenderingFiber$1) + ); +} + +function enqueueRenderPhaseUpdate(queue, update) { + // This is a render phase update. Stash it in a lazily-created map of + // queue -> linked list of updates. After this render pass, we'll restart + // and apply the stashed updates on top of the work-in-progress hook. + didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true; + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + queue.pending = update; +} + +function enqueueUpdate$1(fiber, queue, update, lane) { + if (isInterleavedUpdate(fiber)) { + var interleaved = queue.interleaved; + + if (interleaved === null) { + // This is the first update. Create a circular list. + update.next = update; // At the end of the current render, this queue's interleaved updates will + // be transferred to the pending queue. + + pushInterleavedQueue(queue); + } else { + update.next = interleaved.next; + interleaved.next = update; + } + + queue.interleaved = update; + } else { + var pending = queue.pending; - if (objectIs(eagerState, currentState)) { - // Fast path. We can bail out without scheduling React to re-render. - // It's still possible that we'll need to rebase this update later, - // if the component re-renders for a different reason and by that - // time the reducer has changed. - return; - } - } catch (error) { - // Suppress the error. It will throw again in the render phase. - } finally { - { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - } - } + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; } - var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + queue.pending = update; + } +} - if (isTransitionLane(lane) && root !== null) { - var queueLanes = queue.lanes; // If any entangled lanes are no longer pending on the root, then they - // must have finished. We can remove them from the shared queue, which - // represents a superset of the actually pending lanes. In some cases we - // may entangle more than we need to, but that's OK. In fact it's worse if - // we *don't* entangle when we should. +function entangleTransitionUpdate(root, queue, lane) { + if (isTransitionLane(lane)) { + var queueLanes = queue.lanes; // If any entangled lanes are no longer pending on the root, then they + // must have finished. We can remove them from the shared queue, which + // represents a superset of the actually pending lanes. In some cases we + // may entangle more than we need to, but that's OK. In fact it's worse if + // we *don't* entangle when we should. - queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. + queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. - var newQueueLanes = mergeLanes(queueLanes, lane); - queue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if - // the lane finished since the last time we entangled it. So we need to - // entangle it again, just to be sure. + var newQueueLanes = mergeLanes(queueLanes, lane); + queue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if + // the lane finished since the last time we entangled it. So we need to + // entangle it again, just to be sure. - markRootEntangled(root, newQueueLanes); - } + markRootEntangled(root, newQueueLanes); } } @@ -11931,7 +12102,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; mountHookTypesDev(); return mountMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; mountHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot); @@ -12039,7 +12210,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return mountMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; updateHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot); @@ -12147,7 +12318,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); @@ -12255,7 +12426,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); @@ -12378,7 +12549,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; mountHookTypesDev(); return mountMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; warnInvalidHookAccess(); mountHookTypesDev(); @@ -12503,7 +12674,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; warnInvalidHookAccess(); updateHookTypesDev(); @@ -12628,7 +12799,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; warnInvalidHookAccess(); updateHookTypesDev(); @@ -12820,12 +12991,10 @@ function createCapturedValue(value, source) { } if ( - !( - typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog === - "function" - ) + typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog !== + "function" ) { - throw Error( + throw new Error( "Expected ReactFiberErrorDialog.showErrorDialog to be a function." ); } @@ -13011,129 +13180,144 @@ function createClassErrorUpdate(fiber, errorInfo, lane) { return update; } -function attachPingListener(root, wakeable, lanes) { - // Attach a listener to the promise to "ping" the root and retry. But only if - // one does not already exist for the lanes we're currently rendering (which - // acts like a "thread ID" here). - var pingCache = root.pingCache; - var threadIDs; - - if (pingCache === null) { - pingCache = root.pingCache = new PossiblyWeakMap$1(); - threadIDs = new Set(); - pingCache.set(wakeable, threadIDs); - } else { - threadIDs = pingCache.get(wakeable); - - if (threadIDs === undefined) { +function attachWakeableListeners(suspenseBoundary, root, wakeable, lanes) { + // Attach a ping listener + // + // The data might resolve before we have a chance to commit the fallback. Or, + // in the case of a refresh, we'll never commit a fallback. So we need to + // attach a listener now. When it resolves ("pings"), we can decide whether to + // try rendering the tree again. + // + // Only attach a listener if one does not already exist for the lanes + // we're currently rendering (which acts like a "thread ID" here). + // + // We only need to do this in concurrent mode. Legacy Suspense always + // commits fallbacks synchronously, so there are no pings. + if (suspenseBoundary.mode & ConcurrentMode) { + var pingCache = root.pingCache; + var threadIDs; + + if (pingCache === null) { + pingCache = root.pingCache = new PossiblyWeakMap$1(); threadIDs = new Set(); pingCache.set(wakeable, threadIDs); + } else { + threadIDs = pingCache.get(wakeable); + + if (threadIDs === undefined) { + threadIDs = new Set(); + pingCache.set(wakeable, threadIDs); + } } - } - if (!threadIDs.has(lanes)) { - // Memoize using the thread ID to prevent redundant listeners. - threadIDs.add(lanes); - var ping = pingSuspendedRoot.bind(null, root, wakeable, lanes); + if (!threadIDs.has(lanes)) { + // Memoize using the thread ID to prevent redundant listeners. + threadIDs.add(lanes); + var ping = pingSuspendedRoot.bind(null, root, wakeable, lanes); - { - if (isDevToolsPresent) { - // If we have pending work still, restore the original updaters - restorePendingUpdaters(root, lanes); + { + if (isDevToolsPresent) { + // If we have pending work still, restore the original updaters + restorePendingUpdaters(root, lanes); + } } + + wakeable.then(ping, ping); } + } // Retry listener + // + // If the fallback does commit, we need to attach a different type of + // listener. This one schedules an update on the Suspense boundary to turn + // the fallback state off. + // + // Stash the wakeable on the boundary fiber so we can access it in the + // commit phase. + // + // When the wakeable resolves, we'll attempt to render the boundary + // again ("retry"). - wakeable.then(ping, ping); + var wakeables = suspenseBoundary.updateQueue; + + if (wakeables === null) { + var updateQueue = new Set(); + updateQueue.add(wakeable); + suspenseBoundary.updateQueue = updateQueue; + } else { + wakeables.add(wakeable); } } -function throwException( - root, - returnFiber, - sourceFiber, - value, - rootRenderLanes -) { - // The source fiber did not complete. - sourceFiber.flags |= Incomplete; +function resetSuspendedComponent(sourceFiber, rootRenderLanes) { + // A legacy mode Suspense quirk, only relevant to hook components. - { - if (isDevToolsPresent) { - // If we have pending work still, restore the original updaters - restorePendingUpdaters(root, rootRenderLanes); - } - } + var tag = sourceFiber.tag; if ( - value !== null && - typeof value === "object" && - typeof value.then === "function" + (sourceFiber.mode & ConcurrentMode) === NoMode && + (tag === FunctionComponent || + tag === ForwardRef || + tag === SimpleMemoComponent) ) { - var wakeable = value; - // A legacy mode Suspense quirk, only relevant to hook components. - - var tag = sourceFiber.tag; - - if ( - (sourceFiber.mode & ConcurrentMode) === NoMode && - (tag === FunctionComponent || - tag === ForwardRef || - tag === SimpleMemoComponent) - ) { - var currentSource = sourceFiber.alternate; + 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; - } + 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 - ); // Schedule the nearest Suspense to re-render the timed out view. +function markNearestSuspenseBoundaryShouldCapture( + returnFiber, + sourceFiber, + root, + rootRenderLanes +) { + var hasInvisibleParentBoundary = hasSuspenseContext( + suspenseStackCursor.current, + InvisibleParentSuspenseContext + ); + var node = returnFiber; - var _workInProgress = returnFiber; + do { + if ( + node.tag === SuspenseComponent && + shouldCaptureSuspense(node, hasInvisibleParentBoundary) + ) { + // Found the nearest boundary. + var suspenseBoundary = node; // This marks a Suspense boundary so that when we're unwinding the stack, + // it captures the suspended "exception" and does a second (fallback) pass. - do { - if ( - _workInProgress.tag === SuspenseComponent && - shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary) - ) { - // Found the nearest boundary. - // Stash the promise on the boundary fiber. If the boundary times out, we'll - // attach another listener to flip the boundary back to its normal state. - var wakeables = _workInProgress.updateQueue; - - if (wakeables === null) { - var updateQueue = new Set(); - updateQueue.add(wakeable); - _workInProgress.updateQueue = updateQueue; - } else { - wakeables.add(wakeable); - } // If the boundary is in legacy mode, we should *not* - // suspend the commit. Pretend as if the suspended component rendered - // null and keep rendering. In the commit phase, we'll schedule a - // subsequent synchronous update to re-render the Suspense. + if ((suspenseBoundary.mode & ConcurrentMode) === NoMode) { + // Legacy Mode Suspense // - // Note: It doesn't matter whether the component that suspended was - // inside a concurrent mode tree. If the Suspense is outside of it, we - // should *not* suspend the commit. - // - // If the suspense boundary suspended itself suspended, we don't have to - // do this trick because nothing was partially started. We can just - // directly do a second pass over the fallback in this render and - // pretend we meant to render that directly. - - if ( - (_workInProgress.mode & ConcurrentMode) === NoMode && - _workInProgress !== returnFiber - ) { - _workInProgress.flags |= DidCapture; + // If the boundary is in legacy mode, we should *not* + // suspend the commit. Pretend as if the suspended component rendered + // null and keep rendering. When the Suspense boundary completes, + // we'll do a second pass to render the fallback. + if (suspenseBoundary === returnFiber) { + // Special case where we suspended while reconciling the children of + // a Suspense boundary's inner Offscreen wrapper fiber. This happens + // when a React.lazy component is a direct child of a + // Suspense boundary. + // + // Suspense boundaries are implemented as multiple fibers, but they + // are a single conceptual unit. The legacy mode behavior where we + // pretend the suspended fiber committed as `null` won't work, + // because in this case the "suspended" fiber is the inner + // Offscreen wrapper. + // + // Because the contents of the boundary haven't started rendering + // yet (i.e. nothing in the tree has partially rendered) we can + // switch to the regular, concurrent mode behavior: mark the + // boundary with ShouldCapture and enter the unwind phase. + suspenseBoundary.flags |= ShouldCapture; + } else { + suspenseBoundary.flags |= DidCapture; sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete. // But we shouldn't call any lifecycle methods or callbacks. Remove // all lifecycle effect tags. @@ -13144,10 +13328,10 @@ function throwException( // Another legacy Suspense quirk. In persistent mode, if this is the // initial mount, override the props of the host container to hide // its contents. - var currentSuspenseBoundary = _workInProgress.alternate; + var currentSuspenseBoundary = suspenseBoundary.alternate; if (currentSuspenseBoundary === null) { - var offscreenFiber = _workInProgress.child; + var offscreenFiber = suspenseBoundary.child; var offscreenContainer = offscreenFiber.child; if (offscreenContainer !== null) { @@ -13163,9 +13347,9 @@ function throwException( } if (sourceFiber.tag === ClassComponent) { - var _currentSourceFiber = sourceFiber.alternate; + var currentSourceFiber = sourceFiber.alternate; - if (_currentSourceFiber === null) { + if (currentSourceFiber === null) { // This is a new mount. Change the tag so it's not mistaken for a // completed class component. For example, we should not call // componentWillUnmount if it is deleted. @@ -13181,70 +13365,118 @@ function throwException( } // The source fiber did not complete. Mark it with Sync priority to // indicate that it still has pending work. - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); // Exit without suspending. + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); + } - return; - } // Confirmed that the boundary is in a concurrent mode tree. Continue - // with the normal suspend path. - // - // After this we'll use a set of heuristics to determine whether this - // render pass will run to completion or restart or "suspend" the commit. - // The actual logic for this is spread out in different places. - // - // This first principle is that if we're going to suspend when we complete - // a root, then we should also restart if we get an update or ping that - // might unsuspend it, and vice versa. The only reason to suspend is - // because you think you might want to restart before committing. However, - // it doesn't make sense to restart only while in the period we're suspended. - // - // Restarting too aggressively is also not good because it starves out any - // intermediate loading state. So we use heuristics to determine when. - // Suspense Heuristics - // - // If nothing threw a Promise or all the same fallbacks are already showing, - // then don't suspend/restart. - // - // If this is an initial render of a new tree of Suspense boundaries and - // those trigger a fallback, then don't suspend/restart. We want to ensure - // that we can show the initial loading state as quickly as possible. - // - // If we hit a "Delayed" case, such as when we'd switch from content back into - // a fallback, then we should always suspend/restart. Transitions apply - // to this case. If none is defined, JND is used instead. - // - // If we're already showing a fallback and it gets "retried", allowing us to show - // another level, but there's still an inner boundary that would show a fallback, - // then we suspend/restart for 500ms since the last time we showed a fallback - // anywhere in the tree. This effectively throttles progressive loading into a - // consistent train of commits. This also gives us an opportunity to restart to - // get to the completed state slightly earlier. - // - // If there's ambiguity due to batching it's resolved in preference of: - // 1) "delayed", 2) "initial render", 3) "retry". - // - // We want to ensure that a "busy" state doesn't get force committed. We want to - // ensure that new initial loading states can commit as soon as possible. + return suspenseBoundary; + } // Confirmed that the boundary is in a concurrent mode tree. Continue + // with the normal suspend path. + // + // After this we'll use a set of heuristics to determine whether this + // render pass will run to completion or restart or "suspend" the commit. + // The actual logic for this is spread out in different places. + // + // This first principle is that if we're going to suspend when we complete + // a root, then we should also restart if we get an update or ping that + // might unsuspend it, and vice versa. The only reason to suspend is + // because you think you might want to restart before committing. However, + // it doesn't make sense to restart only while in the period we're suspended. + // + // Restarting too aggressively is also not good because it starves out any + // intermediate loading state. So we use heuristics to determine when. + // Suspense Heuristics + // + // If nothing threw a Promise or all the same fallbacks are already showing, + // then don't suspend/restart. + // + // If this is an initial render of a new tree of Suspense boundaries and + // those trigger a fallback, then don't suspend/restart. We want to ensure + // that we can show the initial loading state as quickly as possible. + // + // If we hit a "Delayed" case, such as when we'd switch from content back into + // a fallback, then we should always suspend/restart. Transitions apply + // to this case. If none is defined, JND is used instead. + // + // If we're already showing a fallback and it gets "retried", allowing us to show + // another level, but there's still an inner boundary that would show a fallback, + // then we suspend/restart for 500ms since the last time we showed a fallback + // anywhere in the tree. This effectively throttles progressive loading into a + // consistent train of commits. This also gives us an opportunity to restart to + // get to the completed state slightly earlier. + // + // If there's ambiguity due to batching it's resolved in preference of: + // 1) "delayed", 2) "initial render", 3) "retry". + // + // We want to ensure that a "busy" state doesn't get force committed. We want to + // ensure that new initial loading states can commit as soon as possible. - attachPingListener(root, wakeable, rootRenderLanes); - _workInProgress.flags |= ShouldCapture; // TODO: I think we can remove this, since we now use `DidCapture` in - // the begin phase to prevent an early bailout. + suspenseBoundary.flags |= ShouldCapture; // TODO: I think we can remove this, since we now use `DidCapture` in + // the begin phase to prevent an early bailout. - _workInProgress.lanes = rootRenderLanes; - return; - } // This boundary already captured during this render. Continue to the next - // boundary. + suspenseBoundary.lanes = rootRenderLanes; + return suspenseBoundary; + } // This boundary already captured during this render. Continue to the next + // boundary. - _workInProgress = _workInProgress.return; - } while (_workInProgress !== null); // No boundary was found. Fallthrough to error mode. - // TODO: Use invariant so the message is stripped in prod? + node = node.return; + } while (node !== null); // Could not find a Suspense boundary capable of capturing. - value = new Error( - (getComponentNameFromFiber(sourceFiber) || "A React component") + - " suspended while rendering, but no fallback UI was specified.\n" + - "\n" + - "Add a component higher in the tree to " + - "provide a loading indicator or placeholder to display." + return null; +} + +function throwException( + root, + returnFiber, + sourceFiber, + value, + rootRenderLanes +) { + // The source fiber did not complete. + sourceFiber.flags |= Incomplete; + + { + if (isDevToolsPresent) { + // If we have pending work still, restore the original updaters + restorePendingUpdaters(root, rootRenderLanes); + } + } + + if ( + value !== null && + typeof value === "object" && + typeof value.then === "function" + ) { + // This is a wakeable. The component suspended. + var wakeable = value; + resetSuspendedComponent(sourceFiber); + + var suspenseBoundary = markNearestSuspenseBoundaryShouldCapture( + returnFiber, + sourceFiber, + root, + rootRenderLanes ); + + if (suspenseBoundary !== null) { + attachWakeableListeners( + suspenseBoundary, + root, + wakeable, + rootRenderLanes + ); + return; + } else { + // No boundary was found. Fallthrough to error mode. + // TODO: We should never call getComponentNameFromFiber in production. + // Log a warning or something to prevent us from accidentally bundling it. + value = new Error( + (getComponentNameFromFiber(sourceFiber) || "A React component") + + " suspended while rendering, but no fallback UI was specified.\n" + + "\n" + + "Add a component higher in the tree to " + + "provide a loading indicator or placeholder to display." + ); + } } // We didn't find a boundary that could handle this type of exception. Start // over and traverse parent path again, this time treating the exception // as an error. @@ -13260,10 +13492,8 @@ function throwException( workInProgress.flags |= ShouldCapture; var lane = pickArbitraryLane(rootRenderLanes); workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); - - var _update = createRootErrorUpdate(workInProgress, _errorInfo, lane); - - enqueueCapturedUpdate(workInProgress, _update); + var update = createRootErrorUpdate(workInProgress, _errorInfo, lane); + enqueueCapturedUpdate(workInProgress, update); return; } @@ -13286,13 +13516,13 @@ function throwException( workInProgress.lanes = mergeLanes(workInProgress.lanes, _lane); // Schedule the error boundary to re-render using updated state - var _update2 = createClassErrorUpdate( + var _update = createClassErrorUpdate( workInProgress, errorInfo, _lane ); - enqueueCapturedUpdate(workInProgress, _update2); + enqueueCapturedUpdate(workInProgress, _update); return; } @@ -13863,7 +14093,7 @@ function completeWork(current, workInProgress, renderLanes) { // If we hydrated, then we'll need to schedule an update for // the commit side-effects on the root. markUpdate(workInProgress); - } else if (!fiberRoot.hydrate) { + } else if (!fiberRoot.isDehydrated) { // Schedule an effect to clear this container at the start of the next commit. // This handles the case of React rendering into a container with previous children. // It's also safe to do for updates too, because current.child would only be null @@ -13896,9 +14126,10 @@ function completeWork(current, workInProgress, renderLanes) { } } else { if (!newProps) { - if (!(workInProgress.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 (workInProgress.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." ); } // This can happen when we abort work. @@ -13953,9 +14184,10 @@ function completeWork(current, workInProgress, renderLanes) { updateHostText(current, workInProgress, oldText, newText); } else { if (typeof newText !== "string") { - if (!(workInProgress.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 (workInProgress.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." ); } // This can happen when we abort work. } @@ -14359,13 +14591,12 @@ function completeWork(current, workInProgress, renderLanes) { } } - { - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); - } + throw new Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in " + + "React. Please file an issue." + ); } var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; @@ -15022,7 +15253,8 @@ function updateClassComponent( case true: { workInProgress.flags |= DidCapture; - workInProgress.flags |= ShouldCapture; + workInProgress.flags |= ShouldCapture; // eslint-disable-next-line react-internal/prod-error-codes + var error$1 = new Error("Simulated error coming from DevTools"); var lane = pickArbitraryLane(renderLanes); workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); // Schedule the error boundary to re-render using updated state @@ -15236,9 +15468,11 @@ function updateHostRoot(current, workInProgress, renderLanes) { pushHostRootContext(workInProgress); var updateQueue = workInProgress.updateQueue; - if (!(current !== 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 (current === null || updateQueue === null) { + throw new 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." ); } @@ -15257,7 +15491,7 @@ function updateHostRoot(current, workInProgress, renderLanes) { return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } - if (root.hydrate && enterHydrationState()) { + if (root.isDehydrated && enterHydrationState()) { var child = mountChildFibers( workInProgress, null, @@ -15433,14 +15667,12 @@ function mountLazyComponent( // because the fact that it's a separate type of work is an // implementation detail. - { - throw Error( - "Element type is invalid. Received a promise that resolves to: " + - Component + - ". Lazy element type must resolve to a class or function." + - hint - ); - } + throw new Error( + "Element type is invalid. Received a promise that resolves to: " + + Component + + ". " + + ("Lazy element type must resolve to a class or function." + hint) + ); } function mountIncompleteClassComponent( @@ -16824,6 +17056,7 @@ function remountFiber(current, oldWorkInProgress, newWorkInProgress) { var returnFiber = oldWorkInProgress.return; if (returnFiber === null) { + // eslint-disable-next-line react-internal/prod-error-codes throw new Error("Cannot swap the root fiber."); } // Disconnect from the old current. // It will get deleted. @@ -16842,6 +17075,7 @@ function remountFiber(current, oldWorkInProgress, newWorkInProgress) { var prevSibling = returnFiber.child; if (prevSibling === null) { + // eslint-disable-next-line react-internal/prod-error-codes throw new Error("Expected parent to have a child."); } @@ -16849,6 +17083,7 @@ function remountFiber(current, oldWorkInProgress, newWorkInProgress) { prevSibling = prevSibling.sibling; if (prevSibling === null) { + // eslint-disable-next-line react-internal/prod-error-codes throw new Error("Expected to find the previous sibling."); } } @@ -17318,13 +17553,12 @@ function beginWork(current, workInProgress, renderLanes) { } } - { - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); - } + throw new Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in " + + "React. Please file an issue." + ); } function unwindWork(workInProgress, renderLanes) { @@ -17357,9 +17591,10 @@ function unwindWork(workInProgress, renderLanes) { resetWorkInProgressVersions(); var _flags = workInProgress.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 & DidCapture) !== NoFlags) { + throw new Error( + "The root failed to unmount after an error. This is likely a bug in " + + "React. Please file an issue." ); } @@ -17711,11 +17946,10 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { break; default: { - { - 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." - ); - } + 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." + ); } } @@ -18182,11 +18416,11 @@ function commitLayoutEffectOnFiber( case LegacyHiddenComponent: break; - default: { - 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." + 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." ); - } } } @@ -18498,11 +18732,10 @@ function commitContainer(finishedWork) { } } - { - 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." - ); - } + 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." + ); } function commitDeletion(finishedRoot, current, nearestMountedAncestor) { @@ -19693,8 +19926,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { currentEventTime = NoTimestamp; currentEventTransitionLane = NoLanes; - 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."); } // Flush any pending passive effects before deciding which lanes to work on, // in case they schedule additional work. @@ -19814,8 +20047,8 @@ function recoverFromConcurrentError(root, errorRetryLanes) { executionContext |= RetryAfterError; // If an error occurred during hydration, discard server response and fall // back to client side render. - if (root.hydrate) { - root.hydrate = false; + if (root.isDehydrated) { + root.isDehydrated = false; { errorHydratingContainer(root.containerInfo); @@ -19833,9 +20066,7 @@ function finishConcurrentRender(root, exitStatus, lanes) { switch (exitStatus) { case RootIncomplete: 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."); } // Flow knows about invariant, so it complains if I add a break // statement, but eslint doesn't know about invariant, so it complains @@ -19940,9 +20171,7 @@ function finishConcurrentRender(root, exitStatus, lanes) { } default: { - { - throw Error("Unknown root exit status."); - } + throw new Error("Unknown root exit status."); } } } @@ -20025,8 +20254,8 @@ function performSyncWorkOnRoot(root) { syncNestedUpdateFlag(); } - 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."); } flushPassiveEffects(); @@ -20045,8 +20274,8 @@ function performSyncWorkOnRoot(root) { executionContext |= RetryAfterError; // If an error occurred during hydration, // discard server response and fall back to client side render. - if (root.hydrate) { - root.hydrate = false; + if (root.isDehydrated) { + root.isDehydrated = false; { errorHydratingContainer(root.containerInfo); @@ -20108,7 +20337,7 @@ function batchedUpdates$1(fn, a) { // Warning, this opts-out of checking the function body. // eslint-disable-next-line no-redeclare -function flushSyncWithoutWarningIfAlreadyRendering(fn) { +function flushSync(fn) { // In legacy mode, we flush pending passive effects at the beginning of the // next event, not at the end of the previous one. if ( @@ -20144,22 +20373,6 @@ function flushSyncWithoutWarningIfAlreadyRendering(fn) { flushSyncCallbacks(); } } -} // Overload the definition to the two valid signatures. -// Warning, this opts-out of checking the function body. - -// eslint-disable-next-line no-redeclare -function flushSync(fn) { - { - if ((executionContext & (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 flushSyncWithoutWarningIfAlreadyRendering(fn); } function pushRenderLanes(fiber, lanes) { push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber); @@ -20248,6 +20461,29 @@ function handleError(root, thrownValue) { 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( root, erroredWork.return, @@ -20311,7 +20547,8 @@ function renderDidSuspend() { function renderDidSuspendDelayIfPossible() { if ( workInProgressRootExitStatus === RootIncomplete || - workInProgressRootExitStatus === RootSuspended + workInProgressRootExitStatus === RootSuspended || + workInProgressRootExitStatus === RootErrored ) { workInProgressRootExitStatus = RootSuspendedWithDelay; } // Check if there are updates that we skipped tree that might have unblocked @@ -20333,7 +20570,7 @@ function renderDidSuspendDelayIfPossible() { } } function renderDidError() { - if (workInProgressRootExitStatus !== RootCompleted) { + if (workInProgressRootExitStatus !== RootSuspendedWithDelay) { workInProgressRootExitStatus = RootErrored; } } // Called during render to determine if anything has suspended. @@ -20386,11 +20623,10 @@ function renderRootSync(root, lanes) { if (workInProgress !== null) { // This is a sync render, so we should have finished the whole tree. - { - 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." + ); } workInProgressRoot = null; @@ -20614,8 +20850,8 @@ function commitRootImpl(root, renderPriorityLevel) { 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 = root.finishedWork; @@ -20637,9 +20873,10 @@ function commitRootImpl(root, renderPriorityLevel) { root.finishedWork = null; root.finishedLanes = NoLanes; - if (!(finishedWork !== root.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 === root.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." ); } // commitRoot never returns a continuation; it always finishes synchronously. // So we can clear these now to allow a new callback to be scheduled. @@ -20881,8 +21118,8 @@ function flushPassiveEffectsImpl() { 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."); } var prevExecutionContext = executionContext; @@ -21128,12 +21365,12 @@ function checkForNestedUpdates() { 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." + ); } { @@ -21339,7 +21576,7 @@ var beginWork$1; originalError._suppressLogging = true; } } // We always throw the original error in case the second render pass is not idempotent. - // This can happen if a memoized function or CommonJS module doesn't throw after first invokation. + // This can happen if a memoized function or CommonJS module doesn't throw after first invocation. throw originalError; } @@ -21448,6 +21685,7 @@ function shouldForceFlushFallbacksInDEV() { return ReactCurrentActQueue.current !== null; } +/* eslint-disable react-internal/prod-error-codes */ var resolveFamily = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below. var failedBoundaries = null; @@ -22341,14 +22579,11 @@ function createFiberFromTypeAndProps( } } - { - 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) + ); } } } @@ -22530,7 +22765,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.timeoutHandle = noTimeout; this.context = null; this.pendingContext = null; - this.hydrate = hydrate; + this.isDehydrated = hydrate; this.callbackNode = null; this.callbackPriority = NoLane; this.eventTimes = createLaneMap(NoLanes); @@ -22561,11 +22796,11 @@ function FiberRootNode(containerInfo, tag, hydrate) { { switch (tag) { case ConcurrentRoot: - this._debugRootType = "createRoot()"; + this._debugRootType = hydrate ? "hydrateRoot()" : "createRoot()"; break; case LegacyRoot: - this._debugRootType = "createLegacyRoot()"; + this._debugRootType = hydrate ? "hydrate()" : "render()"; break; } } @@ -22608,6 +22843,11 @@ function createPortal( ) { var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; + + { + checkKeyStringCoercion(key); + } + return { // This tag allow us to uniquely identify this as a React Portal $$typeof: REACT_PORTAL_TYPE, @@ -22651,16 +22891,12 @@ function findHostInstanceWithWarning(component, methodName) { if (fiber === undefined) { 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 + ); } } @@ -22829,7 +23065,6 @@ var shouldSuspendImpl = function(fiber) { function shouldSuspend(fiber) { return shouldSuspendImpl(fiber); } -var isStrictMode = false; var overrideHookState = null; var overrideHookStateDeletePath = null; var overrideHookStateRenamePath = null; @@ -23052,20 +23287,6 @@ function getCurrentFiberForDevTools() { return current; } -function getIsStrictModeForDevtools() { - return isStrictMode; -} -function setIsStrictModeForDevtools(newIsStrictMode) { - isStrictMode = newIsStrictMode; - - { - if (newIsStrictMode) { - disableLogs(); - } else { - reenableLogs(); - } - } -} function injectIntoDevTools(devToolsConfig) { var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; @@ -23094,7 +23315,6 @@ function injectIntoDevTools(devToolsConfig) { setRefreshHandler: setRefreshHandler, // Enables DevTools to append owner stacks to error messages in DEV mode. getCurrentFiber: getCurrentFiberForDevTools, - getIsStrictMode: getIsStrictModeForDevtools, // Enables DevTools to detect reconciler version rather than renderer version // which may not match for third party renderers. reconcilerVersion: ReactVersion diff --git a/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index 6a8a0754f006e1..73b6f5eb765f6e 100644 --- a/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<4538b6a9895755454ebc3d0f7b8f568e>> + * @generated SignedSource<<0641813b146d4710c4029f156d65891e>> */ "use strict"; @@ -783,18 +783,16 @@ function recomputePluginOrdering() { for (var pluginName in namesToPlugins) { var pluginModule = namesToPlugins[pluginName], pluginIndex = eventPluginOrder.indexOf(pluginName); - if (!(-1 < pluginIndex)) + if (-1 >= pluginIndex) throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + - pluginName + - "`." + (pluginName + "`.") ); if (!plugins[pluginIndex]) { if (!pluginModule.extractEvents) throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + - pluginName + - "` does not." + (pluginName + "` does not.") ); plugins[pluginIndex] = pluginModule; pluginIndex = pluginModule.eventTypes; @@ -805,8 +803,7 @@ function recomputePluginOrdering() { if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0)) throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + - eventName$jscomp$0 + - "`." + (eventName$jscomp$0 + "`.") ); eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig; var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; @@ -846,8 +843,7 @@ function publishRegistrationName(registrationName, pluginModule) { if (registrationNameModules[registrationName]) throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + - registrationName + - "`." + (registrationName + "`.") ); registrationNameModules[registrationName] = pluginModule; } @@ -931,7 +927,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_222 = { +var injectedNamesToPlugins$jscomp$inline_219 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -966,34 +962,33 @@ var injectedNamesToPlugins$jscomp$inline_222 = { } } }, - isOrderingDirty$jscomp$inline_223 = !1, - pluginName$jscomp$inline_224; -for (pluginName$jscomp$inline_224 in injectedNamesToPlugins$jscomp$inline_222) + isOrderingDirty$jscomp$inline_220 = !1, + pluginName$jscomp$inline_221; +for (pluginName$jscomp$inline_221 in injectedNamesToPlugins$jscomp$inline_219) if ( - injectedNamesToPlugins$jscomp$inline_222.hasOwnProperty( - pluginName$jscomp$inline_224 + injectedNamesToPlugins$jscomp$inline_219.hasOwnProperty( + pluginName$jscomp$inline_221 ) ) { - var pluginModule$jscomp$inline_225 = - injectedNamesToPlugins$jscomp$inline_222[pluginName$jscomp$inline_224]; + var pluginModule$jscomp$inline_222 = + injectedNamesToPlugins$jscomp$inline_219[pluginName$jscomp$inline_221]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_224) || - namesToPlugins[pluginName$jscomp$inline_224] !== - pluginModule$jscomp$inline_225 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_221) || + namesToPlugins[pluginName$jscomp$inline_221] !== + pluginModule$jscomp$inline_222 ) { - if (namesToPlugins[pluginName$jscomp$inline_224]) + if (namesToPlugins[pluginName$jscomp$inline_221]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName$jscomp$inline_224 + - "`." + (pluginName$jscomp$inline_221 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_224 - ] = pluginModule$jscomp$inline_225; - isOrderingDirty$jscomp$inline_223 = !0; + pluginName$jscomp$inline_221 + ] = pluginModule$jscomp$inline_222; + isOrderingDirty$jscomp$inline_220 = !0; } } -isOrderingDirty$jscomp$inline_223 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_220 && recomputePluginOrdering(); function getInstanceFromInstance(instanceHandle) { return instanceHandle; } @@ -1192,7 +1187,7 @@ function getNearestMountedFiber(fiber) { fiber = node; do (node = fiber), - 0 !== (node.flags & 2050) && (nearestMounted = node.return), + 0 !== (node.flags & 4098) && (nearestMounted = node.return), (fiber = node.return); while (fiber); } @@ -2405,7 +2400,7 @@ function processUpdateQueue( newState = workInProgress; break a; case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 128; + workInProgress.flags = (workInProgress.flags & -65537) | 128; case 0: workInProgress = update.payload; updateLane = @@ -2658,7 +2653,8 @@ function coerceRef(returnFiber, current, element) { returnFiber + ". This error is likely caused by a bug in React. Please file an issue." ); - var stringRef = "" + returnFiber; + var resolvedInst = inst, + stringRef = "" + returnFiber; if ( null !== current && null !== current.ref && @@ -2667,8 +2663,8 @@ function coerceRef(returnFiber, current, element) { ) return current.ref; current = function(value) { - var refs = inst.refs; - refs === emptyRefsObject && (refs = inst.refs = {}); + var refs = resolvedInst.refs; + refs === emptyRefsObject && (refs = resolvedInst.refs = {}); null === value ? delete refs[stringRef] : (refs[stringRef] = value); }; current._stringRef = stringRef; @@ -3367,7 +3363,7 @@ function renderWithHooks( nextRenderLanes = 0; do { didScheduleRenderPhaseUpdateDuringThisPass = !1; - if (!(25 > nextRenderLanes)) + if (25 <= nextRenderLanes) throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." ); @@ -3468,19 +3464,18 @@ function updateReducer(reducer) { (newBaseQueueLast = newBaseQueueLast.next = { lane: 0, action: update.action, - eagerReducer: update.eagerReducer, + hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }), - (current = - update.eagerReducer === reducer - ? update.eagerState - : reducer(current, update.action)); + (current = update.hasEagerState + ? update.eagerState + : reducer(current, update.action)); else { var clone = { lane: updateLane, action: update.action, - eagerReducer: update.eagerReducer, + hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }; @@ -3620,7 +3615,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { lastRenderedReducer: basicStateReducer, lastRenderedState: snapshot }), - (hook.dispatch = setSnapshot = dispatchAction.bind( + (hook.dispatch = setSnapshot = dispatchSetState.bind( null, currentlyRenderingFiber$1, hook @@ -3637,30 +3632,30 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot) { var fiber = currentlyRenderingFiber$1, - hook = mountWorkInProgressHook(), - nextSnapshot = getSnapshot(); + hook = mountWorkInProgressHook(); + var nextSnapshot = getSnapshot(); + var root = workInProgressRoot; + if (null === root) + throw Error( + "Expected a work-in-progress root. This is a bug in React. Please file an issue." + ); + includesBlockingLane(root, renderLanes) || + pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); hook.memoizedState = nextSnapshot; - var inst = { value: nextSnapshot, getSnapshot: getSnapshot }; - hook.queue = inst; - mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]); - fiber.flags |= 1024; + root = { value: nextSnapshot, getSnapshot: getSnapshot }; + hook.queue = root; + mountEffect(subscribeToStore.bind(null, fiber, root, subscribe), [subscribe]); + fiber.flags |= 2048; pushEffect( 9, - updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), + updateStoreInstance.bind(null, fiber, root, nextSnapshot, getSnapshot), void 0, null ); - subscribe = workInProgressRoot; - if (null === subscribe) - throw Error( - "Expected a work-in-progress root. This is a bug in React. Please file an issue." - ); - includesBlockingLane(subscribe, renderLanes) || - pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); return nextSnapshot; } function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { - fiber.flags |= 8192; + fiber.flags |= 16384; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; getSnapshot = currentlyRenderingFiber$1.updateQueue; null === getSnapshot @@ -3705,7 +3700,7 @@ function mountState(initialState) { lastRenderedState: initialState }; hook.queue = initialState; - initialState = initialState.dispatch = dispatchAction.bind( + initialState = initialState.dispatch = dispatchSetState.bind( null, currentlyRenderingFiber$1, initialState @@ -3757,10 +3752,10 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { - return mountEffectImpl(2098176, 8, create, deps); + return mountEffectImpl(4196352, 8, create, deps); } function updateEffect(create, deps) { - return updateEffectImpl(1024, 8, create, deps); + return updateEffectImpl(2048, 8, create, deps); } function updateInsertionEffect(create, deps) { return updateEffectImpl(4, 2, create, deps); @@ -3837,47 +3832,35 @@ function startTransition(setPending, callback) { (ReactCurrentBatchConfig$1.transition = prevTransition); } } -function dispatchAction(fiber, queue, action) { - var eventTime = requestEventTime(), - lane = requestUpdateLane(fiber), +function dispatchReducerAction(fiber, queue, action) { + var lane = requestUpdateLane(fiber); + action = { + lane: lane, + action: action, + hasEagerState: !1, + eagerState: null, + next: null + }; + isRenderPhaseUpdate(fiber) + ? enqueueRenderPhaseUpdate(queue, action) + : (enqueueUpdate$1(fiber, queue, action), + (action = requestEventTime()), + (fiber = scheduleUpdateOnFiber(fiber, lane, action)), + null !== fiber && entangleTransitionUpdate(fiber, queue, lane)); +} +function dispatchSetState(fiber, queue, action) { + var lane = requestUpdateLane(fiber), update = { lane: lane, action: action, - eagerReducer: null, + hasEagerState: !1, eagerState: null, next: null - }, - alternate = fiber.alternate; - if ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) - ) - (didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0), - (lane = queue.pending), - null === lane - ? (update.next = update) - : ((update.next = lane.next), (lane.next = update)), - (queue.pending = update); + }; + if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update); else { - if ( - null !== workInProgressRoot && - 0 !== (fiber.mode & 1) && - 0 === (executionContext & 2) - ) { - var interleaved = queue.interleaved; - null === interleaved - ? ((update.next = update), - null === interleavedQueues - ? (interleavedQueues = [queue]) - : interleavedQueues.push(queue)) - : ((update.next = interleaved.next), (interleaved.next = update)); - queue.interleaved = update; - } else - (interleaved = queue.pending), - null === interleaved - ? (update.next = update) - : ((update.next = interleaved.next), (interleaved.next = update)), - (queue.pending = update); + enqueueUpdate$1(fiber, queue, update); + var alternate = fiber.alternate; if ( 0 === fiber.lanes && (null === alternate || 0 === alternate.lanes) && @@ -3886,20 +3869,57 @@ function dispatchAction(fiber, queue, action) { try { var currentState = queue.lastRenderedState, eagerState = alternate(currentState, action); - update.eagerReducer = alternate; + update.hasEagerState = !0; update.eagerState = eagerState; if (objectIs(eagerState, currentState)) return; } catch (error) { } finally { } - update = scheduleUpdateOnFiber(fiber, lane, eventTime); - 0 !== (lane & 4194240) && - null !== update && - ((fiber = queue.lanes), - (fiber &= update.pendingLanes), - (lane |= fiber), - (queue.lanes = lane), - markRootEntangled(update, lane)); + action = requestEventTime(); + fiber = scheduleUpdateOnFiber(fiber, lane, action); + null !== fiber && entangleTransitionUpdate(fiber, queue, lane); + } +} +function isRenderPhaseUpdate(fiber) { + var alternate = fiber.alternate; + return ( + fiber === currentlyRenderingFiber$1 || + (null !== alternate && alternate === currentlyRenderingFiber$1) + ); +} +function enqueueRenderPhaseUpdate(queue, update) { + didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0; + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; +} +function enqueueUpdate$1(fiber, queue, update) { + null !== workInProgressRoot && + 0 !== (fiber.mode & 1) && + 0 === (executionContext & 2) + ? ((fiber = queue.interleaved), + null === fiber + ? ((update.next = update), + null === interleavedQueues + ? (interleavedQueues = [queue]) + : interleavedQueues.push(queue)) + : ((update.next = fiber.next), (fiber.next = update)), + (queue.interleaved = update)) + : ((fiber = queue.pending), + null === fiber + ? (update.next = update) + : ((update.next = fiber.next), (fiber.next = update)), + (queue.pending = update)); +} +function entangleTransitionUpdate(root, queue, lane) { + if (0 !== (lane & 4194240)) { + var queueLanes = queue.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + queue.lanes = lane; + markRootEntangled(root, lane); } } var ContextOnlyDispatcher = { @@ -3968,7 +3988,7 @@ var ContextOnlyDispatcher = { lastRenderedState: initialArg }; hook.queue = reducer; - reducer = reducer.dispatch = dispatchAction.bind( + reducer = reducer.dispatch = dispatchReducerAction.bind( null, currentlyRenderingFiber$1, reducer @@ -4078,7 +4098,7 @@ var ContextOnlyDispatcher = { (null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1) ) { - fiber.flags |= 1024; + fiber.flags |= 2048; pushEffect( 9, updateStoreInstance.bind( @@ -4231,7 +4251,7 @@ function hadNoMutationsEffects(current, completedWork) { if (null !== current && current.child === completedWork.child) return !0; if (0 !== (completedWork.flags & 16)) return !1; for (current = completedWork.child; null !== current; ) { - if (0 !== (current.flags & 6454) || 0 !== (current.subtreeFlags & 6454)) + if (0 !== (current.flags & 12854) || 0 !== (current.subtreeFlags & 12854)) return !1; current = current.sibling; } @@ -4395,14 +4415,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$38 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$38 = lastTailNode), + for (var lastTailNode$35 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$35 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$38 + null === lastTailNode$35 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$38.sibling = null); + : (lastTailNode$35.sibling = null); } } function bubbleProperties(completedWork) { @@ -4412,19 +4432,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$39 = completedWork.child; null !== child$39; ) - (newChildLanes |= child$39.lanes | child$39.childLanes), - (subtreeFlags |= child$39.subtreeFlags & 3670016), - (subtreeFlags |= child$39.flags & 3670016), - (child$39.return = completedWork), - (child$39 = child$39.sibling); + for (var child$36 = completedWork.child; null !== child$36; ) + (newChildLanes |= child$36.lanes | child$36.childLanes), + (subtreeFlags |= child$36.subtreeFlags & 7340032), + (subtreeFlags |= child$36.flags & 7340032), + (child$36.return = completedWork), + (child$36 = child$36.sibling); else - for (child$39 = completedWork.child; null !== child$39; ) - (newChildLanes |= child$39.lanes | child$39.childLanes), - (subtreeFlags |= child$39.subtreeFlags), - (subtreeFlags |= child$39.flags), - (child$39.return = completedWork), - (child$39 = child$39.sibling); + for (child$36 = completedWork.child; null !== child$36; ) + (newChildLanes |= child$36.lanes | child$36.childLanes), + (subtreeFlags |= child$36.subtreeFlags), + (subtreeFlags |= child$36.flags), + (child$36.return = completedWork), + (child$36 = child$36.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -4451,7 +4471,7 @@ function completeSuspendedOffscreenHostContainer(current, workInProgress) { )), appendAllChildren(rootContainerInstance, workInProgress, !1, !1), (workInProgress.stateNode = rootContainerInstance), - null !== workInProgress.ref && (workInProgress.flags |= 256)); + null !== workInProgress.ref && (workInProgress.flags |= 512)); bubbleProperties(workInProgress); } function completeWork(current, workInProgress, renderLanes) { @@ -4485,8 +4505,8 @@ function completeWork(current, workInProgress, renderLanes) { ((newProps.context = newProps.pendingContext), (newProps.pendingContext = null)), (null !== current && null !== current.child) || - newProps.hydrate || - (workInProgress.flags |= 512), + newProps.isDehydrated || + (workInProgress.flags |= 1024), updateHostContainer(current, workInProgress), bubbleProperties(workInProgress), null @@ -4503,7 +4523,7 @@ function completeWork(current, workInProgress, renderLanes) { newProps, renderLanes ), - current.ref !== workInProgress.ref && (workInProgress.flags |= 256); + current.ref !== workInProgress.ref && (workInProgress.flags |= 512); else { if (!newProps) { if (null === workInProgress.stateNode) @@ -4523,7 +4543,7 @@ function completeWork(current, workInProgress, renderLanes) { ); appendAllChildren(current, workInProgress, !1, !1); workInProgress.stateNode = current; - null !== workInProgress.ref && (workInProgress.flags |= 256); + null !== workInProgress.ref && (workInProgress.flags |= 512); } bubbleProperties(workInProgress); return null; @@ -4561,7 +4581,7 @@ function completeWork(current, workInProgress, renderLanes) { if ( null !== newProps && !renderLanes && - ((workInProgress.child.flags |= 4096), 0 !== (workInProgress.mode & 1)) + ((workInProgress.child.flags |= 8192), 0 !== (workInProgress.mode & 1)) ) if ( (null === current && @@ -4573,7 +4593,8 @@ function completeWork(current, workInProgress, renderLanes) { else { if ( 0 === workInProgressRootExitStatus || - 3 === workInProgressRootExitStatus + 3 === workInProgressRootExitStatus || + 2 === workInProgressRootExitStatus ) workInProgressRootExitStatus = 4; null === workInProgressRoot || @@ -4633,7 +4654,7 @@ function completeWork(current, workInProgress, renderLanes) { for (newProps = workInProgress.child; null !== newProps; ) (renderLanes = newProps), (type = current), - (renderLanes.flags &= 3670018), + (renderLanes.flags &= 7340034), (renderedTail = renderLanes.alternate), null === renderedTail ? ((renderLanes.childLanes = 0), @@ -4737,7 +4758,7 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current.memoizedState) !== renderLanes && "unstable-defer-without-hiding" !== newProps.mode && 23 !== workInProgress.tag && - (workInProgress.flags |= 4096), + (workInProgress.flags |= 8192), renderLanes && 0 !== (workInProgress.mode & 1) ? 0 !== (subtreeRenderLanes & 1073741824) && bubbleProperties(workInProgress) @@ -4785,7 +4806,7 @@ function updateForwardRef( if (null !== current && !didReceiveUpdate) return ( (workInProgress.updateQueue = current.updateQueue), - (workInProgress.flags &= -1029), + (workInProgress.flags &= -2053), (current.lanes &= ~renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); @@ -4859,7 +4880,7 @@ function updateSimpleMemoComponent( current.ref === workInProgress.ref ) if (((didReceiveUpdate = !1), 0 !== (current.lanes & renderLanes))) - 0 !== (current.flags & 65536) && (didReceiveUpdate = !0); + 0 !== (current.flags & 131072) && (didReceiveUpdate = !0); else return ( (workInProgress.lanes = current.lanes), @@ -4962,7 +4983,7 @@ function markRef$1(current, workInProgress) { (null === current && null !== ref) || (null !== current && current.ref !== ref) ) - workInProgress.flags |= 256; + workInProgress.flags |= 512; } function updateFunctionComponent( current, @@ -4987,7 +5008,7 @@ function updateFunctionComponent( if (null !== current && !didReceiveUpdate) return ( (workInProgress.updateQueue = current.updateQueue), - (workInProgress.flags &= -1029), + (workInProgress.flags &= -2053), (current.lanes &= ~renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); @@ -5163,7 +5184,7 @@ function updateClassComponent( "function" === typeof instance.componentDidUpdate && (workInProgress.flags |= 4), "function" === typeof instance.getSnapshotBeforeUpdate && - (workInProgress.flags |= 512)) + (workInProgress.flags |= 1024)) : ("function" !== typeof instance.componentDidUpdate || (oldProps === current.memoizedProps && oldState === current.memoizedState) || @@ -5171,7 +5192,7 @@ function updateClassComponent( "function" !== typeof instance.getSnapshotBeforeUpdate || (oldProps === current.memoizedProps && oldState === current.memoizedState) || - (workInProgress.flags |= 512), + (workInProgress.flags |= 1024), (workInProgress.memoizedProps = nextProps), (workInProgress.memoizedState = newState)), (instance.props = nextProps), @@ -5185,7 +5206,7 @@ function updateClassComponent( "function" !== typeof instance.getSnapshotBeforeUpdate || (oldProps === current.memoizedProps && oldState === current.memoizedState) || - (workInProgress.flags |= 512), + (workInProgress.flags |= 1024), (nextProps = !1)); } return finishClassComponent( @@ -5474,7 +5495,7 @@ function updateSuspenseFallbackChildren( primaryChildren ))), (current.subtreeFlags = - currentPrimaryChildFragment.subtreeFlags & 3670016)); + currentPrimaryChildFragment.subtreeFlags & 7340032)); null !== currentFallbackChildFragment ? (fallbackChildren = createWorkInProgress( currentFallbackChildFragment, @@ -5702,8 +5723,8 @@ function unwindWork(workInProgress) { case 1: isContextProvider(workInProgress.type) && popContext(); var flags = workInProgress.flags; - return flags & 32768 - ? ((workInProgress.flags = (flags & -32769) | 128), workInProgress) + return flags & 65536 + ? ((workInProgress.flags = (flags & -65537) | 128), workInProgress) : null; case 3: popHostContainer(); @@ -5715,7 +5736,7 @@ function unwindWork(workInProgress) { throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." ); - workInProgress.flags = (flags & -32769) | 128; + workInProgress.flags = (flags & -65537) | 128; return workInProgress; case 5: return popHostContext(workInProgress), null; @@ -5723,8 +5744,8 @@ function unwindWork(workInProgress) { return ( pop(suspenseStackCursor), (flags = workInProgress.flags), - flags & 32768 - ? ((workInProgress.flags = (flags & -32769) | 128), workInProgress) + flags & 65536 + ? ((workInProgress.flags = (flags & -65537) | 128), workInProgress) : null ); case 19: @@ -5761,7 +5782,7 @@ function commitBeforeMutationEffects(root, firstChild) { if ( ((root = nextEffect), (firstChild = root.child), - 0 !== (root.subtreeFlags & 516) && null !== firstChild) + 0 !== (root.subtreeFlags & 1028) && null !== firstChild) ) (firstChild.return = root), (nextEffect = firstChild); else @@ -5769,7 +5790,7 @@ function commitBeforeMutationEffects(root, firstChild) { root = nextEffect; try { var current = root.alternate; - if (0 !== (root.flags & 512)) + if (0 !== (root.flags & 1024)) switch (root.tag) { case 0: case 11: @@ -5850,8 +5871,8 @@ function commitHookEffectListMount(tag, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & tag) === tag) { - var create$83 = effect.create; - effect.destroy = create$83(); + var create$80 = effect.create; + effect.destroy = create$80(); } effect = effect.next; } while (effect !== finishedWork); @@ -6018,14 +6039,14 @@ function commitMutationEffects(root, firstChild) { } } firstChild = root.child; - if (0 !== (root.subtreeFlags & 6454) && null !== firstChild) + if (0 !== (root.subtreeFlags & 12854) && null !== firstChild) (firstChild.return = root), (nextEffect = firstChild); else for (; null !== nextEffect; ) { root = nextEffect; try { var flags = root.flags; - if (flags & 256) { + if (flags & 512) { var current$jscomp$0 = root.alternate; if (null !== current$jscomp$0) { var currentRef = current$jscomp$0.ref; @@ -6035,16 +6056,16 @@ function commitMutationEffects(root, firstChild) { : (currentRef.current = null)); } } - if (flags & 4096) + if (flags & 8192) switch (root.tag) { case 13: if (null !== root.memoizedState) { - var current$87 = root.alternate; - if (null === current$87 || null === current$87.memoizedState) + var current$84 = root.alternate; + if (null === current$84 || null === current$84.memoizedState) globalMostRecentFallbackTime = now(); } } - switch (flags & 2054) { + switch (flags & 4102) { case 2: root.flags &= -3; break; @@ -6052,11 +6073,11 @@ function commitMutationEffects(root, firstChild) { root.flags &= -3; commitWork(root.alternate, root); break; - case 2048: - root.flags &= -2049; + case 4096: + root.flags &= -4097; break; - case 2052: - root.flags &= -2049; + case 4100: + root.flags &= -4097; commitWork(root.alternate, root); break; case 4: @@ -6079,15 +6100,15 @@ function commitLayoutEffects(finishedWork) { for (nextEffect = finishedWork; null !== nextEffect; ) { var fiber = nextEffect, firstChild = fiber.child; - if (0 !== (fiber.subtreeFlags & 4420) && null !== firstChild) + if (0 !== (fiber.subtreeFlags & 8772) && null !== firstChild) (firstChild.return = fiber), (nextEffect = firstChild); else for (fiber = finishedWork; null !== nextEffect; ) { firstChild = nextEffect; - if (0 !== (firstChild.flags & 4420)) { + if (0 !== (firstChild.flags & 8772)) { var current = firstChild.alternate; try { - if (0 !== (firstChild.flags & 4420)) + if (0 !== (firstChild.flags & 8772)) switch (firstChild.tag) { case 0: case 11: @@ -6117,8 +6138,8 @@ function commitLayoutEffects(finishedWork) { commitUpdateQueue(firstChild, updateQueue, instance); break; case 3: - var updateQueue$84 = firstChild.updateQueue; - if (null !== updateQueue$84) { + var updateQueue$81 = firstChild.updateQueue; + if (null !== updateQueue$81) { current = null; if (null !== firstChild.child) switch (firstChild.child.tag) { @@ -6128,7 +6149,7 @@ function commitLayoutEffects(finishedWork) { case 1: current = firstChild.child.stateNode; } - commitUpdateQueue(firstChild, updateQueue$84, current); + commitUpdateQueue(firstChild, updateQueue$81, current); } break; case 5: @@ -6153,7 +6174,7 @@ function commitLayoutEffects(finishedWork) { "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); } - if (firstChild.flags & 256) { + if (firstChild.flags & 512) { current = void 0; var ref = firstChild.ref; if (null !== ref) { @@ -6516,14 +6537,14 @@ function performConcurrentWorkOnRoot(root, didTimeout) { function recoverFromConcurrentError(root, errorRetryLanes) { var prevExecutionContext = executionContext; executionContext |= 8; - root.hydrate && ((root.hydrate = !1), shim(root.containerInfo)); + root.isDehydrated && ((root.isDehydrated = !1), shim(root.containerInfo)); root = renderRootSync(root, errorRetryLanes); executionContext = prevExecutionContext; return root; } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { - if (node.flags & 8192) { + if (node.flags & 16384) { var updateQueue = node.updateQueue; if ( null !== updateQueue && @@ -6541,7 +6562,7 @@ function isRenderConsistentWithExternalStores(finishedWork) { } } updateQueue = node.child; - if (node.subtreeFlags & 8192 && null !== updateQueue) + if (node.subtreeFlags & 16384 && null !== updateQueue) (updateQueue.return = node), (node = updateQueue); else { if (node === finishedWork) break; @@ -6577,7 +6598,7 @@ function performSyncWorkOnRoot(root) { if (0 !== root.tag && 2 === exitStatus) { var prevExecutionContext = executionContext; executionContext |= 8; - root.hydrate && ((root.hydrate = !1), shim(root.containerInfo)); + root.isDehydrated && ((root.isDehydrated = !1), shim(root.containerInfo)); var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); 0 !== errorRetryLanes && ((lanes = errorRetryLanes), (exitStatus = renderRootSync(root, lanes))); @@ -6702,85 +6723,97 @@ function handleError(root$jscomp$0, thrownValue) { sourceFiber = erroredWork, value = thrownValue; thrownValue = workInProgressRootRenderLanes; - sourceFiber.flags |= 16384; + sourceFiber.flags |= 32768; if ( null !== value && "object" === typeof value && "function" === typeof value.then ) { var wakeable = value, - tag = sourceFiber.tag; + sourceFiber$jscomp$0 = sourceFiber, + tag = sourceFiber$jscomp$0.tag; if ( - 0 === (sourceFiber.mode & 1) && + 0 === (sourceFiber$jscomp$0.mode & 1) && (0 === tag || 11 === tag || 15 === tag) ) { - var currentSource = sourceFiber.alternate; + var currentSource = sourceFiber$jscomp$0.alternate; currentSource - ? ((sourceFiber.updateQueue = currentSource.updateQueue), - (sourceFiber.memoizedState = currentSource.memoizedState), - (sourceFiber.lanes = currentSource.lanes)) - : ((sourceFiber.updateQueue = null), - (sourceFiber.memoizedState = null)); + ? ((sourceFiber$jscomp$0.updateQueue = currentSource.updateQueue), + (sourceFiber$jscomp$0.memoizedState = + currentSource.memoizedState), + (sourceFiber$jscomp$0.lanes = currentSource.lanes)) + : ((sourceFiber$jscomp$0.updateQueue = null), + (sourceFiber$jscomp$0.memoizedState = null)); } - var hasInvisibleParentBoundary = - 0 !== (suspenseStackCursor.current & 1), - workInProgress$30 = returnFiber; - do { - var JSCompiler_temp; - if ((JSCompiler_temp = 13 === workInProgress$30.tag)) { - var nextState = workInProgress$30.memoizedState; - JSCompiler_temp = - null !== nextState - ? null !== nextState.dehydrated + b: { + sourceFiber$jscomp$0 = returnFiber; + var sourceFiber$jscomp$1 = sourceFiber, + rootRenderLanes = thrownValue, + hasInvisibleParentBoundary = + 0 !== (suspenseStackCursor.current & 1), + node = sourceFiber$jscomp$0; + do { + var JSCompiler_temp; + if ((JSCompiler_temp = 13 === node.tag)) { + var nextState = node.memoizedState; + JSCompiler_temp = + null !== nextState + ? null !== nextState.dehydrated + ? !0 + : !1 + : !0 !== node.memoizedProps.unstable_avoidThisFallback ? !0 - : !1 - : !0 !== - workInProgress$30.memoizedProps.unstable_avoidThisFallback - ? !0 - : hasInvisibleParentBoundary - ? !1 - : !0; - } - if (JSCompiler_temp) { - var wakeables = workInProgress$30.updateQueue; - if (null === wakeables) { - var updateQueue = new Set(); - updateQueue.add(wakeable); - workInProgress$30.updateQueue = updateQueue; - } else wakeables.add(wakeable); - if ( - 0 === (workInProgress$30.mode & 1) && - workInProgress$30 !== returnFiber - ) { - workInProgress$30.flags |= 128; - sourceFiber.flags |= 65536; - sourceFiber.flags &= -26437; - if ( - enablePersistentOffscreenHostContainer && - null === workInProgress$30.alternate - ) { - var offscreenContainer = workInProgress$30.child.child; - if (null !== offscreenContainer) { - var containerProps = getOffscreenContainerProps( - "hidden", - offscreenContainer.memoizedProps.children - ); - offscreenContainer.pendingProps = containerProps; - offscreenContainer.memoizedProps = containerProps; - } - } - if (1 === sourceFiber.tag) - if (null === sourceFiber.alternate) sourceFiber.tag = 17; + : hasInvisibleParentBoundary + ? !1 + : !0; + } + if (JSCompiler_temp) { + if (0 === (node.mode & 1)) { + if (node === sourceFiber$jscomp$0) node.flags |= 65536; else { - var update = createUpdate(-1, 1); - update.tag = 2; - enqueueUpdate(sourceFiber, update); + node.flags |= 128; + sourceFiber$jscomp$1.flags |= 131072; + sourceFiber$jscomp$1.flags &= -52805; + if ( + enablePersistentOffscreenHostContainer && + null === node.alternate + ) { + var offscreenContainer = node.child.child; + if (null !== offscreenContainer) { + var containerProps = getOffscreenContainerProps( + "hidden", + offscreenContainer.memoizedProps.children + ); + offscreenContainer.pendingProps = containerProps; + offscreenContainer.memoizedProps = containerProps; + } + } + if (1 === sourceFiber$jscomp$1.tag) + if (null === sourceFiber$jscomp$1.alternate) + sourceFiber$jscomp$1.tag = 17; + else { + var update = createUpdate(-1, 1); + update.tag = 2; + enqueueUpdate(sourceFiber$jscomp$1, update); + } + sourceFiber$jscomp$1.lanes |= 1; } - sourceFiber.lanes |= 1; - break a; + var suspenseBoundary = node; + break b; + } + node.flags |= 65536; + node.lanes = rootRenderLanes; + suspenseBoundary = node; + break b; } - value = void 0; - sourceFiber = thrownValue; + node = node.return; + } while (null !== node); + suspenseBoundary = null; + } + if (null !== suspenseBoundary) { + value = void 0; + sourceFiber = suspenseBoundary; + if (sourceFiber.mode & 1) { var pingCache = root.pingCache; null === pingCache ? ((pingCache = root.pingCache = new PossiblyWeakMap()), @@ -6789,71 +6822,74 @@ function handleError(root$jscomp$0, thrownValue) { : ((value = pingCache.get(wakeable)), void 0 === value && ((value = new Set()), pingCache.set(wakeable, value))); - if (!value.has(sourceFiber)) { - value.add(sourceFiber); + if (!value.has(thrownValue)) { + value.add(thrownValue); var ping = pingSuspendedRoot.bind( null, root, wakeable, - sourceFiber + thrownValue ); wakeable.then(ping, ping); } - workInProgress$30.flags |= 32768; - workInProgress$30.lanes = thrownValue; - break a; } - workInProgress$30 = workInProgress$30.return; - } while (null !== workInProgress$30); - value = Error( - (getComponentNameFromFiber(sourceFiber) || "A React component") + - " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." - ); + var wakeables = sourceFiber.updateQueue; + if (null === wakeables) { + var updateQueue = new Set(); + updateQueue.add(wakeable); + sourceFiber.updateQueue = updateQueue; + } else wakeables.add(wakeable); + break a; + } else + value = Error( + (getComponentNameFromFiber(sourceFiber) || "A React component") + + " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." + ); } - 5 !== workInProgressRootExitStatus && + 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); value = createCapturedValue(value, sourceFiber); - workInProgress$30 = returnFiber; + root = returnFiber; do { - switch (workInProgress$30.tag) { + switch (root.tag) { case 3: - root = value; - workInProgress$30.flags |= 32768; + wakeable = value; + root.flags |= 65536; thrownValue &= -thrownValue; - workInProgress$30.lanes |= thrownValue; - var update$31 = createRootErrorUpdate( - workInProgress$30, + root.lanes |= thrownValue; + var update$jscomp$0 = createRootErrorUpdate( root, + wakeable, thrownValue ); - enqueueCapturedUpdate(workInProgress$30, update$31); + enqueueCapturedUpdate(root, update$jscomp$0); break a; case 1: - root = value; - var ctor = workInProgress$30.type, - instance = workInProgress$30.stateNode; + wakeable = value; + var ctor = root.type, + instance = root.stateNode; if ( - 0 === (workInProgress$30.flags & 128) && + 0 === (root.flags & 128) && ("function" === typeof ctor.getDerivedStateFromError || (null !== instance && "function" === typeof instance.componentDidCatch && (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(instance)))) ) { - workInProgress$30.flags |= 32768; + root.flags |= 65536; thrownValue &= -thrownValue; - workInProgress$30.lanes |= thrownValue; - var update$34 = createClassErrorUpdate( - workInProgress$30, + root.lanes |= thrownValue; + var update$31 = createClassErrorUpdate( root, + wakeable, thrownValue ); - enqueueCapturedUpdate(workInProgress$30, update$34); + enqueueCapturedUpdate(root, update$31); break a; } } - workInProgress$30 = workInProgress$30.return; - } while (null !== workInProgress$30); + root = root.return; + } while (null !== root); } completeUnitOfWork(erroredWork); } catch (yetAnotherThrownValue) { @@ -6914,7 +6950,7 @@ function completeUnitOfWork(unitOfWork) { do { var current = completedWork.alternate; unitOfWork = completedWork.return; - if (0 === (completedWork.flags & 16384)) { + if (0 === (completedWork.flags & 32768)) { if ( ((current = completeWork(current, completedWork, subtreeRenderLanes)), null !== current) @@ -6925,12 +6961,12 @@ function completeUnitOfWork(unitOfWork) { } else { current = unwindWork(completedWork); if (null !== current) { - current.flags &= 16383; + current.flags &= 32767; workInProgress = current; return; } null !== unitOfWork && - ((unitOfWork.flags |= 16384), + ((unitOfWork.flags |= 32768), (unitOfWork.subtreeFlags = 0), (unitOfWork.deletions = null)); } @@ -6977,16 +7013,16 @@ function commitRootImpl(root, renderPriorityLevel) { root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); - (0 === (finishedWork.subtreeFlags & 1040) && - 0 === (finishedWork.flags & 1040)) || + (0 === (finishedWork.subtreeFlags & 2064) && + 0 === (finishedWork.flags & 2064)) || rootDoesHavePassiveEffects || ((rootDoesHavePassiveEffects = !0), scheduleCallback$1(NormalPriority, function() { flushPassiveEffects(); return null; })); - remainingLanes = 0 !== (finishedWork.flags & 8054); - if (0 !== (finishedWork.subtreeFlags & 8054) || remainingLanes) { + remainingLanes = 0 !== (finishedWork.flags & 15990); + if (0 !== (finishedWork.subtreeFlags & 15990) || remainingLanes) { remainingLanes = ReactCurrentBatchConfig$2.transition; ReactCurrentBatchConfig$2.transition = 0; var previousPriority = currentUpdatePriority; @@ -7100,12 +7136,12 @@ function flushPassiveEffects() { nextEffect = fiber; } } - if (0 !== (fiber.subtreeFlags & 1040) && null !== child) + if (0 !== (fiber.subtreeFlags & 2064) && null !== child) (child.return = fiber), (nextEffect = child); else b: for (; null !== nextEffect; ) { fiber = nextEffect; - if (0 !== (fiber.flags & 1024)) + if (0 !== (fiber.flags & 2048)) switch (fiber.tag) { case 0: case 11: @@ -7125,12 +7161,12 @@ function flushPassiveEffects() { for (nextEffect = finishedWork; null !== nextEffect; ) { child = nextEffect; var firstChild = child.child; - if (0 !== (child.subtreeFlags & 1040) && null !== firstChild) + if (0 !== (child.subtreeFlags & 2064) && null !== firstChild) (firstChild.return = child), (nextEffect = firstChild); else b: for (child = finishedWork; null !== nextEffect; ) { deletions = nextEffect; - if (0 !== (deletions.flags & 1024)) + if (0 !== (deletions.flags & 2048)) try { switch (deletions.tag) { case 0: @@ -7282,7 +7318,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { renderLanes ) ); - didReceiveUpdate = 0 !== (current.flags & 65536) ? !0 : !1; + didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; } else didReceiveUpdate = !1; workInProgress.lanes = 0; @@ -7748,7 +7784,7 @@ function createWorkInProgress(current, pendingProps) { (workInProgress.flags = 0), (workInProgress.subtreeFlags = 0), (workInProgress.deletions = null)); - workInProgress.flags = current.flags & 3670016; + workInProgress.flags = current.flags & 7340032; workInProgress.childLanes = current.childLanes; workInProgress.lanes = current.lanes; workInProgress.child = current.child; @@ -7841,8 +7877,7 @@ function createFiberFromTypeAndProps( } throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + - (null == type ? type : typeof type) + - "." + ((null == type ? type : typeof type) + ".") ); } key = createFiber(fiberTag, pendingProps, key, mode); @@ -7895,7 +7930,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.finishedWork = this.pingCache = this.current = this.pendingChildren = null; this.timeoutHandle = -1; this.pendingContext = this.context = null; - this.hydrate = hydrate; + this.isDehydrated = hydrate; this.callbackNode = null; this.callbackPriority = 0; this.eventTimes = createLaneMap(0); @@ -7919,9 +7954,9 @@ function findHostInstance(component) { if (void 0 === fiber) { if ("function" === typeof component.render) throw Error("Unable to find node on an unmounted component."); + component = Object.keys(component).join(","); throw Error( - "Argument appears to not be a ReactComponent. Keys: " + - Object.keys(component) + "Argument appears to not be a ReactComponent. Keys: " + component ); } component = findCurrentHostFiber(fiber); @@ -8105,10 +8140,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_950 = { + devToolsConfig$jscomp$inline_935 = { findFiberByHostInstance: getInstanceFromInstance, bundleType: 0, - version: "18.0.0-e8feb11b6-20210915", + version: "18.0.0-afcb9cdc9-20211008", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8123,11 +8158,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1191 = { - bundleType: devToolsConfig$jscomp$inline_950.bundleType, - version: devToolsConfig$jscomp$inline_950.version, - rendererPackageName: devToolsConfig$jscomp$inline_950.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_950.rendererConfig, +var internals$jscomp$inline_1189 = { + bundleType: devToolsConfig$jscomp$inline_935.bundleType, + version: devToolsConfig$jscomp$inline_935.version, + rendererPackageName: devToolsConfig$jscomp$inline_935.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_935.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8143,27 +8178,26 @@ var internals$jscomp$inline_1191 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_950.findFiberByHostInstance || + devToolsConfig$jscomp$inline_935.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - getIsStrictMode: null, - reconcilerVersion: "18.0.0-e8feb11b6-20210915" + reconcilerVersion: "18.0.0-afcb9cdc9-20211008" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1192 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1190 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1192.isDisabled && - hook$jscomp$inline_1192.supportsFiber + !hook$jscomp$inline_1190.isDisabled && + hook$jscomp$inline_1190.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1192.inject( - internals$jscomp$inline_1191 + (rendererID = hook$jscomp$inline_1190.inject( + internals$jscomp$inline_1189 )), - (injectedHook = hook$jscomp$inline_1192); + (injectedHook = hook$jscomp$inline_1190); } catch (err) {} } exports.createPortal = function(children, containerTag) { diff --git a/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index 1277c286d3296e..1950c8517f1eaf 100644 --- a/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<9613963109b67072417dfb9843578a9d>> + * @generated SignedSource<<62430ecbf70b848b8677c9a80f79d347>> */ "use strict"; @@ -783,18 +783,16 @@ function recomputePluginOrdering() { for (var pluginName in namesToPlugins) { var pluginModule = namesToPlugins[pluginName], pluginIndex = eventPluginOrder.indexOf(pluginName); - if (!(-1 < pluginIndex)) + if (-1 >= pluginIndex) throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + - pluginName + - "`." + (pluginName + "`.") ); if (!plugins[pluginIndex]) { if (!pluginModule.extractEvents) throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + - pluginName + - "` does not." + (pluginName + "` does not.") ); plugins[pluginIndex] = pluginModule; pluginIndex = pluginModule.eventTypes; @@ -805,8 +803,7 @@ function recomputePluginOrdering() { if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0)) throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + - eventName$jscomp$0 + - "`." + (eventName$jscomp$0 + "`.") ); eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig; var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; @@ -846,8 +843,7 @@ function publishRegistrationName(registrationName, pluginModule) { if (registrationNameModules[registrationName]) throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + - registrationName + - "`." + (registrationName + "`.") ); registrationNameModules[registrationName] = pluginModule; } @@ -931,7 +927,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_230 = { +var injectedNamesToPlugins$jscomp$inline_227 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -966,34 +962,33 @@ var injectedNamesToPlugins$jscomp$inline_230 = { } } }, - isOrderingDirty$jscomp$inline_231 = !1, - pluginName$jscomp$inline_232; -for (pluginName$jscomp$inline_232 in injectedNamesToPlugins$jscomp$inline_230) + isOrderingDirty$jscomp$inline_228 = !1, + pluginName$jscomp$inline_229; +for (pluginName$jscomp$inline_229 in injectedNamesToPlugins$jscomp$inline_227) if ( - injectedNamesToPlugins$jscomp$inline_230.hasOwnProperty( - pluginName$jscomp$inline_232 + injectedNamesToPlugins$jscomp$inline_227.hasOwnProperty( + pluginName$jscomp$inline_229 ) ) { - var pluginModule$jscomp$inline_233 = - injectedNamesToPlugins$jscomp$inline_230[pluginName$jscomp$inline_232]; + var pluginModule$jscomp$inline_230 = + injectedNamesToPlugins$jscomp$inline_227[pluginName$jscomp$inline_229]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_232) || - namesToPlugins[pluginName$jscomp$inline_232] !== - pluginModule$jscomp$inline_233 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_229) || + namesToPlugins[pluginName$jscomp$inline_229] !== + pluginModule$jscomp$inline_230 ) { - if (namesToPlugins[pluginName$jscomp$inline_232]) + if (namesToPlugins[pluginName$jscomp$inline_229]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName$jscomp$inline_232 + - "`." + (pluginName$jscomp$inline_229 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_232 - ] = pluginModule$jscomp$inline_233; - isOrderingDirty$jscomp$inline_231 = !0; + pluginName$jscomp$inline_229 + ] = pluginModule$jscomp$inline_230; + isOrderingDirty$jscomp$inline_228 = !0; } } -isOrderingDirty$jscomp$inline_231 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_228 && recomputePluginOrdering(); function getInstanceFromInstance(instanceHandle) { return instanceHandle; } @@ -1192,7 +1187,7 @@ function getNearestMountedFiber(fiber) { fiber = node; do (node = fiber), - 0 !== (node.flags & 2050) && (nearestMounted = node.return), + 0 !== (node.flags & 4098) && (nearestMounted = node.return), (fiber = node.return); while (fiber); } @@ -2453,7 +2448,7 @@ function processUpdateQueue( newState = workInProgress; break a; case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 128; + workInProgress.flags = (workInProgress.flags & -65537) | 128; case 0: workInProgress = update.payload; updateLane = @@ -2706,7 +2701,8 @@ function coerceRef(returnFiber, current, element) { returnFiber + ". This error is likely caused by a bug in React. Please file an issue." ); - var stringRef = "" + returnFiber; + var resolvedInst = inst, + stringRef = "" + returnFiber; if ( null !== current && null !== current.ref && @@ -2715,8 +2711,8 @@ function coerceRef(returnFiber, current, element) { ) return current.ref; current = function(value) { - var refs = inst.refs; - refs === emptyRefsObject && (refs = inst.refs = {}); + var refs = resolvedInst.refs; + refs === emptyRefsObject && (refs = resolvedInst.refs = {}); null === value ? delete refs[stringRef] : (refs[stringRef] = value); }; current._stringRef = stringRef; @@ -3415,7 +3411,7 @@ function renderWithHooks( nextRenderLanes = 0; do { didScheduleRenderPhaseUpdateDuringThisPass = !1; - if (!(25 > nextRenderLanes)) + if (25 <= nextRenderLanes) throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." ); @@ -3516,19 +3512,18 @@ function updateReducer(reducer) { (newBaseQueueLast = newBaseQueueLast.next = { lane: 0, action: update.action, - eagerReducer: update.eagerReducer, + hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }), - (current = - update.eagerReducer === reducer - ? update.eagerState - : reducer(current, update.action)); + (current = update.hasEagerState + ? update.eagerState + : reducer(current, update.action)); else { var clone = { lane: updateLane, action: update.action, - eagerReducer: update.eagerReducer, + hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }; @@ -3668,7 +3663,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { lastRenderedReducer: basicStateReducer, lastRenderedState: snapshot }), - (hook.dispatch = setSnapshot = dispatchAction.bind( + (hook.dispatch = setSnapshot = dispatchSetState.bind( null, currentlyRenderingFiber$1, hook @@ -3685,30 +3680,30 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot) { var fiber = currentlyRenderingFiber$1, - hook = mountWorkInProgressHook(), - nextSnapshot = getSnapshot(); + hook = mountWorkInProgressHook(); + var nextSnapshot = getSnapshot(); + var root = workInProgressRoot; + if (null === root) + throw Error( + "Expected a work-in-progress root. This is a bug in React. Please file an issue." + ); + includesBlockingLane(root, renderLanes) || + pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); hook.memoizedState = nextSnapshot; - var inst = { value: nextSnapshot, getSnapshot: getSnapshot }; - hook.queue = inst; - mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]); - fiber.flags |= 1024; + root = { value: nextSnapshot, getSnapshot: getSnapshot }; + hook.queue = root; + mountEffect(subscribeToStore.bind(null, fiber, root, subscribe), [subscribe]); + fiber.flags |= 2048; pushEffect( 9, - updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), + updateStoreInstance.bind(null, fiber, root, nextSnapshot, getSnapshot), void 0, null ); - subscribe = workInProgressRoot; - if (null === subscribe) - throw Error( - "Expected a work-in-progress root. This is a bug in React. Please file an issue." - ); - includesBlockingLane(subscribe, renderLanes) || - pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); return nextSnapshot; } function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { - fiber.flags |= 8192; + fiber.flags |= 16384; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; getSnapshot = currentlyRenderingFiber$1.updateQueue; null === getSnapshot @@ -3753,7 +3748,7 @@ function mountState(initialState) { lastRenderedState: initialState }; hook.queue = initialState; - initialState = initialState.dispatch = dispatchAction.bind( + initialState = initialState.dispatch = dispatchSetState.bind( null, currentlyRenderingFiber$1, initialState @@ -3805,10 +3800,10 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { - return mountEffectImpl(2098176, 8, create, deps); + return mountEffectImpl(4196352, 8, create, deps); } function updateEffect(create, deps) { - return updateEffectImpl(1024, 8, create, deps); + return updateEffectImpl(2048, 8, create, deps); } function updateInsertionEffect(create, deps) { return updateEffectImpl(4, 2, create, deps); @@ -3885,47 +3880,35 @@ function startTransition(setPending, callback) { (ReactCurrentBatchConfig$1.transition = prevTransition); } } -function dispatchAction(fiber, queue, action) { - var eventTime = requestEventTime(), - lane = requestUpdateLane(fiber), +function dispatchReducerAction(fiber, queue, action) { + var lane = requestUpdateLane(fiber); + action = { + lane: lane, + action: action, + hasEagerState: !1, + eagerState: null, + next: null + }; + isRenderPhaseUpdate(fiber) + ? enqueueRenderPhaseUpdate(queue, action) + : (enqueueUpdate$1(fiber, queue, action), + (action = requestEventTime()), + (fiber = scheduleUpdateOnFiber(fiber, lane, action)), + null !== fiber && entangleTransitionUpdate(fiber, queue, lane)); +} +function dispatchSetState(fiber, queue, action) { + var lane = requestUpdateLane(fiber), update = { lane: lane, action: action, - eagerReducer: null, + hasEagerState: !1, eagerState: null, next: null - }, - alternate = fiber.alternate; - if ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) - ) - (didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0), - (lane = queue.pending), - null === lane - ? (update.next = update) - : ((update.next = lane.next), (lane.next = update)), - (queue.pending = update); + }; + if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update); else { - if ( - null !== workInProgressRoot && - 0 !== (fiber.mode & 1) && - 0 === (executionContext & 2) - ) { - var interleaved = queue.interleaved; - null === interleaved - ? ((update.next = update), - null === interleavedQueues - ? (interleavedQueues = [queue]) - : interleavedQueues.push(queue)) - : ((update.next = interleaved.next), (interleaved.next = update)); - queue.interleaved = update; - } else - (interleaved = queue.pending), - null === interleaved - ? (update.next = update) - : ((update.next = interleaved.next), (interleaved.next = update)), - (queue.pending = update); + enqueueUpdate$1(fiber, queue, update); + var alternate = fiber.alternate; if ( 0 === fiber.lanes && (null === alternate || 0 === alternate.lanes) && @@ -3934,20 +3917,57 @@ function dispatchAction(fiber, queue, action) { try { var currentState = queue.lastRenderedState, eagerState = alternate(currentState, action); - update.eagerReducer = alternate; + update.hasEagerState = !0; update.eagerState = eagerState; if (objectIs(eagerState, currentState)) return; } catch (error) { } finally { } - update = scheduleUpdateOnFiber(fiber, lane, eventTime); - 0 !== (lane & 4194240) && - null !== update && - ((fiber = queue.lanes), - (fiber &= update.pendingLanes), - (lane |= fiber), - (queue.lanes = lane), - markRootEntangled(update, lane)); + action = requestEventTime(); + fiber = scheduleUpdateOnFiber(fiber, lane, action); + null !== fiber && entangleTransitionUpdate(fiber, queue, lane); + } +} +function isRenderPhaseUpdate(fiber) { + var alternate = fiber.alternate; + return ( + fiber === currentlyRenderingFiber$1 || + (null !== alternate && alternate === currentlyRenderingFiber$1) + ); +} +function enqueueRenderPhaseUpdate(queue, update) { + didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0; + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; +} +function enqueueUpdate$1(fiber, queue, update) { + null !== workInProgressRoot && + 0 !== (fiber.mode & 1) && + 0 === (executionContext & 2) + ? ((fiber = queue.interleaved), + null === fiber + ? ((update.next = update), + null === interleavedQueues + ? (interleavedQueues = [queue]) + : interleavedQueues.push(queue)) + : ((update.next = fiber.next), (fiber.next = update)), + (queue.interleaved = update)) + : ((fiber = queue.pending), + null === fiber + ? (update.next = update) + : ((update.next = fiber.next), (fiber.next = update)), + (queue.pending = update)); +} +function entangleTransitionUpdate(root, queue, lane) { + if (0 !== (lane & 4194240)) { + var queueLanes = queue.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + queue.lanes = lane; + markRootEntangled(root, lane); } } var ContextOnlyDispatcher = { @@ -4016,7 +4036,7 @@ var ContextOnlyDispatcher = { lastRenderedState: initialArg }; hook.queue = reducer; - reducer = reducer.dispatch = dispatchAction.bind( + reducer = reducer.dispatch = dispatchReducerAction.bind( null, currentlyRenderingFiber$1, reducer @@ -4126,7 +4146,7 @@ var ContextOnlyDispatcher = { (null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1) ) { - fiber.flags |= 1024; + fiber.flags |= 2048; pushEffect( 9, updateStoreInstance.bind( @@ -4337,7 +4357,7 @@ function hadNoMutationsEffects(current, completedWork) { if (null !== current && current.child === completedWork.child) return !0; if (0 !== (completedWork.flags & 16)) return !1; for (current = completedWork.child; null !== current; ) { - if (0 !== (current.flags & 6454) || 0 !== (current.subtreeFlags & 6454)) + if (0 !== (current.flags & 12854) || 0 !== (current.subtreeFlags & 12854)) return !1; current = current.sibling; } @@ -4501,14 +4521,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$40 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$40 = lastTailNode), + for (var lastTailNode$37 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$37 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$40 + null === lastTailNode$37 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$40.sibling = null); + : (lastTailNode$37.sibling = null); } } function bubbleProperties(completedWork) { @@ -4520,53 +4540,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$42 = completedWork.selfBaseDuration, - child$43 = completedWork.child; - null !== child$43; + var treeBaseDuration$39 = completedWork.selfBaseDuration, + child$40 = completedWork.child; + null !== child$40; ) - (newChildLanes |= child$43.lanes | child$43.childLanes), - (subtreeFlags |= child$43.subtreeFlags & 3670016), - (subtreeFlags |= child$43.flags & 3670016), - (treeBaseDuration$42 += child$43.treeBaseDuration), - (child$43 = child$43.sibling); - completedWork.treeBaseDuration = treeBaseDuration$42; + (newChildLanes |= child$40.lanes | child$40.childLanes), + (subtreeFlags |= child$40.subtreeFlags & 7340032), + (subtreeFlags |= child$40.flags & 7340032), + (treeBaseDuration$39 += child$40.treeBaseDuration), + (child$40 = child$40.sibling); + completedWork.treeBaseDuration = treeBaseDuration$39; } else for ( - treeBaseDuration$42 = completedWork.child; - null !== treeBaseDuration$42; + treeBaseDuration$39 = completedWork.child; + null !== treeBaseDuration$39; ) (newChildLanes |= - treeBaseDuration$42.lanes | treeBaseDuration$42.childLanes), - (subtreeFlags |= treeBaseDuration$42.subtreeFlags & 3670016), - (subtreeFlags |= treeBaseDuration$42.flags & 3670016), - (treeBaseDuration$42.return = completedWork), - (treeBaseDuration$42 = treeBaseDuration$42.sibling); + treeBaseDuration$39.lanes | treeBaseDuration$39.childLanes), + (subtreeFlags |= treeBaseDuration$39.subtreeFlags & 7340032), + (subtreeFlags |= treeBaseDuration$39.flags & 7340032), + (treeBaseDuration$39.return = completedWork), + (treeBaseDuration$39 = treeBaseDuration$39.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$42 = completedWork.actualDuration; - child$43 = completedWork.selfBaseDuration; + treeBaseDuration$39 = completedWork.actualDuration; + child$40 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$42 += child.actualDuration), - (child$43 += child.treeBaseDuration), + (treeBaseDuration$39 += child.actualDuration), + (child$40 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$42; - completedWork.treeBaseDuration = child$43; + completedWork.actualDuration = treeBaseDuration$39; + completedWork.treeBaseDuration = child$40; } else for ( - treeBaseDuration$42 = completedWork.child; - null !== treeBaseDuration$42; + treeBaseDuration$39 = completedWork.child; + null !== treeBaseDuration$39; ) (newChildLanes |= - treeBaseDuration$42.lanes | treeBaseDuration$42.childLanes), - (subtreeFlags |= treeBaseDuration$42.subtreeFlags), - (subtreeFlags |= treeBaseDuration$42.flags), - (treeBaseDuration$42.return = completedWork), - (treeBaseDuration$42 = treeBaseDuration$42.sibling); + treeBaseDuration$39.lanes | treeBaseDuration$39.childLanes), + (subtreeFlags |= treeBaseDuration$39.subtreeFlags), + (subtreeFlags |= treeBaseDuration$39.flags), + (treeBaseDuration$39.return = completedWork), + (treeBaseDuration$39 = treeBaseDuration$39.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -4593,7 +4613,7 @@ function completeSuspendedOffscreenHostContainer(current, workInProgress) { )), appendAllChildren(rootContainerInstance, workInProgress, !1, !1), (workInProgress.stateNode = rootContainerInstance), - null !== workInProgress.ref && (workInProgress.flags |= 256)); + null !== workInProgress.ref && (workInProgress.flags |= 512)); bubbleProperties(workInProgress); } function completeWork(current, workInProgress, renderLanes) { @@ -4627,8 +4647,8 @@ function completeWork(current, workInProgress, renderLanes) { ((newProps.context = newProps.pendingContext), (newProps.pendingContext = null)), (null !== current && null !== current.child) || - newProps.hydrate || - (workInProgress.flags |= 512), + newProps.isDehydrated || + (workInProgress.flags |= 1024), updateHostContainer(current, workInProgress), bubbleProperties(workInProgress), null @@ -4645,7 +4665,7 @@ function completeWork(current, workInProgress, renderLanes) { newProps, renderLanes ), - current.ref !== workInProgress.ref && (workInProgress.flags |= 256); + current.ref !== workInProgress.ref && (workInProgress.flags |= 512); else { if (!newProps) { if (null === workInProgress.stateNode) @@ -4665,7 +4685,7 @@ function completeWork(current, workInProgress, renderLanes) { ); appendAllChildren(current, workInProgress, !1, !1); workInProgress.stateNode = current; - null !== workInProgress.ref && (workInProgress.flags |= 256); + null !== workInProgress.ref && (workInProgress.flags |= 512); } bubbleProperties(workInProgress); return null; @@ -4709,7 +4729,7 @@ function completeWork(current, workInProgress, renderLanes) { if ( newProps && !renderLanes && - ((workInProgress.child.flags |= 4096), 0 !== (workInProgress.mode & 1)) + ((workInProgress.child.flags |= 8192), 0 !== (workInProgress.mode & 1)) ) if ( (null === current && @@ -4721,7 +4741,8 @@ function completeWork(current, workInProgress, renderLanes) { else { if ( 0 === workInProgressRootExitStatus || - 3 === workInProgressRootExitStatus + 3 === workInProgressRootExitStatus || + 2 === workInProgressRootExitStatus ) workInProgressRootExitStatus = 4; null === workInProgressRoot || @@ -4786,7 +4807,7 @@ function completeWork(current, workInProgress, renderLanes) { for (newProps = workInProgress.child; null !== newProps; ) (renderLanes = newProps), (renderedTail = current), - (renderLanes.flags &= 3670018), + (renderLanes.flags &= 7340034), (type = renderLanes.alternate), null === type ? ((renderLanes.childLanes = 0), @@ -4892,7 +4913,7 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current.memoizedState) !== renderLanes && "unstable-defer-without-hiding" !== newProps.mode && 23 !== workInProgress.tag && - (workInProgress.flags |= 4096), + (workInProgress.flags |= 8192), renderLanes && 0 !== (workInProgress.mode & 1) ? 0 !== (subtreeRenderLanes & 1073741824) && bubbleProperties(workInProgress) @@ -4940,7 +4961,7 @@ function updateForwardRef( if (null !== current && !didReceiveUpdate) return ( (workInProgress.updateQueue = current.updateQueue), - (workInProgress.flags &= -1029), + (workInProgress.flags &= -2053), (current.lanes &= ~renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); @@ -5014,7 +5035,7 @@ function updateSimpleMemoComponent( current.ref === workInProgress.ref ) if (((didReceiveUpdate = !1), 0 !== (current.lanes & renderLanes))) - 0 !== (current.flags & 65536) && (didReceiveUpdate = !0); + 0 !== (current.flags & 131072) && (didReceiveUpdate = !0); else return ( (workInProgress.lanes = current.lanes), @@ -5117,7 +5138,7 @@ function markRef$1(current, workInProgress) { (null === current && null !== ref) || (null !== current && current.ref !== ref) ) - workInProgress.flags |= 256; + workInProgress.flags |= 512; } function updateFunctionComponent( current, @@ -5142,7 +5163,7 @@ function updateFunctionComponent( if (null !== current && !didReceiveUpdate) return ( (workInProgress.updateQueue = current.updateQueue), - (workInProgress.flags &= -1029), + (workInProgress.flags &= -2053), (current.lanes &= ~renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); @@ -5318,7 +5339,7 @@ function updateClassComponent( "function" === typeof instance.componentDidUpdate && (workInProgress.flags |= 4), "function" === typeof instance.getSnapshotBeforeUpdate && - (workInProgress.flags |= 512)) + (workInProgress.flags |= 1024)) : ("function" !== typeof instance.componentDidUpdate || (oldProps === current.memoizedProps && oldState === current.memoizedState) || @@ -5326,7 +5347,7 @@ function updateClassComponent( "function" !== typeof instance.getSnapshotBeforeUpdate || (oldProps === current.memoizedProps && oldState === current.memoizedState) || - (workInProgress.flags |= 512), + (workInProgress.flags |= 1024), (workInProgress.memoizedProps = nextProps), (workInProgress.memoizedState = newState)), (instance.props = nextProps), @@ -5340,7 +5361,7 @@ function updateClassComponent( "function" !== typeof instance.getSnapshotBeforeUpdate || (oldProps === current.memoizedProps && oldState === current.memoizedState) || - (workInProgress.flags |= 512), + (workInProgress.flags |= 1024), (nextProps = !1)); } return finishClassComponent( @@ -5645,7 +5666,7 @@ function updateSuspenseFallbackChildren( primaryChildren ))), (current.subtreeFlags = - currentPrimaryChildFragment.subtreeFlags & 3670016)); + currentPrimaryChildFragment.subtreeFlags & 7340032)); null !== currentFallbackChildFragment ? (fallbackChildren = createWorkInProgress( currentFallbackChildFragment, @@ -5881,8 +5902,8 @@ function unwindWork(workInProgress) { case 1: isContextProvider(workInProgress.type) && popContext(); var flags = workInProgress.flags; - return flags & 32768 - ? ((workInProgress.flags = (flags & -32769) | 128), + return flags & 65536 + ? ((workInProgress.flags = (flags & -65537) | 128), 0 !== (workInProgress.mode & 2) && transferActualDuration(workInProgress), workInProgress) @@ -5897,7 +5918,7 @@ function unwindWork(workInProgress) { throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." ); - workInProgress.flags = (flags & -32769) | 128; + workInProgress.flags = (flags & -65537) | 128; return workInProgress; case 5: return popHostContext(workInProgress), null; @@ -5905,8 +5926,8 @@ function unwindWork(workInProgress) { return ( pop(suspenseStackCursor), (flags = workInProgress.flags), - flags & 32768 - ? ((workInProgress.flags = (flags & -32769) | 128), + flags & 65536 + ? ((workInProgress.flags = (flags & -65537) | 128), 0 !== (workInProgress.mode & 2) && transferActualDuration(workInProgress), workInProgress) @@ -5961,7 +5982,7 @@ function commitBeforeMutationEffects(root, firstChild) { if ( ((root = nextEffect), (firstChild = root.child), - 0 !== (root.subtreeFlags & 516) && null !== firstChild) + 0 !== (root.subtreeFlags & 1028) && null !== firstChild) ) (firstChild.return = root), (nextEffect = firstChild); else @@ -5969,7 +5990,7 @@ function commitBeforeMutationEffects(root, firstChild) { root = nextEffect; try { var current = root.alternate; - if (0 !== (root.flags & 512)) + if (0 !== (root.flags & 1024)) switch (root.tag) { case 0: case 11: @@ -6043,8 +6064,8 @@ function commitHookEffectListMount(tag, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & tag) === tag) { - var create$89 = effect.create; - effect.destroy = create$89(); + var create$86 = effect.create; + effect.destroy = create$86(); } effect = effect.next; } while (effect !== finishedWork); @@ -6233,14 +6254,14 @@ function commitMutationEffects(root, firstChild, committedLanes) { } } firstChild = root.child; - if (0 !== (root.subtreeFlags & 6454) && null !== firstChild) + if (0 !== (root.subtreeFlags & 12854) && null !== firstChild) (firstChild.return = root), (nextEffect = firstChild); else for (; null !== nextEffect; ) { root = nextEffect; try { var flags = root.flags; - if (flags & 256) { + if (flags & 512) { var current$jscomp$0 = root.alternate; if (null !== current$jscomp$0) { firstChild = current$jscomp$0; @@ -6257,16 +6278,16 @@ function commitMutationEffects(root, firstChild, committedLanes) { else currentRef.current = null; } } - if (flags & 4096) + if (flags & 8192) switch (root.tag) { case 13: if (null !== root.memoizedState) { - var current$95 = root.alternate; - if (null === current$95 || null === current$95.memoizedState) + var current$92 = root.alternate; + if (null === current$92 || null === current$92.memoizedState) globalMostRecentFallbackTime = now(); } } - switch (flags & 2054) { + switch (flags & 4102) { case 2: root.flags &= -3; break; @@ -6274,11 +6295,11 @@ function commitMutationEffects(root, firstChild, committedLanes) { root.flags &= -3; commitWork(root.alternate, root); break; - case 2048: - root.flags &= -2049; + case 4096: + root.flags &= -4097; break; - case 2052: - root.flags &= -2049; + case 4100: + root.flags &= -4097; commitWork(root.alternate, root); break; case 4: @@ -6305,16 +6326,16 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { if ( ((root = nextEffect), (committedLanes = root.child), - 0 !== (root.subtreeFlags & 4420) && null !== committedLanes) + 0 !== (root.subtreeFlags & 8772) && null !== committedLanes) ) (committedLanes.return = root), (nextEffect = committedLanes); else for (root = finishedWork; null !== nextEffect; ) { committedLanes = nextEffect; - if (0 !== (committedLanes.flags & 4420)) { + if (0 !== (committedLanes.flags & 8772)) { var current = committedLanes.alternate; try { - if (0 !== (committedLanes.flags & 4420)) + if (0 !== (committedLanes.flags & 8772)) switch (committedLanes.tag) { case 0: case 11: @@ -6372,22 +6393,22 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { commitUpdateQueue(committedLanes, updateQueue, instance); break; case 3: - var updateQueue$91 = committedLanes.updateQueue; - if (null !== updateQueue$91) { - var instance$92 = null; + var updateQueue$88 = committedLanes.updateQueue; + if (null !== updateQueue$88) { + var instance$89 = null; if (null !== committedLanes.child) switch (committedLanes.child.tag) { case 5: - instance$92 = + instance$89 = committedLanes.child.stateNode.canonical; break; case 1: - instance$92 = committedLanes.child.stateNode; + instance$89 = committedLanes.child.stateNode; } commitUpdateQueue( committedLanes, - updateQueue$91, - instance$92 + updateQueue$88, + instance$89 ); } break; @@ -6403,7 +6424,7 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender, effectDuration = committedLanes.stateNode.effectDuration; - instance$92 = commitTime; + instance$89 = commitTime; current = null === current ? "mount" : "update"; currentUpdateIsNested && (current = "nested-update"); "function" === typeof onRender && @@ -6413,14 +6434,14 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { committedLanes.actualDuration, committedLanes.treeBaseDuration, committedLanes.actualStartTime, - instance$92 + instance$89 ); "function" === typeof onCommit && onCommit( committedLanes.memoizedProps.id, current, effectDuration, - instance$92 + instance$89 ); enqueuePendingPassiveProfilerEffect(committedLanes); var parentFiber = committedLanes.return; @@ -6449,28 +6470,28 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); } - if (committedLanes.flags & 256) { - instance$92 = void 0; + if (committedLanes.flags & 512) { + instance$89 = void 0; current = committedLanes; var ref = current.ref; if (null !== ref) { var instance$jscomp$0 = current.stateNode; switch (current.tag) { case 5: - instance$92 = instance$jscomp$0.canonical; + instance$89 = instance$jscomp$0.canonical; break; default: - instance$92 = instance$jscomp$0; + instance$89 = instance$jscomp$0; } if ("function" === typeof ref) if (current.mode & 2) try { - startLayoutEffectTimer(), ref(instance$92); + startLayoutEffectTimer(), ref(instance$89); } finally { recordLayoutEffectDuration(current); } - else ref(instance$92); - else ref.current = instance$92; + else ref(instance$89); + else ref.current = instance$89; } } } catch (error) { @@ -6485,10 +6506,10 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { nextEffect = null; break; } - instance$92 = committedLanes.sibling; - if (null !== instance$92) { - instance$92.return = committedLanes.return; - nextEffect = instance$92; + instance$89 = committedLanes.sibling; + if (null !== instance$89) { + instance$89.return = committedLanes.return; + nextEffect = instance$89; break; } nextEffect = committedLanes.return; @@ -6834,14 +6855,14 @@ function performConcurrentWorkOnRoot(root, didTimeout) { function recoverFromConcurrentError(root, errorRetryLanes) { var prevExecutionContext = executionContext; executionContext |= 8; - root.hydrate && ((root.hydrate = !1), shim(root.containerInfo)); + root.isDehydrated && ((root.isDehydrated = !1), shim(root.containerInfo)); root = renderRootSync(root, errorRetryLanes); executionContext = prevExecutionContext; return root; } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { - if (node.flags & 8192) { + if (node.flags & 16384) { var updateQueue = node.updateQueue; if ( null !== updateQueue && @@ -6859,7 +6880,7 @@ function isRenderConsistentWithExternalStores(finishedWork) { } } updateQueue = node.child; - if (node.subtreeFlags & 8192 && null !== updateQueue) + if (node.subtreeFlags & 16384 && null !== updateQueue) (updateQueue.return = node), (node = updateQueue); else { if (node === finishedWork) break; @@ -6897,7 +6918,7 @@ function performSyncWorkOnRoot(root) { if (0 !== root.tag && 2 === exitStatus) { var prevExecutionContext = executionContext; executionContext |= 8; - root.hydrate && ((root.hydrate = !1), shim(root.containerInfo)); + root.isDehydrated && ((root.isDehydrated = !1), shim(root.containerInfo)); var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); 0 !== errorRetryLanes && ((lanes = errorRetryLanes), (exitStatus = renderRootSync(root, lanes))); @@ -7024,7 +7045,7 @@ function handleError(root$jscomp$0, thrownValue) { sourceFiber = erroredWork, value = thrownValue; thrownValue = workInProgressRootRenderLanes; - sourceFiber.flags |= 16384; + sourceFiber.flags |= 32768; isDevToolsPresent && restorePendingUpdaters(root, thrownValue); if ( null !== value && @@ -7032,78 +7053,90 @@ function handleError(root$jscomp$0, thrownValue) { "function" === typeof value.then ) { var wakeable = value, - tag = sourceFiber.tag; + sourceFiber$jscomp$0 = sourceFiber, + tag = sourceFiber$jscomp$0.tag; if ( - 0 === (sourceFiber.mode & 1) && + 0 === (sourceFiber$jscomp$0.mode & 1) && (0 === tag || 11 === tag || 15 === tag) ) { - var currentSource = sourceFiber.alternate; + var currentSource = sourceFiber$jscomp$0.alternate; currentSource - ? ((sourceFiber.updateQueue = currentSource.updateQueue), - (sourceFiber.memoizedState = currentSource.memoizedState), - (sourceFiber.lanes = currentSource.lanes)) - : ((sourceFiber.updateQueue = null), - (sourceFiber.memoizedState = null)); + ? ((sourceFiber$jscomp$0.updateQueue = currentSource.updateQueue), + (sourceFiber$jscomp$0.memoizedState = + currentSource.memoizedState), + (sourceFiber$jscomp$0.lanes = currentSource.lanes)) + : ((sourceFiber$jscomp$0.updateQueue = null), + (sourceFiber$jscomp$0.memoizedState = null)); } - var hasInvisibleParentBoundary = - 0 !== (suspenseStackCursor.current & 1), - workInProgress$32 = returnFiber; - do { - var JSCompiler_temp; - if ((JSCompiler_temp = 13 === workInProgress$32.tag)) { - var nextState = workInProgress$32.memoizedState; - JSCompiler_temp = - null !== nextState - ? null !== nextState.dehydrated + b: { + sourceFiber$jscomp$0 = returnFiber; + var sourceFiber$jscomp$1 = sourceFiber, + rootRenderLanes = thrownValue, + hasInvisibleParentBoundary = + 0 !== (suspenseStackCursor.current & 1), + node = sourceFiber$jscomp$0; + do { + var JSCompiler_temp; + if ((JSCompiler_temp = 13 === node.tag)) { + var nextState = node.memoizedState; + JSCompiler_temp = + null !== nextState + ? null !== nextState.dehydrated + ? !0 + : !1 + : !0 !== node.memoizedProps.unstable_avoidThisFallback ? !0 - : !1 - : !0 !== - workInProgress$32.memoizedProps.unstable_avoidThisFallback - ? !0 - : hasInvisibleParentBoundary - ? !1 - : !0; - } - if (JSCompiler_temp) { - var wakeables = workInProgress$32.updateQueue; - if (null === wakeables) { - var updateQueue = new Set(); - updateQueue.add(wakeable); - workInProgress$32.updateQueue = updateQueue; - } else wakeables.add(wakeable); - if ( - 0 === (workInProgress$32.mode & 1) && - workInProgress$32 !== returnFiber - ) { - workInProgress$32.flags |= 128; - sourceFiber.flags |= 65536; - sourceFiber.flags &= -26437; - if ( - enablePersistentOffscreenHostContainer && - null === workInProgress$32.alternate - ) { - var offscreenContainer = workInProgress$32.child.child; - if (null !== offscreenContainer) { - var containerProps = getOffscreenContainerProps( - "hidden", - offscreenContainer.memoizedProps.children - ); - offscreenContainer.pendingProps = containerProps; - offscreenContainer.memoizedProps = containerProps; - } - } - if (1 === sourceFiber.tag) - if (null === sourceFiber.alternate) sourceFiber.tag = 17; + : hasInvisibleParentBoundary + ? !1 + : !0; + } + if (JSCompiler_temp) { + if (0 === (node.mode & 1)) { + if (node === sourceFiber$jscomp$0) node.flags |= 65536; else { - var update = createUpdate(-1, 1); - update.tag = 2; - enqueueUpdate(sourceFiber, update); + node.flags |= 128; + sourceFiber$jscomp$1.flags |= 131072; + sourceFiber$jscomp$1.flags &= -52805; + if ( + enablePersistentOffscreenHostContainer && + null === node.alternate + ) { + var offscreenContainer = node.child.child; + if (null !== offscreenContainer) { + var containerProps = getOffscreenContainerProps( + "hidden", + offscreenContainer.memoizedProps.children + ); + offscreenContainer.pendingProps = containerProps; + offscreenContainer.memoizedProps = containerProps; + } + } + if (1 === sourceFiber$jscomp$1.tag) + if (null === sourceFiber$jscomp$1.alternate) + sourceFiber$jscomp$1.tag = 17; + else { + var update = createUpdate(-1, 1); + update.tag = 2; + enqueueUpdate(sourceFiber$jscomp$1, update); + } + sourceFiber$jscomp$1.lanes |= 1; } - sourceFiber.lanes |= 1; - break a; + var suspenseBoundary = node; + break b; + } + node.flags |= 65536; + node.lanes = rootRenderLanes; + suspenseBoundary = node; + break b; } - value = void 0; - sourceFiber = thrownValue; + node = node.return; + } while (null !== node); + suspenseBoundary = null; + } + if (null !== suspenseBoundary) { + value = void 0; + sourceFiber = suspenseBoundary; + if (sourceFiber.mode & 1) { var pingCache = root.pingCache; null === pingCache ? ((pingCache = root.pingCache = new PossiblyWeakMap()), @@ -7112,72 +7145,75 @@ function handleError(root$jscomp$0, thrownValue) { : ((value = pingCache.get(wakeable)), void 0 === value && ((value = new Set()), pingCache.set(wakeable, value))); - if (!value.has(sourceFiber)) { - value.add(sourceFiber); + if (!value.has(thrownValue)) { + value.add(thrownValue); var ping = pingSuspendedRoot.bind( null, root, wakeable, - sourceFiber + thrownValue ); - isDevToolsPresent && restorePendingUpdaters(root, sourceFiber); + isDevToolsPresent && restorePendingUpdaters(root, thrownValue); wakeable.then(ping, ping); } - workInProgress$32.flags |= 32768; - workInProgress$32.lanes = thrownValue; - break a; } - workInProgress$32 = workInProgress$32.return; - } while (null !== workInProgress$32); - value = Error( - (getComponentNameFromFiber(sourceFiber) || "A React component") + - " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." - ); + var wakeables = sourceFiber.updateQueue; + if (null === wakeables) { + var updateQueue = new Set(); + updateQueue.add(wakeable); + sourceFiber.updateQueue = updateQueue; + } else wakeables.add(wakeable); + break a; + } else + value = Error( + (getComponentNameFromFiber(sourceFiber) || "A React component") + + " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." + ); } - 5 !== workInProgressRootExitStatus && + 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); value = createCapturedValue(value, sourceFiber); - workInProgress$32 = returnFiber; + root = returnFiber; do { - switch (workInProgress$32.tag) { + switch (root.tag) { case 3: - root = value; - workInProgress$32.flags |= 32768; + wakeable = value; + root.flags |= 65536; thrownValue &= -thrownValue; - workInProgress$32.lanes |= thrownValue; - var update$33 = createRootErrorUpdate( - workInProgress$32, + root.lanes |= thrownValue; + var update$jscomp$0 = createRootErrorUpdate( root, + wakeable, thrownValue ); - enqueueCapturedUpdate(workInProgress$32, update$33); + enqueueCapturedUpdate(root, update$jscomp$0); break a; case 1: - root = value; - var ctor = workInProgress$32.type, - instance = workInProgress$32.stateNode; + wakeable = value; + var ctor = root.type, + instance = root.stateNode; if ( - 0 === (workInProgress$32.flags & 128) && + 0 === (root.flags & 128) && ("function" === typeof ctor.getDerivedStateFromError || (null !== instance && "function" === typeof instance.componentDidCatch && (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(instance)))) ) { - workInProgress$32.flags |= 32768; + root.flags |= 65536; thrownValue &= -thrownValue; - workInProgress$32.lanes |= thrownValue; - var update$36 = createClassErrorUpdate( - workInProgress$32, + root.lanes |= thrownValue; + var update$33 = createClassErrorUpdate( root, + wakeable, thrownValue ); - enqueueCapturedUpdate(workInProgress$32, update$36); + enqueueCapturedUpdate(root, update$33); break a; } } - workInProgress$32 = workInProgress$32.return; - } while (null !== workInProgress$32); + root = root.return; + } while (null !== root); } completeUnitOfWork(erroredWork); } catch (yetAnotherThrownValue) { @@ -7254,7 +7290,7 @@ function completeUnitOfWork(unitOfWork) { do { var current = completedWork.alternate; unitOfWork = completedWork.return; - if (0 === (completedWork.flags & 16384)) { + if (0 === (completedWork.flags & 32768)) { if (0 === (completedWork.mode & 2)) current = completeWork(current, completedWork, subtreeRenderLanes); else { @@ -7271,7 +7307,7 @@ function completeUnitOfWork(unitOfWork) { } else { current = unwindWork(completedWork); if (null !== current) { - current.flags &= 16383; + current.flags &= 32767; workInProgress = current; return; } @@ -7283,7 +7319,7 @@ function completeUnitOfWork(unitOfWork) { completedWork.actualDuration = current; } null !== unitOfWork && - ((unitOfWork.flags |= 16384), + ((unitOfWork.flags |= 32768), (unitOfWork.subtreeFlags = 0), (unitOfWork.deletions = null)); } @@ -7330,16 +7366,16 @@ function commitRootImpl(root, renderPriorityLevel) { root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); - (0 === (finishedWork.subtreeFlags & 1040) && - 0 === (finishedWork.flags & 1040)) || + (0 === (finishedWork.subtreeFlags & 2064) && + 0 === (finishedWork.flags & 2064)) || rootDoesHavePassiveEffects || ((rootDoesHavePassiveEffects = !0), scheduleCallback$1(NormalPriority, function() { flushPassiveEffects(); return null; })); - remainingLanes = 0 !== (finishedWork.flags & 8054); - if (0 !== (finishedWork.subtreeFlags & 8054) || remainingLanes) { + remainingLanes = 0 !== (finishedWork.flags & 15990); + if (0 !== (finishedWork.subtreeFlags & 15990) || remainingLanes) { remainingLanes = ReactCurrentBatchConfig$2.transition; ReactCurrentBatchConfig$2.transition = 0; var previousPriority = currentUpdatePriority; @@ -7461,12 +7497,12 @@ function flushPassiveEffects() { nextEffect = fiber; } } - if (0 !== (fiber.subtreeFlags & 1040) && null !== child) + if (0 !== (fiber.subtreeFlags & 2064) && null !== child) (child.return = fiber), (nextEffect = child); else b: for (; null !== nextEffect; ) { fiber = nextEffect; - if (0 !== (fiber.flags & 1024)) + if (0 !== (fiber.flags & 2048)) switch (((i = fiber), i.tag)) { case 0: case 11: @@ -7490,12 +7526,12 @@ function flushPassiveEffects() { for (nextEffect = finishedWork; null !== nextEffect; ) { child = nextEffect; var firstChild = child.child; - if (0 !== (child.subtreeFlags & 1040) && null !== firstChild) + if (0 !== (child.subtreeFlags & 2064) && null !== firstChild) (firstChild.return = child), (nextEffect = firstChild); else b: for (child = finishedWork; null !== nextEffect; ) { deletions = nextEffect; - if (0 !== (deletions.flags & 1024)) + if (0 !== (deletions.flags & 2048)) try { switch (((fiberToDelete = deletions), fiberToDelete.tag)) { case 0: @@ -7703,7 +7739,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { renderLanes ) ); - didReceiveUpdate = 0 !== (current.flags & 65536) ? !0 : !1; + didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; } else didReceiveUpdate = !1; workInProgress.lanes = 0; @@ -8184,7 +8220,7 @@ function createWorkInProgress(current, pendingProps) { (workInProgress.deletions = null), (workInProgress.actualDuration = 0), (workInProgress.actualStartTime = -1)); - workInProgress.flags = current.flags & 3670016; + workInProgress.flags = current.flags & 7340032; workInProgress.childLanes = current.childLanes; workInProgress.lanes = current.lanes; workInProgress.child = current.child; @@ -8280,8 +8316,7 @@ function createFiberFromTypeAndProps( } throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + - (null == type ? type : typeof type) + - "." + ((null == type ? type : typeof type) + ".") ); } key = createFiber(fiberTag, pendingProps, key, mode); @@ -8334,7 +8369,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.finishedWork = this.pingCache = this.current = this.pendingChildren = null; this.timeoutHandle = -1; this.pendingContext = this.context = null; - this.hydrate = hydrate; + this.isDehydrated = hydrate; this.callbackNode = null; this.callbackPriority = 0; this.eventTimes = createLaneMap(0); @@ -8362,9 +8397,9 @@ function findHostInstance(component) { if (void 0 === fiber) { if ("function" === typeof component.render) throw Error("Unable to find node on an unmounted component."); + component = Object.keys(component).join(","); throw Error( - "Argument appears to not be a ReactComponent. Keys: " + - Object.keys(component) + "Argument appears to not be a ReactComponent. Keys: " + component ); } component = findCurrentHostFiber(fiber); @@ -8548,10 +8583,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_980 = { + devToolsConfig$jscomp$inline_965 = { findFiberByHostInstance: getInstanceFromInstance, bundleType: 0, - version: "18.0.0-e8feb11b6-20210915", + version: "18.0.0-afcb9cdc9-20211008", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8566,11 +8601,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1241 = { - bundleType: devToolsConfig$jscomp$inline_980.bundleType, - version: devToolsConfig$jscomp$inline_980.version, - rendererPackageName: devToolsConfig$jscomp$inline_980.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_980.rendererConfig, +var internals$jscomp$inline_1239 = { + bundleType: devToolsConfig$jscomp$inline_965.bundleType, + version: devToolsConfig$jscomp$inline_965.version, + rendererPackageName: devToolsConfig$jscomp$inline_965.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_965.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8586,27 +8621,26 @@ var internals$jscomp$inline_1241 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_980.findFiberByHostInstance || + devToolsConfig$jscomp$inline_965.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - getIsStrictMode: null, - reconcilerVersion: "18.0.0-e8feb11b6-20210915" + reconcilerVersion: "18.0.0-afcb9cdc9-20211008" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1242 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1240 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1242.isDisabled && - hook$jscomp$inline_1242.supportsFiber + !hook$jscomp$inline_1240.isDisabled && + hook$jscomp$inline_1240.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1242.inject( - internals$jscomp$inline_1241 + (rendererID = hook$jscomp$inline_1240.inject( + internals$jscomp$inline_1239 )), - (injectedHook = hook$jscomp$inline_1242); + (injectedHook = hook$jscomp$inline_1240); } catch (err) {} } exports.createPortal = function(children, containerTag) { diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index 0f1cae0b6185eb..1c526c7f8cbad6 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ 'use strict'; @@ -75,10 +75,10 @@ function printWarning(level, format, args) { if (stack !== "") { format += "%s"; args = args.concat([stack]); - } + } // eslint-disable-next-line react-internal/safe-string-coercion var argsWithFormat = args.map(function(item) { - return "" + item; + return String(item); }); // Careful: RN currently depends on this prefix argsWithFormat.unshift("Warning: " + format); // We intentionally don't use spread (or .apply) directly because it @@ -145,9 +145,15 @@ var invokeGuardedCallbackImpl = invokeGuardedCallbackProd; // when we call document.createEvent(). However this can cause confusing // errors: https://github.com/facebook/create-react-app/issues/3482 // So we preemptively throw with a better message instead. - 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") { + 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." ); } @@ -253,6 +259,7 @@ var invokeGuardedCallbackImpl = invokeGuardedCallbackProd; if (didCall && didError) { if (!didSetError) { // The callback errored, but the error event never fired. + // eslint-disable-next-line react-internal/prod-error-codes error = new Error( "An error was thrown inside one of your components, but React " + "doesn't know what it was. This is likely due to browser " + @@ -264,6 +271,7 @@ var invokeGuardedCallbackImpl = invokeGuardedCallbackProd; "actually an issue with React, please file an issue." ); } else if (isCrossOriginError) { + // eslint-disable-next-line react-internal/prod-error-codes error = new Error( "A cross-origin error was thrown. React doesn't have access to " + "the actual error object in development. " + @@ -376,11 +384,10 @@ function clearCaughtError() { caughtError = null; return error; } 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." + ); } } @@ -537,8 +544,8 @@ function executeDirectDispatch(event) { var dispatchListener = event._dispatchListeners; var dispatchInstance = event._dispatchInstances; - if (!!isArray(dispatchListener)) { - throw Error("executeDirectDispatch(...): Invalid `event`."); + if (isArray(dispatchListener)) { + throw new Error("executeDirectDispatch(...): Invalid `event`."); } event.currentTarget = dispatchListener @@ -559,6 +566,7 @@ function hasDispatches(event) { return !!event._dispatchListeners; } +/* eslint valid-typeof: 0 */ var EVENT_POOL_SIZE = 10; /** * @interface Event @@ -885,7 +893,7 @@ function releasePooledEvent(event) { var EventConstructor = this; if (!(event instanceof EventConstructor)) { - throw Error( + throw new Error( "Trying to release an event instance into a pool of a different type." ); } @@ -994,8 +1002,8 @@ function resetTouchRecord(touchRecord, touch) { function getTouchIdentifier(_ref) { var identifier = _ref.identifier; - if (!(identifier != null)) { - throw Error("Touch object is missing identifier."); + if (identifier == null) { + throw new Error("Touch object is missing identifier."); } { @@ -1153,8 +1161,8 @@ var ResponderTouchHistoryStore = { */ function accumulate(current, next) { - if (!(next != null)) { - throw Error( + if (next == null) { + throw new Error( "accumulate(...): Accumulated items must not be null or undefined." ); } @@ -1189,8 +1197,8 @@ function accumulate(current, next) { */ function accumulateInto(current, next) { - if (!(next != null)) { - throw Error( + if (next == null) { + throw new Error( "accumulateInto(...): Accumulated items must not be null or undefined." ); } @@ -1496,8 +1504,8 @@ function getListener(inst, registrationName) { var listener = props[registrationName]; - if (!(!listener || typeof listener === "function")) { - throw Error( + if (listener && typeof listener !== "function") { + throw new Error( "Expected `" + registrationName + "` listener to be a function, instead got a value of `" + @@ -2079,11 +2087,10 @@ function recomputePluginOrdering() { var pluginModule = namesToPlugins[pluginName]; var pluginIndex = eventPluginOrder.indexOf(pluginName); - if (!(pluginIndex > -1)) { - throw Error( - "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + - pluginName + - "`." + if (pluginIndex <= -1) { + throw new Error( + "EventPluginRegistry: Cannot inject event plugins that do not exist in " + + ("the plugin ordering, `" + pluginName + "`.") ); } @@ -2092,10 +2099,9 @@ function recomputePluginOrdering() { } if (!pluginModule.extractEvents) { - throw Error( - "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + - pluginName + - "` does not." + throw new Error( + "EventPluginRegistry: Event plugins must implement an `extractEvents` " + + ("method, but `" + pluginName + "` does not.") ); } @@ -2110,7 +2116,7 @@ function recomputePluginOrdering() { eventName ) ) { - throw Error( + throw new Error( "EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + @@ -2131,11 +2137,10 @@ function recomputePluginOrdering() { */ function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { - if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { - throw Error( - "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + - eventName + - "`." + if (eventNameDispatchConfigs.hasOwnProperty(eventName)) { + throw new Error( + "EventPluginRegistry: More than one plugin attempted to publish the same " + + ("event name, `" + eventName + "`.") ); } @@ -2175,11 +2180,10 @@ function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { */ function publishRegistrationName(registrationName, pluginModule, eventName) { - if (!!registrationNameModules[registrationName]) { - throw Error( - "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + - registrationName + - "`." + if (registrationNameModules[registrationName]) { + throw new Error( + "EventPluginRegistry: More than one plugin attempted to publish the same " + + ("registration name, `" + registrationName + "`.") ); } @@ -2226,9 +2230,10 @@ var registrationNameDependencies = {}; */ function injectEventPluginOrder(injectedEventPluginOrder) { - if (!!eventPluginOrder) { - throw Error( - "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." + if (eventPluginOrder) { + throw new Error( + "EventPluginRegistry: Cannot inject event plugin ordering more than " + + "once. You are likely trying to load more than one copy of React." ); } // Clone the ordering so it cannot be dynamically mutated. @@ -2259,11 +2264,10 @@ function injectEventPluginsByName(injectedNamesToPlugins) { !namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule ) { - if (!!namesToPlugins[pluginName]) { - throw Error( - "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName + - "`." + if (namesToPlugins[pluginName]) { + throw new Error( + "EventPluginRegistry: Cannot inject two different event plugins " + + ("using the same name, `" + pluginName + "`.") ); } @@ -2294,8 +2298,8 @@ function getListener$1(inst, registrationName) { var listener = props[registrationName]; - if (!(!listener || typeof listener === "function")) { - throw Error( + if (listener && typeof listener !== "function") { + throw new Error( "Expected `" + registrationName + "` listener to be a function, instead got a value of `" + @@ -2443,8 +2447,8 @@ var ReactNativeBridgeEventPlugin = { var bubbleDispatchConfig = customBubblingEventTypes[topLevelType]; var directDispatchConfig = customDirectEventTypes[topLevelType]; - if (!(bubbleDispatchConfig || directDispatchConfig)) { - throw Error( + if (!bubbleDispatchConfig && !directDispatchConfig) { + throw new Error( // $FlowFixMe - Flow doesn't like this string coercion because DOMTopLevelEventType is opaque 'Unsupported top level event type "' + topLevelType + '" dispatched' ); } @@ -2518,7 +2522,7 @@ function getTagFromInstance(inst) { } if (!tag) { - throw Error("All native instances should have a tag."); + throw new Error("All native instances should have a tag."); } return nativeInstance; @@ -2602,9 +2606,10 @@ function runEventsInBatch(events) { forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); - if (!!eventQueue) { - throw Error( - "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." + if (eventQueue) { + throw new Error( + "processEventQueue(): Additional events were enqueued while processing " + + "an event queue. Support for this has not yet been implemented." ); } // This would be a good time to rethrow if any of the event handlers threw. @@ -3136,6 +3141,7 @@ function getComponentNameFromFiber(fiber) { var enablePersistentOffscreenHostContainer = dynamicFlags.enablePersistentOffscreenHostContainer; // The rest of the flags are static for better dead code elimination. +var enableSchedulingProfiler = false; var enableProfilerTimer = true; var enableProfilerCommitHooks = true; var enableLazyElements = false; @@ -3175,41 +3181,41 @@ var DidCapture = 128; var Ref = /* */ - 256; + 512; var Snapshot = /* */ - 512; + 1024; var Passive = /* */ - 1024; + 2048; var Hydrating = /* */ - 2048; + 4096; var HydratingAndUpdate = /* */ Hydrating | Update; var Visibility = /* */ - 4096; + 8192; var StoreConsistency = /* */ - 8192; + 16384; var LifecycleEffectMask = Passive | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) var HostEffectMask = /* */ - 16383; // These are not really side effects, but we still reuse this field. + 32767; // These are not really side effects, but we still reuse this field. var Incomplete = /* */ - 16384; + 32768; var ShouldCapture = /* */ - 32768; + 65536; var ForceUpdateForLegacySuspense = /* */ - 65536; + 131072; // e.g. a fiber uses a passive effect (even if there are no updates on this particular render). // This enables us to defer more work in the unmount case, // since we can defer traversing the tree during layout to look for Passive effects, @@ -3217,22 +3223,22 @@ var ForceUpdateForLegacySuspense = var RefStatic = /* */ - 524288; + 1048576; var LayoutStatic = /* */ - 1048576; + 2097152; var PassiveStatic = /* */ - 2097152; // These flags allow us to traverse to fibers that have effects on mount + 4194304; // These flags allow us to traverse to fibers that have effects on mount // without traversing the entire tree after every commit for // double invoking var MountLayoutDev = /* */ - 4194304; + 8388608; var MountPassiveDev = /* */ - 8388608; // Groups of flags that are used in the commit phase to skip over trees that + 16777216; // Groups of flags that are used in the commit phase to skip over trees that // don't contain effects, by checking subtreeFlags. var BeforeMutationMask = // TODO: Remove Update flag from before mutation phase by re-landing Visibility @@ -3327,8 +3333,8 @@ function isMounted(component) { } 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."); } } @@ -3339,8 +3345,8 @@ function findCurrentFiberUsingSlowPath(fiber) { // If there is no alternate, then we only need to check if it is mounted. 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) { @@ -3402,9 +3408,7 @@ function findCurrentFiberUsingSlowPath(fiber) { } // We should never have an alternate for any mounting node. So the only // way this could possibly happen is if this was unmounted, if at all. - { - 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) { @@ -3464,23 +3468,25 @@ function findCurrentFiberUsingSlowPath(fiber) { } 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 the root is not a host container, we're in a disconnected tree. I.e. // unmounted. - 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) { @@ -4131,6 +4137,103 @@ var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; var NormalPriority = Scheduler.unstable_NormalPriority; var IdlePriority = Scheduler.unstable_IdlePriority; +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; + +function disabledLog() {} + +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ + } + + disabledDepth++; + } +} +function reenableLogs() { + { + disabledDepth--; + + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + log: Object.assign({}, props, { + value: prevLog + }), + info: Object.assign({}, props, { + value: prevInfo + }), + warn: Object.assign({}, props, { + value: prevWarn + }), + error: Object.assign({}, props, { + value: prevError + }), + group: Object.assign({}, props, { + value: prevGroup + }), + groupCollapsed: Object.assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: Object.assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } + + if (disabledDepth < 0) { + error( + "disabledDepth fell below zero. " + + "This is a bug in React. Please file an issue." + ); + } + } +} + var rendererID = null; var injectedHook = null; var hasLoggedError = false; @@ -4282,6 +4385,15 @@ function onCommitUnmount(fiber) { } } } +function setIsStrictModeForDevtools(newIsStrictMode) { + { + if (newIsStrictMode) { + disableLogs(); + } else { + reenableLogs(); + } + } +} var NoMode = /* */ @@ -5037,33 +5149,34 @@ function lanesToEventPriority(lanes) { return IdleEventPriority; } +// Renderers that don't support persistence // can re-export everything from this module. - function shim() { - { - throw Error( - "The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue." - ); - } + throw new Error( + "The current renderer does not support persistence. " + + "This error is likely caused by a bug in React. " + + "Please file an issue." + ); } // Persistence (when unsupported) var supportsPersistence = false; var getOffscreenContainerProps = shim; +// Renderers that don't support hydration // can re-export everything from this module. - function shim$1() { - { - throw Error( - "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." - ); - } + throw new Error( + "The current renderer does not support hydration. " + + "This error is likely caused by a bug in React. " + + "Please file an issue." + ); } // Hydration (when unsupported) var isSuspenseInstancePending = shim$1; var isSuspenseInstanceFallback = shim$1; var hydrateTextInstance = shim$1; var errorHydratingContainer = shim$1; +// Modules provided by RN: var getViewConfigForType = ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get; var UPDATE_SIGNAL = {}; @@ -5145,7 +5258,7 @@ function createTextInstance( internalInstanceHandle ) { if (!hostContext.isInAParentText) { - throw Error("Text strings must be rendered within a component."); + throw new Error("Text strings must be rendered within a component."); } var tag = allocateTag(); @@ -5344,8 +5457,8 @@ function insertInContainerBefore(parentInstance, child, beforeChild) { // We create a wrapper object for the container in ReactNative render() // Or we refactor to remove wrapper objects entirely. // For more info on pros/cons see PR #8560 description. - if (!(typeof parentInstance !== "number")) { - throw Error("Container does not support insertBefore operation"); + if (typeof parentInstance === "number") { + throw new Error("Container does not support insertBefore operation"); } } function removeChild(parentInstance, child) { @@ -5429,103 +5542,6 @@ function preparePortalMount(portalInstance) { // noop } -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - log: Object.assign({}, props, { - value: prevLog - }), - info: Object.assign({}, props, { - value: prevInfo - }), - warn: Object.assign({}, props, { - value: prevWarn - }), - error: Object.assign({}, props, { - value: prevError - }), - group: Object.assign({}, props, { - value: prevGroup - }), - groupCollapsed: Object.assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: Object.assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error( - "disabledDepth fell below zero. " + - "This is a bug in React. Please file an issue." - ); - } - } -} - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; function describeBuiltInComponentFrame(name, source, ownerFn) { { @@ -5685,6 +5701,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, element) { // This is intentionally an invariant that gets caught. It's the same // behavior as without this statement except with a better message. if (typeof typeSpecs[typeSpecName] !== "function") { + // eslint-disable-next-line react-internal/prod-error-codes var err = Error( (componentName || "React class") + ": " + @@ -5916,9 +5933,10 @@ function popTopLevelContextObject(fiber) { 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." ); } @@ -5957,7 +5975,7 @@ function processChildContext(fiber, type, parentContext) { for (var contextKey in childContext) { if (!(contextKey in childContextTypes)) { - throw Error( + throw new Error( (getComponentNameFromFiber(fiber) || "Unknown") + '.getChildContext(): key "' + contextKey + @@ -6002,8 +6020,9 @@ function invalidateContextProvider(workInProgress, type, didChange) { var instance = workInProgress.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." ); } @@ -6035,9 +6054,10 @@ function findCurrentUnmaskedContext(fiber) { { // Currently this is only used with renderSubtreeIntoContainer; not sure if it // makes sense elsewhere - 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." ); } @@ -6062,11 +6082,10 @@ function findCurrentUnmaskedContext(fiber) { 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." + ); } } @@ -6154,7 +6173,12 @@ function flushSyncCallbacks() { return null; } -var ReactVersion = "18.0.0-e8feb11b6-20210915"; +var ReactVersion = "18.0.0-afcb9cdc9-20211008"; + +function markComponentRenderStopped() {} +function markComponentErrored(fiber, thrownValue, lanes) {} + +function markComponentSuspended(fiber, wakeable, lanes) {} var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; var NoTransition = 0; @@ -6653,6 +6677,105 @@ var ReactStrictModeWarnings = { }; } +/* + * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol + * and Temporal.* types. See https://github.com/facebook/react/pull/22064. + * + * The functions in this module will throw an easier-to-understand, + * easier-to-debug exception with a clear errors message message explaining the + * problem. (Instead of a confusing exception thrown inside the implementation + * of the `value` object). + */ +// $FlowFixMe only called in DEV, so void return is not possible. + +function typeName(value) { + { + // toStringTag is needed for namespaced types like Temporal.Instant + var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; + var type = + (hasToStringTag && value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; + return type; + } +} // $FlowFixMe only called in DEV, so void return is not possible. + +function willCoercionThrow(value) { + { + if ( + value !== null && + typeof value === "object" && + value.$$typeof === REACT_OPAQUE_ID_TYPE + ) { + // OpaqueID type is expected to throw, so React will handle it. Not sure if + // it's expected that string coercion will throw, but we'll assume it's OK. + // See https://github.com/facebook/react/issues/20127. + return; + } + + try { + testStringCoercion(value); + return false; + } catch (e) { + return true; + } + } +} + +function testStringCoercion(value) { + // If you ended up here by following an exception call stack, here's what's + // happened: you supplied an object or symbol value to React (as a prop, key, + // DOM attribute, CSS property, string ref, etc.) and when React tried to + // coerce it to a string using `'' + value`, an exception was thrown. + // + // The most common types that will cause this exception are `Symbol` instances + // and Temporal objects like `Temporal.Instant`. But any object that has a + // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this + // exception. (Library authors do this to prevent users from using built-in + // numeric operators like `+` or comparison operators like `>=` because custom + // methods are needed to perform accurate arithmetic or comparison.) + // + // To fix the problem, coerce this object or symbol value to a string before + // passing it to React. The most reliable way is usually `String(value)`. + // + // To find which value is throwing, check the browser or debugger console. + // Before this exception was thrown, there should be `console.error` output + // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the + // problem and how that type was used: key, atrribute, input value prop, etc. + // In most cases, this console output also shows the component and its + // ancestor components where the exception happened. + // + // eslint-disable-next-line react-internal/safe-string-coercion + 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); // throw (to help callers find troubleshooting comments) + } + } +} +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); // throw (to help callers find troubleshooting comments) + } + } +} + function resolveDefaultProps(Component, baseProps) { if (Component && Component.defaultProps) { // Resolve default props. Taken from ReactElement @@ -6917,9 +7040,12 @@ function readContext(context) { }; 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()." ); } // This is the first dependency for this component. Create a new list. @@ -7487,10 +7613,10 @@ function processUpdateQueue(workInProgress, props, instance, renderLanes) { } 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) ); } @@ -7589,11 +7715,14 @@ var didWarnAboutInvalidateContextType; 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); @@ -8673,9 +8802,10 @@ var warnForMissingKey = function(child, returnFiber) {}; 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." ); } @@ -8744,9 +8874,12 @@ function coerceRef(returnFiber, current, element) { 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" ); } @@ -8754,11 +8887,18 @@ function coerceRef(returnFiber, current, element) { } if (!inst) { - throw Error( + throw new Error( "Missing owner for string ref " + mixedRef + - ". This error is likely caused by a bug in React. Please file an issue." + ". This error is likely caused by a " + + "bug in React. Please file an issue." ); + } // Assigning this to a const so Flow knows it won't change in the closure + + var resolvedInst = inst; + + { + checkPropStringCoercion(mixedRef, "ref"); } var stringRef = "" + mixedRef; // Check if previous string ref matches new string ref @@ -8773,11 +8913,11 @@ function coerceRef(returnFiber, current, element) { } var ref = function(value) { - var refs = inst.refs; + var refs = resolvedInst.refs; if (refs === emptyRefsObject) { // This is a lazy pooled frozen object, so we need to initialize. - refs = inst.refs = {}; + refs = resolvedInst.refs = {}; } if (value === null) { @@ -8790,17 +8930,22 @@ function coerceRef(returnFiber, current, element) { ref._stringRef = stringRef; return ref; } else { - if (!(typeof mixedRef === "string")) { - throw Error( + 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( + 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." + ") but no owner was set. This could happen for one of" + + " the following reasons:\n" + + "1. You may be adding a ref to a function component\n" + + "2. You may be adding a ref to a component that was not created inside a component's render method\n" + + "3. You have multiple copies of React loaded\n" + + "See https://reactjs.org/link/refs-must-have-owner for more information." ); } } @@ -8811,16 +8956,15 @@ function coerceRef(returnFiber, current, element) { function throwOnInvalidObjectType(returnFiber, newChild) { var childString = Object.prototype.toString.call(newChild); - - { - throw 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." - ); - } + 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) { @@ -9436,9 +9580,10 @@ function ChildReconciler(shouldTrackSideEffects) { // but using the iterator instead. 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." ); } @@ -9490,8 +9635,8 @@ function ChildReconciler(shouldTrackSideEffects) { 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; @@ -9868,8 +10013,8 @@ function ChildReconciler(shouldTrackSideEffects) { var reconcileChildFibers = ChildReconciler(true); var mountChildFibers = ChildReconciler(false); function cloneChildFibers(current, workInProgress) { - if (!(current === null || workInProgress.child === current.child)) { - throw Error("Resuming work not yet implemented."); + if (current !== null && workInProgress.child !== current.child) { + throw new Error("Resuming work not yet implemented."); } if (workInProgress.child === null) { @@ -9908,9 +10053,10 @@ 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." ); } @@ -10127,21 +10273,19 @@ function prepareToHydrateHostInstance( hostContext ) { { - { - throw Error( - "Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." - ); - } + throw new Error( + "Expected prepareToHydrateHostInstance() to never be called. " + + "This error is likely caused by a bug in React. Please file an issue." + ); } } function prepareToHydrateHostTextInstance(fiber) { { - { - throw Error( - "Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." - ); - } + throw new Error( + "Expected prepareToHydrateHostTextInstance() to never be called. " + + "This error is likely caused by a bug in React. Please file an issue." + ); } var shouldUpdate = hydrateTextInstance(); } @@ -10343,11 +10487,14 @@ function warnOnHookMismatchInDev(currentHookName) { } 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:\n" + + "1. You might have mismatching versions of React and the renderer (such as React DOM)\n" + + "2. You might be breaking the Rules of Hooks\n" + + "3. You might have more than one copy of React in the same app\n" + + "See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." + ); } function areHookInputsEqual(nextDeps, prevDeps) { @@ -10455,9 +10602,10 @@ function renderWithHooks( 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." + if (numberOfReRenders >= RE_RENDER_LIMIT) { + throw new Error( + "Too many re-renders. React limits the number of renders to prevent " + + "an infinite loop." ); } @@ -10523,9 +10671,10 @@ function renderWithHooks( 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." ); } @@ -10647,8 +10796,8 @@ function updateWorkInProgressHook() { currentHook = nextCurrentHook; } else { // Clone from the current hook. - 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; @@ -10704,7 +10853,7 @@ function mountReducer(reducer, initialArg, init) { lastRenderedState: initialState }; hook.queue = queue; - var dispatch = (queue.dispatch = dispatchAction.bind( + var dispatch = (queue.dispatch = dispatchReducerAction.bind( null, currentlyRenderingFiber$1, queue @@ -10716,8 +10865,8 @@ function updateReducer(reducer, initialArg, init) { var hook = updateWorkInProgressHook(); var queue = hook.queue; - if (!(queue !== null)) { - throw Error( + if (queue === null) { + throw new Error( "Should have a queue. This is likely a bug in React. Please file an issue." ); } @@ -10774,7 +10923,7 @@ function updateReducer(reducer, initialArg, init) { var clone = { lane: updateLane, action: update.action, - eagerReducer: update.eagerReducer, + hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }; @@ -10802,16 +10951,16 @@ function updateReducer(reducer, initialArg, init) { // 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; } // Process this update. - if (update.eagerReducer === reducer) { - // If this update was processed eagerly, and its reducer matches the - // current reducer, we can use the eagerly computed state. + if (update.hasEagerState) { + // If this update is a state update (not a reducer) and was processed eagerly, + // we can use the eagerly computed state newState = update.eagerState; } else { var action = update.action; @@ -10869,8 +11018,8 @@ function rerenderReducer(reducer, initialArg, init) { var hook = updateWorkInProgressHook(); var queue = hook.queue; - if (!(queue !== null)) { - throw Error( + if (queue === null) { + throw new Error( "Should have a queue. This is likely a bug in React. Please file an issue." ); } @@ -10990,56 +11139,20 @@ function readFromUnsubscribedMutableSource(root, source, getSnapshot) { // the synchronous retry, it will block interleaved mutations, so we should // get a consistent read. Therefore, the following error should never be // visible to the user. - // - // If it were to become visible to the user, it suggests one of two things: - // a bug in React, or (more likely), a mutation during the render phase that - // caused the second re-render attempt to be different from the first. - // - // We know it's the second case if the logs are currently disabled. So in - // dev, we can present a more accurate error message. - - { - // eslint-disable-next-line react-internal/no-production-logging - if (getIsStrictModeForDevtools()) { - // If getIsStrictModeForDevtools is true, this is the dev-only double render - // This is only reachable if there was a mutation during render. Show a helpful - // error message. - // - // Something interesting to note: because we only double render in - // development, this error will never happen during production. This is - // actually true of all errors that occur during a double render, - // because if the first render had thrown, we would have exited the - // begin phase without double rendering. We should consider suppressing - // any error from a double render (with a warning) to more closely match - // the production behavior. - var componentName = getComponentNameFromFiber( - currentlyRenderingFiber$1 - ); - - { - throw Error( - "A mutable source was mutated while the " + - componentName + - " component was rendering. This is not supported. Move any mutations into event handlers or effects." - ); - } - } - } // We expect this error not to be thrown during the synchronous retry, + // We expect this error not to be thrown during the synchronous retry, // because we blocked interleaved mutations. - { - throw Error( - "Cannot read from mutable source during the current render without tearing. This may be a bug in React. Please file an issue." - ); - } + throw new Error( + "Cannot read from mutable source during the current render without tearing. This may be a bug in React. Please file an issue." + ); } } function useMutableSource(hook, source, getSnapshot, subscribe) { var root = getWorkInProgressRoot(); - if (!(root !== null)) { - throw Error( + if (root === null) { + throw new Error( "Expected a work-in-progress root. This is a bug in React. Please file an issue." ); } @@ -11171,7 +11284,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { lastRenderedReducer: basicStateReducer, lastRenderedState: snapshot }; - newQueue.dispatch = setSnapshot = dispatchAction.bind( + newQueue.dispatch = setSnapshot = dispatchSetState.bind( null, currentlyRenderingFiber$1, newQueue @@ -11203,25 +11316,46 @@ function updateMutableSource(source, getSnapshot, subscribe) { return useMutableSource(hook, source, getSnapshot, subscribe); } -function mountSyncExternalStore(subscribe, getSnapshot) { +function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { var fiber = currentlyRenderingFiber$1; - var hook = mountWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the - // normal rules of React, and only works because store updates are - // always synchronous. - - var nextSnapshot = getSnapshot(); + var hook = mountWorkInProgressHook(); + var nextSnapshot; { - if (!didWarnUncachedGetSnapshot) { - if (nextSnapshot !== getSnapshot()) { - error( - "The result of getSnapshot should be cached to avoid an infinite loop" - ); + nextSnapshot = getSnapshot(); - didWarnUncachedGetSnapshot = true; + { + if (!didWarnUncachedGetSnapshot) { + if (nextSnapshot !== getSnapshot()) { + error( + "The result of getSnapshot should be cached to avoid an infinite loop" + ); + + didWarnUncachedGetSnapshot = true; + } } + } // Unless we're rendering a blocking lane, schedule a consistency check. + // Right before committing, we will walk the tree and check if any of the + // stores were mutated. + // + // We won't do this if we're hydrating server-rendered content, because if + // the content is stale, it's already visible anyway. Instead we'll patch + // it up in a passive effect. + + var root = getWorkInProgressRoot(); + + if (root === null) { + throw new Error( + "Expected a work-in-progress root. This is a bug in React. Please file an issue." + ); } - } + + if (!includesBlockingLane(root, renderLanes)) { + pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); + } + } // Read the current snapshot from the store on every render. This breaks the + // normal rules of React, and only works because store updates are + // always synchronous. hook.memoizedState = nextSnapshot; var inst = { @@ -11244,26 +11378,11 @@ function mountSyncExternalStore(subscribe, getSnapshot) { updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), undefined, null - ); // Unless we're rendering a blocking lane, schedule a consistency check. Right - // before committing, we will walk the tree and check if any of the stores - // were mutated. - - var root = getWorkInProgressRoot(); - - if (!(root !== null)) { - throw Error( - "Expected a work-in-progress root. This is a bug in React. Please file an issue." - ); - } - - if (!includesBlockingLane(root, renderLanes)) { - pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); - } - + ); return nextSnapshot; } -function updateSyncExternalStore(subscribe, getSnapshot) { +function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { var fiber = currentlyRenderingFiber$1; var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the // normal rules of React, and only works because store updates are @@ -11318,8 +11437,8 @@ function updateSyncExternalStore(subscribe, getSnapshot) { var root = getWorkInProgressRoot(); - if (!(root !== null)) { - throw Error( + if (root === null) { + throw new Error( "Expected a work-in-progress root. This is a bug in React. Please file an issue." ); } @@ -11416,7 +11535,7 @@ function mountState(initialState) { lastRenderedState: initialState }; hook.queue = queue; - var dispatch = (queue.dispatch = dispatchAction.bind( + var dispatch = (queue.dispatch = dispatchSetState.bind( null, currentlyRenderingFiber$1, queue @@ -11894,7 +12013,7 @@ function rerenderOpaqueIdentifier() { return id; } -function dispatchAction(fiber, queue, action) { +function dispatchReducerAction(fiber, queue, action) { { if (typeof arguments[3] === "function") { error( @@ -11905,65 +12024,61 @@ function dispatchAction(fiber, queue, action) { } } - var eventTime = requestEventTime(); var lane = requestUpdateLane(fiber); var update = { lane: lane, action: action, - eagerReducer: null, + hasEagerState: false, eagerState: null, next: null }; - var alternate = fiber.alternate; - - if ( - fiber === currentlyRenderingFiber$1 || - (alternate !== null && alternate === currentlyRenderingFiber$1) - ) { - // This is a render phase update. Stash it in a lazily-created map of - // queue -> linked list of updates. After this render pass, we'll restart - // and apply the stashed updates on top of the work-in-progress hook. - didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true; - var pending = queue.pending; - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; + if (isRenderPhaseUpdate(fiber)) { + enqueueRenderPhaseUpdate(queue, update); } else { - if (isInterleavedUpdate(fiber)) { - var interleaved = queue.interleaved; + enqueueUpdate$1(fiber, queue, update); - if (interleaved === null) { - // This is the first update. Create a circular list. - update.next = update; // At the end of the current render, this queue's interleaved updates will - // be transferred to the pending queue. - - pushInterleavedQueue(queue); - } else { - update.next = interleaved.next; - interleaved.next = update; + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotCurrentlyActingUpdatesInDev(fiber); } + } - queue.interleaved = update; - } else { - var _pending = queue.pending; + var eventTime = requestEventTime(); + var root = scheduleUpdateOnFiber(fiber, lane, eventTime); - if (_pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = _pending.next; - _pending.next = update; - } + if (root !== null) { + entangleTransitionUpdate(root, queue, lane); + } + } +} - queue.pending = update; +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: lane, + action: action, + hasEagerState: false, + eagerState: null, + next: null + }; + + if (isRenderPhaseUpdate(fiber)) { + enqueueRenderPhaseUpdate(queue, update); + } else { + enqueueUpdate$1(fiber, queue, update); + var alternate = fiber.alternate; if ( fiber.lanes === NoLanes && @@ -11989,7 +12104,7 @@ function dispatchAction(fiber, queue, action) { // time we enter the render phase, then the eager state can be used // without calling the reducer again. - update.eagerReducer = lastRenderedReducer; + update.hasEagerState = true; update.eagerState = eagerState; if (objectIs(eagerState, currentState)) { @@ -12009,31 +12124,95 @@ function dispatchAction(fiber, queue, action) { } } - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ("undefined" !== typeof jest) { - warnIfNotCurrentlyActingUpdatesInDev(fiber); - } + { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotCurrentlyActingUpdatesInDev(fiber); + } + } + + var eventTime = requestEventTime(); + var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + + if (root !== null) { + entangleTransitionUpdate(root, queue, lane); + } + } +} + +function isRenderPhaseUpdate(fiber) { + var alternate = fiber.alternate; + return ( + fiber === currentlyRenderingFiber$1 || + (alternate !== null && alternate === currentlyRenderingFiber$1) + ); +} + +function enqueueRenderPhaseUpdate(queue, update) { + // This is a render phase update. Stash it in a lazily-created map of + // queue -> linked list of updates. After this render pass, we'll restart + // and apply the stashed updates on top of the work-in-progress hook. + didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true; + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + queue.pending = update; +} + +function enqueueUpdate$1(fiber, queue, update, lane) { + if (isInterleavedUpdate(fiber)) { + var interleaved = queue.interleaved; + + if (interleaved === null) { + // This is the first update. Create a circular list. + update.next = update; // At the end of the current render, this queue's interleaved updates will + // be transferred to the pending queue. + + pushInterleavedQueue(queue); + } else { + update.next = interleaved.next; + interleaved.next = update; + } + + queue.interleaved = update; + } else { + var pending = queue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; } - var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + queue.pending = update; + } +} - if (isTransitionLane(lane) && root !== null) { - var queueLanes = queue.lanes; // If any entangled lanes are no longer pending on the root, then they - // must have finished. We can remove them from the shared queue, which - // represents a superset of the actually pending lanes. In some cases we - // may entangle more than we need to, but that's OK. In fact it's worse if - // we *don't* entangle when we should. +function entangleTransitionUpdate(root, queue, lane) { + if (isTransitionLane(lane)) { + var queueLanes = queue.lanes; // If any entangled lanes are no longer pending on the root, then they + // must have finished. We can remove them from the shared queue, which + // represents a superset of the actually pending lanes. In some cases we + // may entangle more than we need to, but that's OK. In fact it's worse if + // we *don't* entangle when we should. - queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. + queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. - var newQueueLanes = mergeLanes(queueLanes, lane); - queue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if - // the lane finished since the last time we entangled it. So we need to - // entangle it again, just to be sure. + var newQueueLanes = mergeLanes(queueLanes, lane); + queue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if + // the lane finished since the last time we entangled it. So we need to + // entangle it again, just to be sure. - markRootEntangled(root, newQueueLanes); - } + markRootEntangled(root, newQueueLanes); } } @@ -12186,7 +12365,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; mountHookTypesDev(); return mountMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; mountHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot); @@ -12294,7 +12473,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return mountMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; updateHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot); @@ -12402,7 +12581,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); @@ -12510,7 +12689,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); @@ -12633,7 +12812,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; mountHookTypesDev(); return mountMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; warnInvalidHookAccess(); mountHookTypesDev(); @@ -12758,7 +12937,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; warnInvalidHookAccess(); updateHookTypesDev(); @@ -12883,7 +13062,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateMutableSource(source, getSnapshot, subscribe); }, - useSyncExternalStore: function(subscribe, getSnapshot) { + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { currentHookNameInDev = "useSyncExternalStore"; warnInvalidHookAccess(); updateHookTypesDev(); @@ -13075,12 +13254,10 @@ function createCapturedValue(value, source) { } if ( - !( - typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog === - "function" - ) + typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog !== + "function" ) { - throw Error( + throw new Error( "Expected ReactFiberErrorDialog.showErrorDialog to be a function." ); } @@ -13266,129 +13443,144 @@ function createClassErrorUpdate(fiber, errorInfo, lane) { return update; } -function attachPingListener(root, wakeable, lanes) { - // Attach a listener to the promise to "ping" the root and retry. But only if - // one does not already exist for the lanes we're currently rendering (which - // acts like a "thread ID" here). - var pingCache = root.pingCache; - var threadIDs; - - if (pingCache === null) { - pingCache = root.pingCache = new PossiblyWeakMap$1(); - threadIDs = new Set(); - pingCache.set(wakeable, threadIDs); - } else { - threadIDs = pingCache.get(wakeable); - - if (threadIDs === undefined) { +function attachWakeableListeners(suspenseBoundary, root, wakeable, lanes) { + // Attach a ping listener + // + // The data might resolve before we have a chance to commit the fallback. Or, + // in the case of a refresh, we'll never commit a fallback. So we need to + // attach a listener now. When it resolves ("pings"), we can decide whether to + // try rendering the tree again. + // + // Only attach a listener if one does not already exist for the lanes + // we're currently rendering (which acts like a "thread ID" here). + // + // We only need to do this in concurrent mode. Legacy Suspense always + // commits fallbacks synchronously, so there are no pings. + if (suspenseBoundary.mode & ConcurrentMode) { + var pingCache = root.pingCache; + var threadIDs; + + if (pingCache === null) { + pingCache = root.pingCache = new PossiblyWeakMap$1(); threadIDs = new Set(); pingCache.set(wakeable, threadIDs); + } else { + threadIDs = pingCache.get(wakeable); + + if (threadIDs === undefined) { + threadIDs = new Set(); + pingCache.set(wakeable, threadIDs); + } } - } - if (!threadIDs.has(lanes)) { - // Memoize using the thread ID to prevent redundant listeners. - threadIDs.add(lanes); - var ping = pingSuspendedRoot.bind(null, root, wakeable, lanes); + if (!threadIDs.has(lanes)) { + // Memoize using the thread ID to prevent redundant listeners. + threadIDs.add(lanes); + var ping = pingSuspendedRoot.bind(null, root, wakeable, lanes); - { - if (isDevToolsPresent) { - // If we have pending work still, restore the original updaters - restorePendingUpdaters(root, lanes); + { + if (isDevToolsPresent) { + // If we have pending work still, restore the original updaters + restorePendingUpdaters(root, lanes); + } } + + wakeable.then(ping, ping); } + } // Retry listener + // + // If the fallback does commit, we need to attach a different type of + // listener. This one schedules an update on the Suspense boundary to turn + // the fallback state off. + // + // Stash the wakeable on the boundary fiber so we can access it in the + // commit phase. + // + // When the wakeable resolves, we'll attempt to render the boundary + // again ("retry"). + + var wakeables = suspenseBoundary.updateQueue; - wakeable.then(ping, ping); + if (wakeables === null) { + var updateQueue = new Set(); + updateQueue.add(wakeable); + suspenseBoundary.updateQueue = updateQueue; + } else { + wakeables.add(wakeable); } } -function throwException( - root, - returnFiber, - sourceFiber, - value, - rootRenderLanes -) { - // The source fiber did not complete. - sourceFiber.flags |= Incomplete; +function resetSuspendedComponent(sourceFiber, rootRenderLanes) { + // A legacy mode Suspense quirk, only relevant to hook components. - { - if (isDevToolsPresent) { - // If we have pending work still, restore the original updaters - restorePendingUpdaters(root, rootRenderLanes); - } - } + var tag = sourceFiber.tag; if ( - value !== null && - typeof value === "object" && - typeof value.then === "function" + (sourceFiber.mode & ConcurrentMode) === NoMode && + (tag === FunctionComponent || + tag === ForwardRef || + tag === SimpleMemoComponent) ) { - var wakeable = value; - // A legacy mode Suspense quirk, only relevant to hook components. - - var tag = sourceFiber.tag; - - if ( - (sourceFiber.mode & ConcurrentMode) === NoMode && - (tag === FunctionComponent || - tag === ForwardRef || - tag === SimpleMemoComponent) - ) { - var currentSource = sourceFiber.alternate; + 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; - } + 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 - ); // Schedule the nearest Suspense to re-render the timed out view. +function markNearestSuspenseBoundaryShouldCapture( + returnFiber, + sourceFiber, + root, + rootRenderLanes +) { + var hasInvisibleParentBoundary = hasSuspenseContext( + suspenseStackCursor.current, + InvisibleParentSuspenseContext + ); + var node = returnFiber; - var _workInProgress = returnFiber; + do { + if ( + node.tag === SuspenseComponent && + shouldCaptureSuspense(node, hasInvisibleParentBoundary) + ) { + // Found the nearest boundary. + var suspenseBoundary = node; // This marks a Suspense boundary so that when we're unwinding the stack, + // it captures the suspended "exception" and does a second (fallback) pass. - do { - if ( - _workInProgress.tag === SuspenseComponent && - shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary) - ) { - // Found the nearest boundary. - // Stash the promise on the boundary fiber. If the boundary times out, we'll - // attach another listener to flip the boundary back to its normal state. - var wakeables = _workInProgress.updateQueue; - - if (wakeables === null) { - var updateQueue = new Set(); - updateQueue.add(wakeable); - _workInProgress.updateQueue = updateQueue; - } else { - wakeables.add(wakeable); - } // If the boundary is in legacy mode, we should *not* - // suspend the commit. Pretend as if the suspended component rendered - // null and keep rendering. In the commit phase, we'll schedule a - // subsequent synchronous update to re-render the Suspense. - // - // Note: It doesn't matter whether the component that suspended was - // inside a concurrent mode tree. If the Suspense is outside of it, we - // should *not* suspend the commit. + if ((suspenseBoundary.mode & ConcurrentMode) === NoMode) { + // Legacy Mode Suspense // - // If the suspense boundary suspended itself suspended, we don't have to - // do this trick because nothing was partially started. We can just - // directly do a second pass over the fallback in this render and - // pretend we meant to render that directly. - - if ( - (_workInProgress.mode & ConcurrentMode) === NoMode && - _workInProgress !== returnFiber - ) { - _workInProgress.flags |= DidCapture; + // If the boundary is in legacy mode, we should *not* + // suspend the commit. Pretend as if the suspended component rendered + // null and keep rendering. When the Suspense boundary completes, + // we'll do a second pass to render the fallback. + if (suspenseBoundary === returnFiber) { + // Special case where we suspended while reconciling the children of + // a Suspense boundary's inner Offscreen wrapper fiber. This happens + // when a React.lazy component is a direct child of a + // Suspense boundary. + // + // Suspense boundaries are implemented as multiple fibers, but they + // are a single conceptual unit. The legacy mode behavior where we + // pretend the suspended fiber committed as `null` won't work, + // because in this case the "suspended" fiber is the inner + // Offscreen wrapper. + // + // Because the contents of the boundary haven't started rendering + // yet (i.e. nothing in the tree has partially rendered) we can + // switch to the regular, concurrent mode behavior: mark the + // boundary with ShouldCapture and enter the unwind phase. + suspenseBoundary.flags |= ShouldCapture; + } else { + suspenseBoundary.flags |= DidCapture; sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete. // But we shouldn't call any lifecycle methods or callbacks. Remove // all lifecycle effect tags. @@ -13396,9 +13588,9 @@ function throwException( sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete); if (sourceFiber.tag === ClassComponent) { - var _currentSourceFiber = sourceFiber.alternate; + var currentSourceFiber = sourceFiber.alternate; - if (_currentSourceFiber === null) { + if (currentSourceFiber === null) { // This is a new mount. Change the tag so it's not mistaken for a // completed class component. For example, we should not call // componentWillUnmount if it is deleted. @@ -13414,70 +13606,118 @@ function throwException( } // The source fiber did not complete. Mark it with Sync priority to // indicate that it still has pending work. - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); // Exit without suspending. + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); + } - return; - } // Confirmed that the boundary is in a concurrent mode tree. Continue - // with the normal suspend path. - // - // After this we'll use a set of heuristics to determine whether this - // render pass will run to completion or restart or "suspend" the commit. - // The actual logic for this is spread out in different places. - // - // This first principle is that if we're going to suspend when we complete - // a root, then we should also restart if we get an update or ping that - // might unsuspend it, and vice versa. The only reason to suspend is - // because you think you might want to restart before committing. However, - // it doesn't make sense to restart only while in the period we're suspended. - // - // Restarting too aggressively is also not good because it starves out any - // intermediate loading state. So we use heuristics to determine when. - // Suspense Heuristics - // - // If nothing threw a Promise or all the same fallbacks are already showing, - // then don't suspend/restart. - // - // If this is an initial render of a new tree of Suspense boundaries and - // those trigger a fallback, then don't suspend/restart. We want to ensure - // that we can show the initial loading state as quickly as possible. - // - // If we hit a "Delayed" case, such as when we'd switch from content back into - // a fallback, then we should always suspend/restart. Transitions apply - // to this case. If none is defined, JND is used instead. - // - // If we're already showing a fallback and it gets "retried", allowing us to show - // another level, but there's still an inner boundary that would show a fallback, - // then we suspend/restart for 500ms since the last time we showed a fallback - // anywhere in the tree. This effectively throttles progressive loading into a - // consistent train of commits. This also gives us an opportunity to restart to - // get to the completed state slightly earlier. - // - // If there's ambiguity due to batching it's resolved in preference of: - // 1) "delayed", 2) "initial render", 3) "retry". - // - // We want to ensure that a "busy" state doesn't get force committed. We want to - // ensure that new initial loading states can commit as soon as possible. + return suspenseBoundary; + } // Confirmed that the boundary is in a concurrent mode tree. Continue + // with the normal suspend path. + // + // After this we'll use a set of heuristics to determine whether this + // render pass will run to completion or restart or "suspend" the commit. + // The actual logic for this is spread out in different places. + // + // This first principle is that if we're going to suspend when we complete + // a root, then we should also restart if we get an update or ping that + // might unsuspend it, and vice versa. The only reason to suspend is + // because you think you might want to restart before committing. However, + // it doesn't make sense to restart only while in the period we're suspended. + // + // Restarting too aggressively is also not good because it starves out any + // intermediate loading state. So we use heuristics to determine when. + // Suspense Heuristics + // + // If nothing threw a Promise or all the same fallbacks are already showing, + // then don't suspend/restart. + // + // If this is an initial render of a new tree of Suspense boundaries and + // those trigger a fallback, then don't suspend/restart. We want to ensure + // that we can show the initial loading state as quickly as possible. + // + // If we hit a "Delayed" case, such as when we'd switch from content back into + // a fallback, then we should always suspend/restart. Transitions apply + // to this case. If none is defined, JND is used instead. + // + // If we're already showing a fallback and it gets "retried", allowing us to show + // another level, but there's still an inner boundary that would show a fallback, + // then we suspend/restart for 500ms since the last time we showed a fallback + // anywhere in the tree. This effectively throttles progressive loading into a + // consistent train of commits. This also gives us an opportunity to restart to + // get to the completed state slightly earlier. + // + // If there's ambiguity due to batching it's resolved in preference of: + // 1) "delayed", 2) "initial render", 3) "retry". + // + // We want to ensure that a "busy" state doesn't get force committed. We want to + // ensure that new initial loading states can commit as soon as possible. - attachPingListener(root, wakeable, rootRenderLanes); - _workInProgress.flags |= ShouldCapture; // TODO: I think we can remove this, since we now use `DidCapture` in - // the begin phase to prevent an early bailout. + suspenseBoundary.flags |= ShouldCapture; // TODO: I think we can remove this, since we now use `DidCapture` in + // the begin phase to prevent an early bailout. - _workInProgress.lanes = rootRenderLanes; - return; - } // This boundary already captured during this render. Continue to the next - // boundary. + suspenseBoundary.lanes = rootRenderLanes; + return suspenseBoundary; + } // This boundary already captured during this render. Continue to the next + // boundary. - _workInProgress = _workInProgress.return; - } while (_workInProgress !== null); // No boundary was found. Fallthrough to error mode. - // TODO: Use invariant so the message is stripped in prod? + node = node.return; + } while (node !== null); // Could not find a Suspense boundary capable of capturing. - value = new Error( - (getComponentNameFromFiber(sourceFiber) || "A React component") + - " suspended while rendering, but no fallback UI was specified.\n" + - "\n" + - "Add a component higher in the tree to " + - "provide a loading indicator or placeholder to display." + return null; +} + +function throwException( + root, + returnFiber, + sourceFiber, + value, + rootRenderLanes +) { + // The source fiber did not complete. + sourceFiber.flags |= Incomplete; + + { + if (isDevToolsPresent) { + // If we have pending work still, restore the original updaters + restorePendingUpdaters(root, rootRenderLanes); + } + } + + if ( + value !== null && + typeof value === "object" && + typeof value.then === "function" + ) { + // This is a wakeable. The component suspended. + var wakeable = value; + resetSuspendedComponent(sourceFiber); + + var suspenseBoundary = markNearestSuspenseBoundaryShouldCapture( + returnFiber, + sourceFiber, + root, + rootRenderLanes ); + + if (suspenseBoundary !== null) { + attachWakeableListeners( + suspenseBoundary, + root, + wakeable, + rootRenderLanes + ); + return; + } else { + // No boundary was found. Fallthrough to error mode. + // TODO: We should never call getComponentNameFromFiber in production. + // Log a warning or something to prevent us from accidentally bundling it. + value = new Error( + (getComponentNameFromFiber(sourceFiber) || "A React component") + + " suspended while rendering, but no fallback UI was specified.\n" + + "\n" + + "Add a component higher in the tree to " + + "provide a loading indicator or placeholder to display." + ); + } } // We didn't find a boundary that could handle this type of exception. Start // over and traverse parent path again, this time treating the exception // as an error. @@ -13493,10 +13733,8 @@ function throwException( workInProgress.flags |= ShouldCapture; var lane = pickArbitraryLane(rootRenderLanes); workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); - - var _update = createRootErrorUpdate(workInProgress, _errorInfo, lane); - - enqueueCapturedUpdate(workInProgress, _update); + var update = createRootErrorUpdate(workInProgress, _errorInfo, lane); + enqueueCapturedUpdate(workInProgress, update); return; } @@ -13519,13 +13757,13 @@ function throwException( workInProgress.lanes = mergeLanes(workInProgress.lanes, _lane); // Schedule the error boundary to re-render using updated state - var _update2 = createClassErrorUpdate( + var _update = createClassErrorUpdate( workInProgress, errorInfo, _lane ); - enqueueCapturedUpdate(workInProgress, _update2); + enqueueCapturedUpdate(workInProgress, _update); return; } @@ -13912,7 +14150,7 @@ function completeWork(current, workInProgress, renderLanes) { // If we hydrated, then we'll need to schedule an update for // the commit side-effects on the root. markUpdate(workInProgress); - } else if (!fiberRoot.hydrate) { + } else if (!fiberRoot.isDehydrated) { // Schedule an effect to clear this container at the start of the next commit. // This handles the case of React rendering into a container with previous children. // It's also safe to do for updates too, because current.child would only be null @@ -13945,9 +14183,10 @@ function completeWork(current, workInProgress, renderLanes) { } } else { if (!newProps) { - if (!(workInProgress.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 (workInProgress.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." ); } // This can happen when we abort work. @@ -14008,9 +14247,10 @@ function completeWork(current, workInProgress, renderLanes) { updateHostText(current, workInProgress, oldText, newText); } else { if (typeof newText !== "string") { - if (!(workInProgress.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 (workInProgress.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." ); } // This can happen when we abort work. } @@ -14427,13 +14667,12 @@ function completeWork(current, workInProgress, renderLanes) { } } - { - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); - } + throw new Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in " + + "React. Please file an issue." + ); } var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; @@ -15080,7 +15319,8 @@ function updateClassComponent( case true: { workInProgress.flags |= DidCapture; - workInProgress.flags |= ShouldCapture; + workInProgress.flags |= ShouldCapture; // eslint-disable-next-line react-internal/prod-error-codes + var error$1 = new Error("Simulated error coming from DevTools"); var lane = pickArbitraryLane(renderLanes); workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); // Schedule the error boundary to re-render using updated state @@ -15294,9 +15534,11 @@ function updateHostRoot(current, workInProgress, renderLanes) { pushHostRootContext(workInProgress); var updateQueue = workInProgress.updateQueue; - if (!(current !== 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 (current === null || updateQueue === null) { + throw new 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." ); } @@ -15315,7 +15557,7 @@ function updateHostRoot(current, workInProgress, renderLanes) { return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } - if (root.hydrate && enterHydrationState()) { + if (root.isDehydrated && enterHydrationState()) { var child = mountChildFibers( workInProgress, null, @@ -15491,14 +15733,12 @@ function mountLazyComponent( // because the fact that it's a separate type of work is an // implementation detail. - { - throw Error( - "Element type is invalid. Received a promise that resolves to: " + - Component + - ". Lazy element type must resolve to a class or function." + - hint - ); - } + throw new Error( + "Element type is invalid. Received a promise that resolves to: " + + Component + + ". " + + ("Lazy element type must resolve to a class or function." + hint) + ); } function mountIncompleteClassComponent( @@ -16874,6 +17114,7 @@ function remountFiber(current, oldWorkInProgress, newWorkInProgress) { var returnFiber = oldWorkInProgress.return; if (returnFiber === null) { + // eslint-disable-next-line react-internal/prod-error-codes throw new Error("Cannot swap the root fiber."); } // Disconnect from the old current. // It will get deleted. @@ -16892,6 +17133,7 @@ function remountFiber(current, oldWorkInProgress, newWorkInProgress) { var prevSibling = returnFiber.child; if (prevSibling === null) { + // eslint-disable-next-line react-internal/prod-error-codes throw new Error("Expected parent to have a child."); } @@ -16899,6 +17141,7 @@ function remountFiber(current, oldWorkInProgress, newWorkInProgress) { prevSibling = prevSibling.sibling; if (prevSibling === null) { + // eslint-disable-next-line react-internal/prod-error-codes throw new Error("Expected to find the previous sibling."); } } @@ -17368,13 +17611,12 @@ function beginWork(current, workInProgress, renderLanes) { } } - { - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); - } + throw new Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in " + + "React. Please file an issue." + ); } function unwindWork(workInProgress, renderLanes) { @@ -17407,9 +17649,10 @@ function unwindWork(workInProgress, renderLanes) { resetWorkInProgressVersions(); var _flags = workInProgress.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 & DidCapture) !== NoFlags) { + throw new Error( + "The root failed to unmount after an error. This is likely a bug in " + + "React. Please file an issue." ); } @@ -17766,11 +18009,10 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { break; default: { - { - 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." - ); - } + 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." + ); } } @@ -18236,11 +18478,11 @@ function commitLayoutEffectOnFiber( case LegacyHiddenComponent: break; - default: { - 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." + 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." ); - } } } @@ -18609,11 +18851,10 @@ function getHostParentFiber(fiber) { 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) { @@ -18698,11 +18939,11 @@ function commitPlacement(finishedWork) { break; // eslint-disable-next-line-no-fallthrough - default: { - throw Error( - "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + default: + throw new Error( + "Invalid host parent fiber. This error is likely caused by a bug " + + "in React. Please file an issue." ); - } } if (parentFiber.flags & ContentReset) { @@ -18791,9 +19032,10 @@ function unmountHostComponents(finishedRoot, current, nearestMountedAncestor) { 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." + if (parent === null) { + throw new Error( + "Expected to find a host parent. This error is likely caused by " + + "a bug in React. Please file an issue." ); } @@ -18952,9 +19194,10 @@ function commitWork(current, finishedWork) { } case HostText: { - if (!(finishedWork.stateNode !== null)) { - 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." ); } @@ -18992,11 +19235,10 @@ function commitWork(current, finishedWork) { } } - { - 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." - ); - } + 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." + ); } function commitSuspenseCallback(finishedWork) { @@ -20124,8 +20366,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { currentEventTime = NoTimestamp; currentEventTransitionLane = NoLanes; - 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."); } // Flush any pending passive effects before deciding which lanes to work on, // in case they schedule additional work. @@ -20245,8 +20487,8 @@ function recoverFromConcurrentError(root, errorRetryLanes) { executionContext |= RetryAfterError; // If an error occurred during hydration, discard server response and fall // back to client side render. - if (root.hydrate) { - root.hydrate = false; + if (root.isDehydrated) { + root.isDehydrated = false; { errorHydratingContainer(root.containerInfo); @@ -20264,9 +20506,7 @@ function finishConcurrentRender(root, exitStatus, lanes) { switch (exitStatus) { case RootIncomplete: 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."); } // Flow knows about invariant, so it complains if I add a break // statement, but eslint doesn't know about invariant, so it complains @@ -20371,9 +20611,7 @@ function finishConcurrentRender(root, exitStatus, lanes) { } default: { - { - throw Error("Unknown root exit status."); - } + throw new Error("Unknown root exit status."); } } } @@ -20456,8 +20694,8 @@ function performSyncWorkOnRoot(root) { syncNestedUpdateFlag(); } - 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."); } flushPassiveEffects(); @@ -20476,8 +20714,8 @@ function performSyncWorkOnRoot(root) { executionContext |= RetryAfterError; // If an error occurred during hydration, // discard server response and fall back to client side render. - if (root.hydrate) { - root.hydrate = false; + if (root.isDehydrated) { + root.isDehydrated = false; { errorHydratingContainer(root.containerInfo); @@ -20539,7 +20777,7 @@ function batchedUpdates$1(fn, a) { // Warning, this opts-out of checking the function body. // eslint-disable-next-line no-redeclare -function flushSyncWithoutWarningIfAlreadyRendering(fn) { +function flushSync(fn) { // In legacy mode, we flush pending passive effects at the beginning of the // next event, not at the end of the previous one. if ( @@ -20575,22 +20813,6 @@ function flushSyncWithoutWarningIfAlreadyRendering(fn) { flushSyncCallbacks(); } } -} // Overload the definition to the two valid signatures. -// Warning, this opts-out of checking the function body. - -// eslint-disable-next-line no-redeclare -function flushSync(fn) { - { - if ((executionContext & (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 flushSyncWithoutWarningIfAlreadyRendering(fn); } function pushRenderLanes(fiber, lanes) { push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber); @@ -20679,6 +20901,29 @@ function handleError(root, thrownValue) { 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( root, erroredWork.return, @@ -20742,7 +20987,8 @@ function renderDidSuspend() { function renderDidSuspendDelayIfPossible() { if ( workInProgressRootExitStatus === RootIncomplete || - workInProgressRootExitStatus === RootSuspended + workInProgressRootExitStatus === RootSuspended || + workInProgressRootExitStatus === RootErrored ) { workInProgressRootExitStatus = RootSuspendedWithDelay; } // Check if there are updates that we skipped tree that might have unblocked @@ -20764,7 +21010,7 @@ function renderDidSuspendDelayIfPossible() { } } function renderDidError() { - if (workInProgressRootExitStatus !== RootCompleted) { + if (workInProgressRootExitStatus !== RootSuspendedWithDelay) { workInProgressRootExitStatus = RootErrored; } } // Called during render to determine if anything has suspended. @@ -20817,11 +21063,10 @@ function renderRootSync(root, lanes) { if (workInProgress !== null) { // This is a sync render, so we should have finished the whole tree. - { - 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." + ); } workInProgressRoot = null; @@ -21045,8 +21290,8 @@ function commitRootImpl(root, renderPriorityLevel) { 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 = root.finishedWork; @@ -21068,9 +21313,10 @@ function commitRootImpl(root, renderPriorityLevel) { root.finishedWork = null; root.finishedLanes = NoLanes; - if (!(finishedWork !== root.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 === root.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." ); } // commitRoot never returns a continuation; it always finishes synchronously. // So we can clear these now to allow a new callback to be scheduled. @@ -21312,8 +21558,8 @@ function flushPassiveEffectsImpl() { 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."); } var prevExecutionContext = executionContext; @@ -21559,12 +21805,12 @@ function checkForNestedUpdates() { 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." + ); } { @@ -21770,7 +22016,7 @@ var beginWork$1; originalError._suppressLogging = true; } } // We always throw the original error in case the second render pass is not idempotent. - // This can happen if a memoized function or CommonJS module doesn't throw after first invokation. + // This can happen if a memoized function or CommonJS module doesn't throw after first invocation. throw originalError; } @@ -21949,6 +22195,7 @@ function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; +/* eslint-disable react-internal/prod-error-codes */ var resolveFamily = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below. var failedBoundaries = null; @@ -22842,14 +23089,11 @@ function createFiberFromTypeAndProps( } } - { - 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) + ); } } } @@ -22868,9 +23112,7 @@ function createFiberFromTypeAndProps( function createOffscreenHostContainerFiber(props, fiberMode, lanes, key) { { // Only implemented in persistent mode - { - throw Error("Not implemented."); - } + throw new Error("Not implemented."); } } function createFiberFromElement(element, mode, lanes) { @@ -23029,7 +23271,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.timeoutHandle = noTimeout; this.context = null; this.pendingContext = null; - this.hydrate = hydrate; + this.isDehydrated = hydrate; this.callbackNode = null; this.callbackPriority = NoLane; this.eventTimes = createLaneMap(NoLanes); @@ -23060,11 +23302,11 @@ function FiberRootNode(containerInfo, tag, hydrate) { { switch (tag) { case ConcurrentRoot: - this._debugRootType = "createRoot()"; + this._debugRootType = hydrate ? "hydrateRoot()" : "createRoot()"; break; case LegacyRoot: - this._debugRootType = "createLegacyRoot()"; + this._debugRootType = hydrate ? "hydrate()" : "render()"; break; } } @@ -23107,6 +23349,11 @@ function createPortal( ) { var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; + + { + checkKeyStringCoercion(key); + } + return { // This tag allow us to uniquely identify this as a React Portal $$typeof: REACT_PORTAL_TYPE, @@ -23150,16 +23397,12 @@ function findHostInstanceWithWarning(component, methodName) { if (fiber === undefined) { 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 + ); } } @@ -23328,7 +23571,6 @@ var shouldSuspendImpl = function(fiber) { function shouldSuspend(fiber) { return shouldSuspendImpl(fiber); } -var isStrictMode = false; var overrideHookState = null; var overrideHookStateDeletePath = null; var overrideHookStateRenamePath = null; @@ -23551,20 +23793,6 @@ function getCurrentFiberForDevTools() { return current; } -function getIsStrictModeForDevtools() { - return isStrictMode; -} -function setIsStrictModeForDevtools(newIsStrictMode) { - isStrictMode = newIsStrictMode; - - { - if (newIsStrictMode) { - disableLogs(); - } else { - reenableLogs(); - } - } -} function injectIntoDevTools(devToolsConfig) { var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; @@ -23593,7 +23821,6 @@ function injectIntoDevTools(devToolsConfig) { setRefreshHandler: setRefreshHandler, // Enables DevTools to append owner stacks to error messages in DEV mode. getCurrentFiber: getCurrentFiberForDevTools, - getIsStrictMode: getIsStrictModeForDevtools, // Enables DevTools to detect reconciler version rather than renderer version // which may not match for third party renderers. reconcilerVersion: ReactVersion diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index e748bf48d9ef87..fc9aa87d9e9342 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<5c359ba9bcb80e09d414cf763d94b5d5>> + * @generated SignedSource<> */ "use strict"; @@ -782,18 +782,16 @@ function recomputePluginOrdering() { for (var pluginName in namesToPlugins) { var pluginModule = namesToPlugins[pluginName], pluginIndex = eventPluginOrder.indexOf(pluginName); - if (!(-1 < pluginIndex)) + if (-1 >= pluginIndex) throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + - pluginName + - "`." + (pluginName + "`.") ); if (!plugins[pluginIndex]) { if (!pluginModule.extractEvents) throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + - pluginName + - "` does not." + (pluginName + "` does not.") ); plugins[pluginIndex] = pluginModule; pluginIndex = pluginModule.eventTypes; @@ -804,8 +802,7 @@ function recomputePluginOrdering() { if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0)) throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + - eventName$jscomp$0 + - "`." + (eventName$jscomp$0 + "`.") ); eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig; var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; @@ -845,8 +842,7 @@ function publishRegistrationName(registrationName, pluginModule) { if (registrationNameModules[registrationName]) throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + - registrationName + - "`." + (registrationName + "`.") ); registrationNameModules[registrationName] = pluginModule; } @@ -930,7 +926,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_225 = { +var injectedNamesToPlugins$jscomp$inline_222 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -965,34 +961,33 @@ var injectedNamesToPlugins$jscomp$inline_225 = { } } }, - isOrderingDirty$jscomp$inline_226 = !1, - pluginName$jscomp$inline_227; -for (pluginName$jscomp$inline_227 in injectedNamesToPlugins$jscomp$inline_225) + isOrderingDirty$jscomp$inline_223 = !1, + pluginName$jscomp$inline_224; +for (pluginName$jscomp$inline_224 in injectedNamesToPlugins$jscomp$inline_222) if ( - injectedNamesToPlugins$jscomp$inline_225.hasOwnProperty( - pluginName$jscomp$inline_227 + injectedNamesToPlugins$jscomp$inline_222.hasOwnProperty( + pluginName$jscomp$inline_224 ) ) { - var pluginModule$jscomp$inline_228 = - injectedNamesToPlugins$jscomp$inline_225[pluginName$jscomp$inline_227]; + var pluginModule$jscomp$inline_225 = + injectedNamesToPlugins$jscomp$inline_222[pluginName$jscomp$inline_224]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_227) || - namesToPlugins[pluginName$jscomp$inline_227] !== - pluginModule$jscomp$inline_228 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_224) || + namesToPlugins[pluginName$jscomp$inline_224] !== + pluginModule$jscomp$inline_225 ) { - if (namesToPlugins[pluginName$jscomp$inline_227]) + if (namesToPlugins[pluginName$jscomp$inline_224]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName$jscomp$inline_227 + - "`." + (pluginName$jscomp$inline_224 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_227 - ] = pluginModule$jscomp$inline_228; - isOrderingDirty$jscomp$inline_226 = !0; + pluginName$jscomp$inline_224 + ] = pluginModule$jscomp$inline_225; + isOrderingDirty$jscomp$inline_223 = !0; } } -isOrderingDirty$jscomp$inline_226 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_223 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -1293,7 +1288,7 @@ function getNearestMountedFiber(fiber) { fiber = node; do (node = fiber), - 0 !== (node.flags & 2050) && (nearestMounted = node.return), + 0 !== (node.flags & 4098) && (nearestMounted = node.return), (fiber = node.return); while (fiber); } @@ -2376,7 +2371,7 @@ function processUpdateQueue( newState = workInProgress; break a; case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 128; + workInProgress.flags = (workInProgress.flags & -65537) | 128; case 0: workInProgress = update.payload; updateLane = @@ -2629,7 +2624,8 @@ function coerceRef(returnFiber, current, element) { returnFiber + ". This error is likely caused by a bug in React. Please file an issue." ); - var stringRef = "" + returnFiber; + var resolvedInst = inst, + stringRef = "" + returnFiber; if ( null !== current && null !== current.ref && @@ -2638,8 +2634,8 @@ function coerceRef(returnFiber, current, element) { ) return current.ref; current = function(value) { - var refs = inst.refs; - refs === emptyRefsObject && (refs = inst.refs = {}); + var refs = resolvedInst.refs; + refs === emptyRefsObject && (refs = resolvedInst.refs = {}); null === value ? delete refs[stringRef] : (refs[stringRef] = value); }; current._stringRef = stringRef; @@ -3338,7 +3334,7 @@ function renderWithHooks( nextRenderLanes = 0; do { didScheduleRenderPhaseUpdateDuringThisPass = !1; - if (!(25 > nextRenderLanes)) + if (25 <= nextRenderLanes) throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." ); @@ -3439,19 +3435,18 @@ function updateReducer(reducer) { (newBaseQueueLast = newBaseQueueLast.next = { lane: 0, action: update.action, - eagerReducer: update.eagerReducer, + hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }), - (current = - update.eagerReducer === reducer - ? update.eagerState - : reducer(current, update.action)); + (current = update.hasEagerState + ? update.eagerState + : reducer(current, update.action)); else { var clone = { lane: updateLane, action: update.action, - eagerReducer: update.eagerReducer, + hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }; @@ -3591,7 +3586,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { lastRenderedReducer: basicStateReducer, lastRenderedState: snapshot }), - (hook.dispatch = setSnapshot = dispatchAction.bind( + (hook.dispatch = setSnapshot = dispatchSetState.bind( null, currentlyRenderingFiber$1, hook @@ -3608,30 +3603,30 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot) { var fiber = currentlyRenderingFiber$1, - hook = mountWorkInProgressHook(), - nextSnapshot = getSnapshot(); + hook = mountWorkInProgressHook(); + var nextSnapshot = getSnapshot(); + var root = workInProgressRoot; + if (null === root) + throw Error( + "Expected a work-in-progress root. This is a bug in React. Please file an issue." + ); + includesBlockingLane(root, renderLanes) || + pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); hook.memoizedState = nextSnapshot; - var inst = { value: nextSnapshot, getSnapshot: getSnapshot }; - hook.queue = inst; - mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]); - fiber.flags |= 1024; + root = { value: nextSnapshot, getSnapshot: getSnapshot }; + hook.queue = root; + mountEffect(subscribeToStore.bind(null, fiber, root, subscribe), [subscribe]); + fiber.flags |= 2048; pushEffect( 9, - updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), + updateStoreInstance.bind(null, fiber, root, nextSnapshot, getSnapshot), void 0, null ); - subscribe = workInProgressRoot; - if (null === subscribe) - throw Error( - "Expected a work-in-progress root. This is a bug in React. Please file an issue." - ); - includesBlockingLane(subscribe, renderLanes) || - pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); return nextSnapshot; } function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { - fiber.flags |= 8192; + fiber.flags |= 16384; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; getSnapshot = currentlyRenderingFiber$1.updateQueue; null === getSnapshot @@ -3676,7 +3671,7 @@ function mountState(initialState) { lastRenderedState: initialState }; hook.queue = initialState; - initialState = initialState.dispatch = dispatchAction.bind( + initialState = initialState.dispatch = dispatchSetState.bind( null, currentlyRenderingFiber$1, initialState @@ -3728,10 +3723,10 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { - return mountEffectImpl(2098176, 8, create, deps); + return mountEffectImpl(4196352, 8, create, deps); } function updateEffect(create, deps) { - return updateEffectImpl(1024, 8, create, deps); + return updateEffectImpl(2048, 8, create, deps); } function updateInsertionEffect(create, deps) { return updateEffectImpl(4, 2, create, deps); @@ -3808,47 +3803,35 @@ function startTransition(setPending, callback) { (ReactCurrentBatchConfig$1.transition = prevTransition); } } -function dispatchAction(fiber, queue, action) { - var eventTime = requestEventTime(), - lane = requestUpdateLane(fiber), +function dispatchReducerAction(fiber, queue, action) { + var lane = requestUpdateLane(fiber); + action = { + lane: lane, + action: action, + hasEagerState: !1, + eagerState: null, + next: null + }; + isRenderPhaseUpdate(fiber) + ? enqueueRenderPhaseUpdate(queue, action) + : (enqueueUpdate$1(fiber, queue, action), + (action = requestEventTime()), + (fiber = scheduleUpdateOnFiber(fiber, lane, action)), + null !== fiber && entangleTransitionUpdate(fiber, queue, lane)); +} +function dispatchSetState(fiber, queue, action) { + var lane = requestUpdateLane(fiber), update = { lane: lane, action: action, - eagerReducer: null, + hasEagerState: !1, eagerState: null, next: null - }, - alternate = fiber.alternate; - if ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) - ) - (didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0), - (lane = queue.pending), - null === lane - ? (update.next = update) - : ((update.next = lane.next), (lane.next = update)), - (queue.pending = update); + }; + if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update); else { - if ( - null !== workInProgressRoot && - 0 !== (fiber.mode & 1) && - 0 === (executionContext & 2) - ) { - var interleaved = queue.interleaved; - null === interleaved - ? ((update.next = update), - null === interleavedQueues - ? (interleavedQueues = [queue]) - : interleavedQueues.push(queue)) - : ((update.next = interleaved.next), (interleaved.next = update)); - queue.interleaved = update; - } else - (interleaved = queue.pending), - null === interleaved - ? (update.next = update) - : ((update.next = interleaved.next), (interleaved.next = update)), - (queue.pending = update); + enqueueUpdate$1(fiber, queue, update); + var alternate = fiber.alternate; if ( 0 === fiber.lanes && (null === alternate || 0 === alternate.lanes) && @@ -3857,20 +3840,57 @@ function dispatchAction(fiber, queue, action) { try { var currentState = queue.lastRenderedState, eagerState = alternate(currentState, action); - update.eagerReducer = alternate; + update.hasEagerState = !0; update.eagerState = eagerState; if (objectIs(eagerState, currentState)) return; } catch (error) { } finally { } - update = scheduleUpdateOnFiber(fiber, lane, eventTime); - 0 !== (lane & 4194240) && - null !== update && - ((fiber = queue.lanes), - (fiber &= update.pendingLanes), - (lane |= fiber), - (queue.lanes = lane), - markRootEntangled(update, lane)); + action = requestEventTime(); + fiber = scheduleUpdateOnFiber(fiber, lane, action); + null !== fiber && entangleTransitionUpdate(fiber, queue, lane); + } +} +function isRenderPhaseUpdate(fiber) { + var alternate = fiber.alternate; + return ( + fiber === currentlyRenderingFiber$1 || + (null !== alternate && alternate === currentlyRenderingFiber$1) + ); +} +function enqueueRenderPhaseUpdate(queue, update) { + didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0; + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; +} +function enqueueUpdate$1(fiber, queue, update) { + null !== workInProgressRoot && + 0 !== (fiber.mode & 1) && + 0 === (executionContext & 2) + ? ((fiber = queue.interleaved), + null === fiber + ? ((update.next = update), + null === interleavedQueues + ? (interleavedQueues = [queue]) + : interleavedQueues.push(queue)) + : ((update.next = fiber.next), (fiber.next = update)), + (queue.interleaved = update)) + : ((fiber = queue.pending), + null === fiber + ? (update.next = update) + : ((update.next = fiber.next), (fiber.next = update)), + (queue.pending = update)); +} +function entangleTransitionUpdate(root, queue, lane) { + if (0 !== (lane & 4194240)) { + var queueLanes = queue.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + queue.lanes = lane; + markRootEntangled(root, lane); } } var ContextOnlyDispatcher = { @@ -3939,7 +3959,7 @@ var ContextOnlyDispatcher = { lastRenderedState: initialArg }; hook.queue = reducer; - reducer = reducer.dispatch = dispatchAction.bind( + reducer = reducer.dispatch = dispatchReducerAction.bind( null, currentlyRenderingFiber$1, reducer @@ -4049,7 +4069,7 @@ var ContextOnlyDispatcher = { (null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1) ) { - fiber.flags |= 1024; + fiber.flags |= 2048; pushEffect( 9, updateStoreInstance.bind( @@ -4234,14 +4254,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$38 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$38 = lastTailNode), + for (var lastTailNode$35 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$35 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$38 + null === lastTailNode$35 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$38.sibling = null); + : (lastTailNode$35.sibling = null); } } function bubbleProperties(completedWork) { @@ -4251,19 +4271,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$39 = completedWork.child; null !== child$39; ) - (newChildLanes |= child$39.lanes | child$39.childLanes), - (subtreeFlags |= child$39.subtreeFlags & 3670016), - (subtreeFlags |= child$39.flags & 3670016), - (child$39.return = completedWork), - (child$39 = child$39.sibling); + for (var child$36 = completedWork.child; null !== child$36; ) + (newChildLanes |= child$36.lanes | child$36.childLanes), + (subtreeFlags |= child$36.subtreeFlags & 7340032), + (subtreeFlags |= child$36.flags & 7340032), + (child$36.return = completedWork), + (child$36 = child$36.sibling); else - for (child$39 = completedWork.child; null !== child$39; ) - (newChildLanes |= child$39.lanes | child$39.childLanes), - (subtreeFlags |= child$39.subtreeFlags), - (subtreeFlags |= child$39.flags), - (child$39.return = completedWork), - (child$39 = child$39.sibling); + for (child$36 = completedWork.child; null !== child$36; ) + (newChildLanes |= child$36.lanes | child$36.childLanes), + (subtreeFlags |= child$36.subtreeFlags), + (subtreeFlags |= child$36.flags), + (child$36.return = completedWork), + (child$36 = child$36.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -4299,8 +4319,8 @@ function completeWork(current, workInProgress, renderLanes) { ((newProps.context = newProps.pendingContext), (newProps.pendingContext = null)), (null !== current && null !== current.child) || - newProps.hydrate || - (workInProgress.flags |= 512), + newProps.isDehydrated || + (workInProgress.flags |= 1024), updateHostContainer(current, workInProgress), bubbleProperties(workInProgress), null @@ -4317,7 +4337,7 @@ function completeWork(current, workInProgress, renderLanes) { newProps, renderLanes ), - current.ref !== workInProgress.ref && (workInProgress.flags |= 256); + current.ref !== workInProgress.ref && (workInProgress.flags |= 512); else { if (!newProps) { if (null === workInProgress.stateNode) @@ -4352,7 +4372,7 @@ function completeWork(current, workInProgress, renderLanes) { appendAllChildren(renderLanes, workInProgress, !1, !1); workInProgress.stateNode = renderLanes; finalizeInitialChildren(renderLanes) && (workInProgress.flags |= 4); - null !== workInProgress.ref && (workInProgress.flags |= 256); + null !== workInProgress.ref && (workInProgress.flags |= 512); } bubbleProperties(workInProgress); return null; @@ -4396,7 +4416,7 @@ function completeWork(current, workInProgress, renderLanes) { if ( null !== newProps && !renderLanes && - ((workInProgress.child.flags |= 4096), 0 !== (workInProgress.mode & 1)) + ((workInProgress.child.flags |= 8192), 0 !== (workInProgress.mode & 1)) ) if ( (null === current && @@ -4408,7 +4428,8 @@ function completeWork(current, workInProgress, renderLanes) { else { if ( 0 === workInProgressRootExitStatus || - 3 === workInProgressRootExitStatus + 3 === workInProgressRootExitStatus || + 2 === workInProgressRootExitStatus ) workInProgressRootExitStatus = 4; null === workInProgressRoot || @@ -4468,7 +4489,7 @@ function completeWork(current, workInProgress, renderLanes) { for (newProps = workInProgress.child; null !== newProps; ) (renderLanes = newProps), (type = current), - (renderLanes.flags &= 3670018), + (renderLanes.flags &= 7340034), (updatePayload = renderLanes.alternate), null === updatePayload ? ((renderLanes.childLanes = 0), @@ -4572,14 +4593,14 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current.memoizedState) !== renderLanes && "unstable-defer-without-hiding" !== newProps.mode && 23 !== workInProgress.tag && - (workInProgress.flags |= 4096), + (workInProgress.flags |= 8192), renderLanes && 0 !== (workInProgress.mode & 1) ? 0 !== (subtreeRenderLanes & 1073741824) && (bubbleProperties(workInProgress), 23 !== workInProgress.tag && workInProgress.subtreeFlags & 6 && "unstable-defer-without-hiding" !== newProps.mode && - (workInProgress.flags |= 4096)) + (workInProgress.flags |= 8192)) : bubbleProperties(workInProgress), null ); @@ -4624,7 +4645,7 @@ function updateForwardRef( if (null !== current && !didReceiveUpdate) return ( (workInProgress.updateQueue = current.updateQueue), - (workInProgress.flags &= -1029), + (workInProgress.flags &= -2053), (current.lanes &= ~renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); @@ -4698,7 +4719,7 @@ function updateSimpleMemoComponent( current.ref === workInProgress.ref ) if (((didReceiveUpdate = !1), 0 !== (current.lanes & renderLanes))) - 0 !== (current.flags & 65536) && (didReceiveUpdate = !0); + 0 !== (current.flags & 131072) && (didReceiveUpdate = !0); else return ( (workInProgress.lanes = current.lanes), @@ -4762,7 +4783,7 @@ function markRef$1(current, workInProgress) { (null === current && null !== ref) || (null !== current && current.ref !== ref) ) - workInProgress.flags |= 256; + workInProgress.flags |= 512; } function updateFunctionComponent( current, @@ -4787,7 +4808,7 @@ function updateFunctionComponent( if (null !== current && !didReceiveUpdate) return ( (workInProgress.updateQueue = current.updateQueue), - (workInProgress.flags &= -1029), + (workInProgress.flags &= -2053), (current.lanes &= ~renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); @@ -4963,7 +4984,7 @@ function updateClassComponent( "function" === typeof instance.componentDidUpdate && (workInProgress.flags |= 4), "function" === typeof instance.getSnapshotBeforeUpdate && - (workInProgress.flags |= 512)) + (workInProgress.flags |= 1024)) : ("function" !== typeof instance.componentDidUpdate || (oldProps === current.memoizedProps && oldState === current.memoizedState) || @@ -4971,7 +4992,7 @@ function updateClassComponent( "function" !== typeof instance.getSnapshotBeforeUpdate || (oldProps === current.memoizedProps && oldState === current.memoizedState) || - (workInProgress.flags |= 512), + (workInProgress.flags |= 1024), (workInProgress.memoizedProps = nextProps), (workInProgress.memoizedState = newState)), (instance.props = nextProps), @@ -4985,7 +5006,7 @@ function updateClassComponent( "function" !== typeof instance.getSnapshotBeforeUpdate || (oldProps === current.memoizedProps && oldState === current.memoizedState) || - (workInProgress.flags |= 512), + (workInProgress.flags |= 1024), (nextProps = !1)); } return finishClassComponent( @@ -5242,7 +5263,7 @@ function updateSuspenseFallbackChildren( (primaryChildren.pendingProps = primaryChildProps), (workInProgress.deletions = null)) : ((primaryChildren = createWorkInProgress(current, primaryChildProps)), - (primaryChildren.subtreeFlags = current.subtreeFlags & 3670016)); + (primaryChildren.subtreeFlags = current.subtreeFlags & 7340032)); null !== currentFallbackChildFragment ? (fallbackChildren = createWorkInProgress( currentFallbackChildFragment, @@ -5470,8 +5491,8 @@ function unwindWork(workInProgress) { case 1: isContextProvider(workInProgress.type) && popContext(); var flags = workInProgress.flags; - return flags & 32768 - ? ((workInProgress.flags = (flags & -32769) | 128), workInProgress) + return flags & 65536 + ? ((workInProgress.flags = (flags & -65537) | 128), workInProgress) : null; case 3: popHostContainer(); @@ -5483,7 +5504,7 @@ function unwindWork(workInProgress) { throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." ); - workInProgress.flags = (flags & -32769) | 128; + workInProgress.flags = (flags & -65537) | 128; return workInProgress; case 5: return popHostContext(workInProgress), null; @@ -5491,8 +5512,8 @@ function unwindWork(workInProgress) { return ( pop(suspenseStackCursor), (flags = workInProgress.flags), - flags & 32768 - ? ((workInProgress.flags = (flags & -32769) | 128), workInProgress) + flags & 65536 + ? ((workInProgress.flags = (flags & -65537) | 128), workInProgress) : null ); case 19: @@ -5529,7 +5550,7 @@ function commitBeforeMutationEffects(root, firstChild) { if ( ((root = nextEffect), (firstChild = root.child), - 0 !== (root.subtreeFlags & 516) && null !== firstChild) + 0 !== (root.subtreeFlags & 1028) && null !== firstChild) ) (firstChild.return = root), (nextEffect = firstChild); else @@ -5537,7 +5558,7 @@ function commitBeforeMutationEffects(root, firstChild) { root = nextEffect; try { var current = root.alternate; - if (0 !== (root.flags & 512)) + if (0 !== (root.flags & 1024)) switch (root.tag) { case 0: case 11: @@ -5618,8 +5639,8 @@ function commitHookEffectListMount(tag, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & tag) === tag) { - var create$83 = effect.create; - effect.destroy = create$83(); + var create$80 = effect.create; + effect.destroy = create$80(); } effect = effect.next; } while (effect !== finishedWork); @@ -6063,14 +6084,14 @@ function commitMutationEffects(root, firstChild) { } } deletions = firstChild.child; - if (0 !== (firstChild.subtreeFlags & 6454) && null !== deletions) + if (0 !== (firstChild.subtreeFlags & 12854) && null !== deletions) (deletions.return = firstChild), (nextEffect = deletions); else for (; null !== nextEffect; ) { firstChild = nextEffect; try { var flags = firstChild.flags; - if (flags & 256) { + if (flags & 512) { var current = firstChild.alternate; if (null !== current) { var currentRef = current.ref; @@ -6080,12 +6101,12 @@ function commitMutationEffects(root, firstChild) { : (currentRef.current = null)); } } - if (flags & 4096) + if (flags & 8192) switch (firstChild.tag) { case 13: if (null !== firstChild.memoizedState) { - var current$88 = firstChild.alternate; - if (null === current$88 || null === current$88.memoizedState) + var current$85 = firstChild.alternate; + if (null === current$85 || null === current$85.memoizedState) globalMostRecentFallbackTime = now(); } break; @@ -6161,7 +6182,7 @@ function commitMutationEffects(root, firstChild) { } } } - switch (flags & 2054) { + switch (flags & 4102) { case 2: commitPlacement(firstChild); firstChild.flags &= -3; @@ -6171,11 +6192,11 @@ function commitMutationEffects(root, firstChild) { firstChild.flags &= -3; commitWork(firstChild.alternate, firstChild); break; - case 2048: - firstChild.flags &= -2049; + case 4096: + firstChild.flags &= -4097; break; - case 2052: - firstChild.flags &= -2049; + case 4100: + firstChild.flags &= -4097; commitWork(firstChild.alternate, firstChild); break; case 4: @@ -6198,15 +6219,15 @@ function commitLayoutEffects(finishedWork) { for (nextEffect = finishedWork; null !== nextEffect; ) { var fiber = nextEffect, firstChild = fiber.child; - if (0 !== (fiber.subtreeFlags & 4420) && null !== firstChild) + if (0 !== (fiber.subtreeFlags & 8772) && null !== firstChild) (firstChild.return = fiber), (nextEffect = firstChild); else for (fiber = finishedWork; null !== nextEffect; ) { firstChild = nextEffect; - if (0 !== (firstChild.flags & 4420)) { + if (0 !== (firstChild.flags & 8772)) { var current = firstChild.alternate; try { - if (0 !== (firstChild.flags & 4420)) + if (0 !== (firstChild.flags & 8772)) switch (firstChild.tag) { case 0: case 11: @@ -6236,8 +6257,8 @@ function commitLayoutEffects(finishedWork) { commitUpdateQueue(firstChild, updateQueue, instance); break; case 3: - var updateQueue$84 = firstChild.updateQueue; - if (null !== updateQueue$84) { + var updateQueue$81 = firstChild.updateQueue; + if (null !== updateQueue$81) { current = null; if (null !== firstChild.child) switch (firstChild.child.tag) { @@ -6247,7 +6268,7 @@ function commitLayoutEffects(finishedWork) { case 1: current = firstChild.child.stateNode; } - commitUpdateQueue(firstChild, updateQueue$84, current); + commitUpdateQueue(firstChild, updateQueue$81, current); } break; case 5: @@ -6271,7 +6292,7 @@ function commitLayoutEffects(finishedWork) { "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); } - if (firstChild.flags & 256) { + if (firstChild.flags & 512) { current = void 0; var ref = firstChild.ref; if (null !== ref) { @@ -6621,14 +6642,14 @@ function performConcurrentWorkOnRoot(root, didTimeout) { function recoverFromConcurrentError(root, errorRetryLanes) { var prevExecutionContext = executionContext; executionContext |= 8; - root.hydrate && (root.hydrate = !1); + root.isDehydrated && (root.isDehydrated = !1); root = renderRootSync(root, errorRetryLanes); executionContext = prevExecutionContext; return root; } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { - if (node.flags & 8192) { + if (node.flags & 16384) { var updateQueue = node.updateQueue; if ( null !== updateQueue && @@ -6646,7 +6667,7 @@ function isRenderConsistentWithExternalStores(finishedWork) { } } updateQueue = node.child; - if (node.subtreeFlags & 8192 && null !== updateQueue) + if (node.subtreeFlags & 16384 && null !== updateQueue) (updateQueue.return = node), (node = updateQueue); else { if (node === finishedWork) break; @@ -6682,7 +6703,7 @@ function performSyncWorkOnRoot(root) { if (0 !== root.tag && 2 === exitStatus) { var prevExecutionContext = executionContext; executionContext |= 8; - root.hydrate && (root.hydrate = !1); + root.isDehydrated && (root.isDehydrated = !1); var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); 0 !== errorRetryLanes && ((lanes = errorRetryLanes), (exitStatus = renderRootSync(root, lanes))); @@ -6807,71 +6828,83 @@ function handleError(root$jscomp$0, thrownValue) { sourceFiber = erroredWork, value = thrownValue; thrownValue = workInProgressRootRenderLanes; - sourceFiber.flags |= 16384; + sourceFiber.flags |= 32768; if ( null !== value && "object" === typeof value && "function" === typeof value.then ) { var wakeable = value, - tag = sourceFiber.tag; + sourceFiber$jscomp$0 = sourceFiber, + tag = sourceFiber$jscomp$0.tag; if ( - 0 === (sourceFiber.mode & 1) && + 0 === (sourceFiber$jscomp$0.mode & 1) && (0 === tag || 11 === tag || 15 === tag) ) { - var currentSource = sourceFiber.alternate; + var currentSource = sourceFiber$jscomp$0.alternate; currentSource - ? ((sourceFiber.updateQueue = currentSource.updateQueue), - (sourceFiber.memoizedState = currentSource.memoizedState), - (sourceFiber.lanes = currentSource.lanes)) - : ((sourceFiber.updateQueue = null), - (sourceFiber.memoizedState = null)); + ? ((sourceFiber$jscomp$0.updateQueue = currentSource.updateQueue), + (sourceFiber$jscomp$0.memoizedState = + currentSource.memoizedState), + (sourceFiber$jscomp$0.lanes = currentSource.lanes)) + : ((sourceFiber$jscomp$0.updateQueue = null), + (sourceFiber$jscomp$0.memoizedState = null)); } - var hasInvisibleParentBoundary = - 0 !== (suspenseStackCursor.current & 1), - workInProgress$32 = returnFiber; - do { - var JSCompiler_temp; - if ((JSCompiler_temp = 13 === workInProgress$32.tag)) { - var nextState = workInProgress$32.memoizedState; - JSCompiler_temp = - null !== nextState - ? null !== nextState.dehydrated + b: { + sourceFiber$jscomp$0 = returnFiber; + var sourceFiber$jscomp$1 = sourceFiber, + rootRenderLanes = thrownValue, + hasInvisibleParentBoundary = + 0 !== (suspenseStackCursor.current & 1), + node = sourceFiber$jscomp$0; + do { + var JSCompiler_temp; + if ((JSCompiler_temp = 13 === node.tag)) { + var nextState = node.memoizedState; + JSCompiler_temp = + null !== nextState + ? null !== nextState.dehydrated + ? !0 + : !1 + : !0 !== node.memoizedProps.unstable_avoidThisFallback ? !0 - : !1 - : !0 !== - workInProgress$32.memoizedProps.unstable_avoidThisFallback - ? !0 - : hasInvisibleParentBoundary - ? !1 - : !0; - } - if (JSCompiler_temp) { - var wakeables = workInProgress$32.updateQueue; - if (null === wakeables) { - var updateQueue = new Set(); - updateQueue.add(wakeable); - workInProgress$32.updateQueue = updateQueue; - } else wakeables.add(wakeable); - if ( - 0 === (workInProgress$32.mode & 1) && - workInProgress$32 !== returnFiber - ) { - workInProgress$32.flags |= 128; - sourceFiber.flags |= 65536; - sourceFiber.flags &= -26437; - if (1 === sourceFiber.tag) - if (null === sourceFiber.alternate) sourceFiber.tag = 17; + : hasInvisibleParentBoundary + ? !1 + : !0; + } + if (JSCompiler_temp) { + if (0 === (node.mode & 1)) { + if (node === sourceFiber$jscomp$0) node.flags |= 65536; else { - var update = createUpdate(-1, 1); - update.tag = 2; - enqueueUpdate(sourceFiber, update); + node.flags |= 128; + sourceFiber$jscomp$1.flags |= 131072; + sourceFiber$jscomp$1.flags &= -52805; + if (1 === sourceFiber$jscomp$1.tag) + if (null === sourceFiber$jscomp$1.alternate) + sourceFiber$jscomp$1.tag = 17; + else { + var update = createUpdate(-1, 1); + update.tag = 2; + enqueueUpdate(sourceFiber$jscomp$1, update); + } + sourceFiber$jscomp$1.lanes |= 1; } - sourceFiber.lanes |= 1; - break a; + var suspenseBoundary = node; + break b; + } + node.flags |= 65536; + node.lanes = rootRenderLanes; + suspenseBoundary = node; + break b; } - value = void 0; - sourceFiber = thrownValue; + node = node.return; + } while (null !== node); + suspenseBoundary = null; + } + if (null !== suspenseBoundary) { + value = void 0; + sourceFiber = suspenseBoundary; + if (sourceFiber.mode & 1) { var pingCache = root.pingCache; null === pingCache ? ((pingCache = root.pingCache = new PossiblyWeakMap()), @@ -6880,71 +6913,74 @@ function handleError(root$jscomp$0, thrownValue) { : ((value = pingCache.get(wakeable)), void 0 === value && ((value = new Set()), pingCache.set(wakeable, value))); - if (!value.has(sourceFiber)) { - value.add(sourceFiber); + if (!value.has(thrownValue)) { + value.add(thrownValue); var ping = pingSuspendedRoot.bind( null, root, wakeable, - sourceFiber + thrownValue ); wakeable.then(ping, ping); } - workInProgress$32.flags |= 32768; - workInProgress$32.lanes = thrownValue; - break a; } - workInProgress$32 = workInProgress$32.return; - } while (null !== workInProgress$32); - value = Error( - (getComponentNameFromFiber(sourceFiber) || "A React component") + - " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." - ); + var wakeables = sourceFiber.updateQueue; + if (null === wakeables) { + var updateQueue = new Set(); + updateQueue.add(wakeable); + sourceFiber.updateQueue = updateQueue; + } else wakeables.add(wakeable); + break a; + } else + value = Error( + (getComponentNameFromFiber(sourceFiber) || "A React component") + + " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." + ); } - 5 !== workInProgressRootExitStatus && + 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); value = createCapturedValue(value, sourceFiber); - workInProgress$32 = returnFiber; + root = returnFiber; do { - switch (workInProgress$32.tag) { + switch (root.tag) { case 3: - root = value; - workInProgress$32.flags |= 32768; + wakeable = value; + root.flags |= 65536; thrownValue &= -thrownValue; - workInProgress$32.lanes |= thrownValue; - var update$33 = createRootErrorUpdate( - workInProgress$32, + root.lanes |= thrownValue; + var update$jscomp$0 = createRootErrorUpdate( root, + wakeable, thrownValue ); - enqueueCapturedUpdate(workInProgress$32, update$33); + enqueueCapturedUpdate(root, update$jscomp$0); break a; case 1: - root = value; - var ctor = workInProgress$32.type, - instance = workInProgress$32.stateNode; + wakeable = value; + var ctor = root.type, + instance = root.stateNode; if ( - 0 === (workInProgress$32.flags & 128) && + 0 === (root.flags & 128) && ("function" === typeof ctor.getDerivedStateFromError || (null !== instance && "function" === typeof instance.componentDidCatch && (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(instance)))) ) { - workInProgress$32.flags |= 32768; + root.flags |= 65536; thrownValue &= -thrownValue; - workInProgress$32.lanes |= thrownValue; - var update$36 = createClassErrorUpdate( - workInProgress$32, + root.lanes |= thrownValue; + var update$33 = createClassErrorUpdate( root, + wakeable, thrownValue ); - enqueueCapturedUpdate(workInProgress$32, update$36); + enqueueCapturedUpdate(root, update$33); break a; } } - workInProgress$32 = workInProgress$32.return; - } while (null !== workInProgress$32); + root = root.return; + } while (null !== root); } completeUnitOfWork(erroredWork); } catch (yetAnotherThrownValue) { @@ -7005,7 +7041,7 @@ function completeUnitOfWork(unitOfWork) { do { var current = completedWork.alternate; unitOfWork = completedWork.return; - if (0 === (completedWork.flags & 16384)) { + if (0 === (completedWork.flags & 32768)) { if ( ((current = completeWork(current, completedWork, subtreeRenderLanes)), null !== current) @@ -7016,12 +7052,12 @@ function completeUnitOfWork(unitOfWork) { } else { current = unwindWork(completedWork); if (null !== current) { - current.flags &= 16383; + current.flags &= 32767; workInProgress = current; return; } null !== unitOfWork && - ((unitOfWork.flags |= 16384), + ((unitOfWork.flags |= 32768), (unitOfWork.subtreeFlags = 0), (unitOfWork.deletions = null)); } @@ -7068,16 +7104,16 @@ function commitRootImpl(root, renderPriorityLevel) { root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); - (0 === (finishedWork.subtreeFlags & 1040) && - 0 === (finishedWork.flags & 1040)) || + (0 === (finishedWork.subtreeFlags & 2064) && + 0 === (finishedWork.flags & 2064)) || rootDoesHavePassiveEffects || ((rootDoesHavePassiveEffects = !0), scheduleCallback$1(NormalPriority, function() { flushPassiveEffects(); return null; })); - remainingLanes = 0 !== (finishedWork.flags & 8054); - if (0 !== (finishedWork.subtreeFlags & 8054) || remainingLanes) { + remainingLanes = 0 !== (finishedWork.flags & 15990); + if (0 !== (finishedWork.subtreeFlags & 15990) || remainingLanes) { remainingLanes = ReactCurrentBatchConfig$2.transition; ReactCurrentBatchConfig$2.transition = 0; var previousPriority = currentUpdatePriority; @@ -7191,12 +7227,12 @@ function flushPassiveEffects() { nextEffect = fiber; } } - if (0 !== (fiber.subtreeFlags & 1040) && null !== child) + if (0 !== (fiber.subtreeFlags & 2064) && null !== child) (child.return = fiber), (nextEffect = child); else b: for (; null !== nextEffect; ) { fiber = nextEffect; - if (0 !== (fiber.flags & 1024)) + if (0 !== (fiber.flags & 2048)) switch (fiber.tag) { case 0: case 11: @@ -7216,12 +7252,12 @@ function flushPassiveEffects() { for (nextEffect = finishedWork; null !== nextEffect; ) { child = nextEffect; var firstChild = child.child; - if (0 !== (child.subtreeFlags & 1040) && null !== firstChild) + if (0 !== (child.subtreeFlags & 2064) && null !== firstChild) (firstChild.return = child), (nextEffect = firstChild); else b: for (child = finishedWork; null !== nextEffect; ) { deletions = nextEffect; - if (0 !== (deletions.flags & 1024)) + if (0 !== (deletions.flags & 2048)) try { switch (deletions.tag) { case 0: @@ -7373,7 +7409,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { renderLanes ) ); - didReceiveUpdate = 0 !== (current.flags & 65536) ? !0 : !1; + didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; } else didReceiveUpdate = !1; workInProgress.lanes = 0; @@ -7839,7 +7875,7 @@ function createWorkInProgress(current, pendingProps) { (workInProgress.flags = 0), (workInProgress.subtreeFlags = 0), (workInProgress.deletions = null)); - workInProgress.flags = current.flags & 3670016; + workInProgress.flags = current.flags & 7340032; workInProgress.childLanes = current.childLanes; workInProgress.lanes = current.lanes; workInProgress.child = current.child; @@ -7932,8 +7968,7 @@ function createFiberFromTypeAndProps( } throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + - (null == type ? type : typeof type) + - "." + ((null == type ? type : typeof type) + ".") ); } key = createFiber(fiberTag, pendingProps, key, mode); @@ -7979,7 +8014,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.finishedWork = this.pingCache = this.current = this.pendingChildren = null; this.timeoutHandle = -1; this.pendingContext = this.context = null; - this.hydrate = hydrate; + this.isDehydrated = hydrate; this.callbackNode = null; this.callbackPriority = 0; this.eventTimes = createLaneMap(0); @@ -8003,9 +8038,9 @@ function findHostInstance(component) { if (void 0 === fiber) { if ("function" === typeof component.render) throw Error("Unable to find node on an unmounted component."); + component = Object.keys(component).join(","); throw Error( - "Argument appears to not be a ReactComponent. Keys: " + - Object.keys(component) + "Argument appears to not be a ReactComponent. Keys: " + component ); } component = findCurrentHostFiber(fiber); @@ -8196,10 +8231,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_986 = { + devToolsConfig$jscomp$inline_976 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.0.0-e8feb11b6-20210915", + version: "18.0.0-afcb9cdc9-20211008", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8214,11 +8249,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1239 = { - bundleType: devToolsConfig$jscomp$inline_986.bundleType, - version: devToolsConfig$jscomp$inline_986.version, - rendererPackageName: devToolsConfig$jscomp$inline_986.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_986.rendererConfig, +var internals$jscomp$inline_1240 = { + bundleType: devToolsConfig$jscomp$inline_976.bundleType, + version: devToolsConfig$jscomp$inline_976.version, + rendererPackageName: devToolsConfig$jscomp$inline_976.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_976.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8234,27 +8269,26 @@ var internals$jscomp$inline_1239 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_986.findFiberByHostInstance || + devToolsConfig$jscomp$inline_976.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - getIsStrictMode: null, - reconcilerVersion: "18.0.0-e8feb11b6-20210915" + reconcilerVersion: "18.0.0-afcb9cdc9-20211008" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1240 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1241 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1240.isDisabled && - hook$jscomp$inline_1240.supportsFiber + !hook$jscomp$inline_1241.isDisabled && + hook$jscomp$inline_1241.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1240.inject( - internals$jscomp$inline_1239 + (rendererID = hook$jscomp$inline_1241.inject( + internals$jscomp$inline_1240 )), - (injectedHook = hook$jscomp$inline_1240); + (injectedHook = hook$jscomp$inline_1241); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index 6dc64c74dcc3e2..8916f57175feff 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -782,18 +782,16 @@ function recomputePluginOrdering() { for (var pluginName in namesToPlugins) { var pluginModule = namesToPlugins[pluginName], pluginIndex = eventPluginOrder.indexOf(pluginName); - if (!(-1 < pluginIndex)) + if (-1 >= pluginIndex) throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + - pluginName + - "`." + (pluginName + "`.") ); if (!plugins[pluginIndex]) { if (!pluginModule.extractEvents) throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + - pluginName + - "` does not." + (pluginName + "` does not.") ); plugins[pluginIndex] = pluginModule; pluginIndex = pluginModule.eventTypes; @@ -804,8 +802,7 @@ function recomputePluginOrdering() { if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0)) throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + - eventName$jscomp$0 + - "`." + (eventName$jscomp$0 + "`.") ); eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig; var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; @@ -845,8 +842,7 @@ function publishRegistrationName(registrationName, pluginModule) { if (registrationNameModules[registrationName]) throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + - registrationName + - "`." + (registrationName + "`.") ); registrationNameModules[registrationName] = pluginModule; } @@ -930,7 +926,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_233 = { +var injectedNamesToPlugins$jscomp$inline_230 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -965,34 +961,33 @@ var injectedNamesToPlugins$jscomp$inline_233 = { } } }, - isOrderingDirty$jscomp$inline_234 = !1, - pluginName$jscomp$inline_235; -for (pluginName$jscomp$inline_235 in injectedNamesToPlugins$jscomp$inline_233) + isOrderingDirty$jscomp$inline_231 = !1, + pluginName$jscomp$inline_232; +for (pluginName$jscomp$inline_232 in injectedNamesToPlugins$jscomp$inline_230) if ( - injectedNamesToPlugins$jscomp$inline_233.hasOwnProperty( - pluginName$jscomp$inline_235 + injectedNamesToPlugins$jscomp$inline_230.hasOwnProperty( + pluginName$jscomp$inline_232 ) ) { - var pluginModule$jscomp$inline_236 = - injectedNamesToPlugins$jscomp$inline_233[pluginName$jscomp$inline_235]; + var pluginModule$jscomp$inline_233 = + injectedNamesToPlugins$jscomp$inline_230[pluginName$jscomp$inline_232]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_235) || - namesToPlugins[pluginName$jscomp$inline_235] !== - pluginModule$jscomp$inline_236 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_232) || + namesToPlugins[pluginName$jscomp$inline_232] !== + pluginModule$jscomp$inline_233 ) { - if (namesToPlugins[pluginName$jscomp$inline_235]) + if (namesToPlugins[pluginName$jscomp$inline_232]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName$jscomp$inline_235 + - "`." + (pluginName$jscomp$inline_232 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_235 - ] = pluginModule$jscomp$inline_236; - isOrderingDirty$jscomp$inline_234 = !0; + pluginName$jscomp$inline_232 + ] = pluginModule$jscomp$inline_233; + isOrderingDirty$jscomp$inline_231 = !0; } } -isOrderingDirty$jscomp$inline_234 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_231 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -1293,7 +1288,7 @@ function getNearestMountedFiber(fiber) { fiber = node; do (node = fiber), - 0 !== (node.flags & 2050) && (nearestMounted = node.return), + 0 !== (node.flags & 4098) && (nearestMounted = node.return), (fiber = node.return); while (fiber); } @@ -2424,7 +2419,7 @@ function processUpdateQueue( newState = workInProgress; break a; case 3: - workInProgress.flags = (workInProgress.flags & -32769) | 128; + workInProgress.flags = (workInProgress.flags & -65537) | 128; case 0: workInProgress = update.payload; updateLane = @@ -2677,7 +2672,8 @@ function coerceRef(returnFiber, current, element) { returnFiber + ". This error is likely caused by a bug in React. Please file an issue." ); - var stringRef = "" + returnFiber; + var resolvedInst = inst, + stringRef = "" + returnFiber; if ( null !== current && null !== current.ref && @@ -2686,8 +2682,8 @@ function coerceRef(returnFiber, current, element) { ) return current.ref; current = function(value) { - var refs = inst.refs; - refs === emptyRefsObject && (refs = inst.refs = {}); + var refs = resolvedInst.refs; + refs === emptyRefsObject && (refs = resolvedInst.refs = {}); null === value ? delete refs[stringRef] : (refs[stringRef] = value); }; current._stringRef = stringRef; @@ -3386,7 +3382,7 @@ function renderWithHooks( nextRenderLanes = 0; do { didScheduleRenderPhaseUpdateDuringThisPass = !1; - if (!(25 > nextRenderLanes)) + if (25 <= nextRenderLanes) throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." ); @@ -3487,19 +3483,18 @@ function updateReducer(reducer) { (newBaseQueueLast = newBaseQueueLast.next = { lane: 0, action: update.action, - eagerReducer: update.eagerReducer, + hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }), - (current = - update.eagerReducer === reducer - ? update.eagerState - : reducer(current, update.action)); + (current = update.hasEagerState + ? update.eagerState + : reducer(current, update.action)); else { var clone = { lane: updateLane, action: update.action, - eagerReducer: update.eagerReducer, + hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null }; @@ -3639,7 +3634,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) { lastRenderedReducer: basicStateReducer, lastRenderedState: snapshot }), - (hook.dispatch = setSnapshot = dispatchAction.bind( + (hook.dispatch = setSnapshot = dispatchSetState.bind( null, currentlyRenderingFiber$1, hook @@ -3656,30 +3651,30 @@ function updateMutableSource(source, getSnapshot, subscribe) { } function mountSyncExternalStore(subscribe, getSnapshot) { var fiber = currentlyRenderingFiber$1, - hook = mountWorkInProgressHook(), - nextSnapshot = getSnapshot(); + hook = mountWorkInProgressHook(); + var nextSnapshot = getSnapshot(); + var root = workInProgressRoot; + if (null === root) + throw Error( + "Expected a work-in-progress root. This is a bug in React. Please file an issue." + ); + includesBlockingLane(root, renderLanes) || + pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); hook.memoizedState = nextSnapshot; - var inst = { value: nextSnapshot, getSnapshot: getSnapshot }; - hook.queue = inst; - mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]); - fiber.flags |= 1024; + root = { value: nextSnapshot, getSnapshot: getSnapshot }; + hook.queue = root; + mountEffect(subscribeToStore.bind(null, fiber, root, subscribe), [subscribe]); + fiber.flags |= 2048; pushEffect( 9, - updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), + updateStoreInstance.bind(null, fiber, root, nextSnapshot, getSnapshot), void 0, null ); - subscribe = workInProgressRoot; - if (null === subscribe) - throw Error( - "Expected a work-in-progress root. This is a bug in React. Please file an issue." - ); - includesBlockingLane(subscribe, renderLanes) || - pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); return nextSnapshot; } function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { - fiber.flags |= 8192; + fiber.flags |= 16384; fiber = { getSnapshot: getSnapshot, value: renderedSnapshot }; getSnapshot = currentlyRenderingFiber$1.updateQueue; null === getSnapshot @@ -3724,7 +3719,7 @@ function mountState(initialState) { lastRenderedState: initialState }; hook.queue = initialState; - initialState = initialState.dispatch = dispatchAction.bind( + initialState = initialState.dispatch = dispatchSetState.bind( null, currentlyRenderingFiber$1, initialState @@ -3776,10 +3771,10 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { - return mountEffectImpl(2098176, 8, create, deps); + return mountEffectImpl(4196352, 8, create, deps); } function updateEffect(create, deps) { - return updateEffectImpl(1024, 8, create, deps); + return updateEffectImpl(2048, 8, create, deps); } function updateInsertionEffect(create, deps) { return updateEffectImpl(4, 2, create, deps); @@ -3856,47 +3851,35 @@ function startTransition(setPending, callback) { (ReactCurrentBatchConfig$1.transition = prevTransition); } } -function dispatchAction(fiber, queue, action) { - var eventTime = requestEventTime(), - lane = requestUpdateLane(fiber), +function dispatchReducerAction(fiber, queue, action) { + var lane = requestUpdateLane(fiber); + action = { + lane: lane, + action: action, + hasEagerState: !1, + eagerState: null, + next: null + }; + isRenderPhaseUpdate(fiber) + ? enqueueRenderPhaseUpdate(queue, action) + : (enqueueUpdate$1(fiber, queue, action), + (action = requestEventTime()), + (fiber = scheduleUpdateOnFiber(fiber, lane, action)), + null !== fiber && entangleTransitionUpdate(fiber, queue, lane)); +} +function dispatchSetState(fiber, queue, action) { + var lane = requestUpdateLane(fiber), update = { lane: lane, action: action, - eagerReducer: null, + hasEagerState: !1, eagerState: null, next: null - }, - alternate = fiber.alternate; - if ( - fiber === currentlyRenderingFiber$1 || - (null !== alternate && alternate === currentlyRenderingFiber$1) - ) - (didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0), - (lane = queue.pending), - null === lane - ? (update.next = update) - : ((update.next = lane.next), (lane.next = update)), - (queue.pending = update); + }; + if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update); else { - if ( - null !== workInProgressRoot && - 0 !== (fiber.mode & 1) && - 0 === (executionContext & 2) - ) { - var interleaved = queue.interleaved; - null === interleaved - ? ((update.next = update), - null === interleavedQueues - ? (interleavedQueues = [queue]) - : interleavedQueues.push(queue)) - : ((update.next = interleaved.next), (interleaved.next = update)); - queue.interleaved = update; - } else - (interleaved = queue.pending), - null === interleaved - ? (update.next = update) - : ((update.next = interleaved.next), (interleaved.next = update)), - (queue.pending = update); + enqueueUpdate$1(fiber, queue, update); + var alternate = fiber.alternate; if ( 0 === fiber.lanes && (null === alternate || 0 === alternate.lanes) && @@ -3905,20 +3888,57 @@ function dispatchAction(fiber, queue, action) { try { var currentState = queue.lastRenderedState, eagerState = alternate(currentState, action); - update.eagerReducer = alternate; + update.hasEagerState = !0; update.eagerState = eagerState; if (objectIs(eagerState, currentState)) return; } catch (error) { } finally { } - update = scheduleUpdateOnFiber(fiber, lane, eventTime); - 0 !== (lane & 4194240) && - null !== update && - ((fiber = queue.lanes), - (fiber &= update.pendingLanes), - (lane |= fiber), - (queue.lanes = lane), - markRootEntangled(update, lane)); + action = requestEventTime(); + fiber = scheduleUpdateOnFiber(fiber, lane, action); + null !== fiber && entangleTransitionUpdate(fiber, queue, lane); + } +} +function isRenderPhaseUpdate(fiber) { + var alternate = fiber.alternate; + return ( + fiber === currentlyRenderingFiber$1 || + (null !== alternate && alternate === currentlyRenderingFiber$1) + ); +} +function enqueueRenderPhaseUpdate(queue, update) { + didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0; + var pending = queue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + queue.pending = update; +} +function enqueueUpdate$1(fiber, queue, update) { + null !== workInProgressRoot && + 0 !== (fiber.mode & 1) && + 0 === (executionContext & 2) + ? ((fiber = queue.interleaved), + null === fiber + ? ((update.next = update), + null === interleavedQueues + ? (interleavedQueues = [queue]) + : interleavedQueues.push(queue)) + : ((update.next = fiber.next), (fiber.next = update)), + (queue.interleaved = update)) + : ((fiber = queue.pending), + null === fiber + ? (update.next = update) + : ((update.next = fiber.next), (fiber.next = update)), + (queue.pending = update)); +} +function entangleTransitionUpdate(root, queue, lane) { + if (0 !== (lane & 4194240)) { + var queueLanes = queue.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + queue.lanes = lane; + markRootEntangled(root, lane); } } var ContextOnlyDispatcher = { @@ -3987,7 +4007,7 @@ var ContextOnlyDispatcher = { lastRenderedState: initialArg }; hook.queue = reducer; - reducer = reducer.dispatch = dispatchAction.bind( + reducer = reducer.dispatch = dispatchReducerAction.bind( null, currentlyRenderingFiber$1, reducer @@ -4097,7 +4117,7 @@ var ContextOnlyDispatcher = { (null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1) ) { - fiber.flags |= 1024; + fiber.flags |= 2048; pushEffect( 9, updateStoreInstance.bind( @@ -4340,14 +4360,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$40 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$40 = lastTailNode), + for (var lastTailNode$37 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$37 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$40 + null === lastTailNode$37 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$40.sibling = null); + : (lastTailNode$37.sibling = null); } } function bubbleProperties(completedWork) { @@ -4359,53 +4379,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$42 = completedWork.selfBaseDuration, - child$43 = completedWork.child; - null !== child$43; + var treeBaseDuration$39 = completedWork.selfBaseDuration, + child$40 = completedWork.child; + null !== child$40; ) - (newChildLanes |= child$43.lanes | child$43.childLanes), - (subtreeFlags |= child$43.subtreeFlags & 3670016), - (subtreeFlags |= child$43.flags & 3670016), - (treeBaseDuration$42 += child$43.treeBaseDuration), - (child$43 = child$43.sibling); - completedWork.treeBaseDuration = treeBaseDuration$42; + (newChildLanes |= child$40.lanes | child$40.childLanes), + (subtreeFlags |= child$40.subtreeFlags & 7340032), + (subtreeFlags |= child$40.flags & 7340032), + (treeBaseDuration$39 += child$40.treeBaseDuration), + (child$40 = child$40.sibling); + completedWork.treeBaseDuration = treeBaseDuration$39; } else for ( - treeBaseDuration$42 = completedWork.child; - null !== treeBaseDuration$42; + treeBaseDuration$39 = completedWork.child; + null !== treeBaseDuration$39; ) (newChildLanes |= - treeBaseDuration$42.lanes | treeBaseDuration$42.childLanes), - (subtreeFlags |= treeBaseDuration$42.subtreeFlags & 3670016), - (subtreeFlags |= treeBaseDuration$42.flags & 3670016), - (treeBaseDuration$42.return = completedWork), - (treeBaseDuration$42 = treeBaseDuration$42.sibling); + treeBaseDuration$39.lanes | treeBaseDuration$39.childLanes), + (subtreeFlags |= treeBaseDuration$39.subtreeFlags & 7340032), + (subtreeFlags |= treeBaseDuration$39.flags & 7340032), + (treeBaseDuration$39.return = completedWork), + (treeBaseDuration$39 = treeBaseDuration$39.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$42 = completedWork.actualDuration; - child$43 = completedWork.selfBaseDuration; + treeBaseDuration$39 = completedWork.actualDuration; + child$40 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$42 += child.actualDuration), - (child$43 += child.treeBaseDuration), + (treeBaseDuration$39 += child.actualDuration), + (child$40 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$42; - completedWork.treeBaseDuration = child$43; + completedWork.actualDuration = treeBaseDuration$39; + completedWork.treeBaseDuration = child$40; } else for ( - treeBaseDuration$42 = completedWork.child; - null !== treeBaseDuration$42; + treeBaseDuration$39 = completedWork.child; + null !== treeBaseDuration$39; ) (newChildLanes |= - treeBaseDuration$42.lanes | treeBaseDuration$42.childLanes), - (subtreeFlags |= treeBaseDuration$42.subtreeFlags), - (subtreeFlags |= treeBaseDuration$42.flags), - (treeBaseDuration$42.return = completedWork), - (treeBaseDuration$42 = treeBaseDuration$42.sibling); + treeBaseDuration$39.lanes | treeBaseDuration$39.childLanes), + (subtreeFlags |= treeBaseDuration$39.subtreeFlags), + (subtreeFlags |= treeBaseDuration$39.flags), + (treeBaseDuration$39.return = completedWork), + (treeBaseDuration$39 = treeBaseDuration$39.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -4441,8 +4461,8 @@ function completeWork(current, workInProgress, renderLanes) { ((newProps.context = newProps.pendingContext), (newProps.pendingContext = null)), (null !== current && null !== current.child) || - newProps.hydrate || - (workInProgress.flags |= 512), + newProps.isDehydrated || + (workInProgress.flags |= 1024), updateHostContainer(current, workInProgress), bubbleProperties(workInProgress), null @@ -4459,7 +4479,7 @@ function completeWork(current, workInProgress, renderLanes) { newProps, renderLanes ), - current.ref !== workInProgress.ref && (workInProgress.flags |= 256); + current.ref !== workInProgress.ref && (workInProgress.flags |= 512); else { if (!newProps) { if (null === workInProgress.stateNode) @@ -4494,7 +4514,7 @@ function completeWork(current, workInProgress, renderLanes) { appendAllChildren(renderLanes, workInProgress, !1, !1); workInProgress.stateNode = renderLanes; finalizeInitialChildren(renderLanes) && (workInProgress.flags |= 4); - null !== workInProgress.ref && (workInProgress.flags |= 256); + null !== workInProgress.ref && (workInProgress.flags |= 512); } bubbleProperties(workInProgress); return null; @@ -4544,7 +4564,7 @@ function completeWork(current, workInProgress, renderLanes) { if ( newProps && !renderLanes && - ((workInProgress.child.flags |= 4096), 0 !== (workInProgress.mode & 1)) + ((workInProgress.child.flags |= 8192), 0 !== (workInProgress.mode & 1)) ) if ( (null === current && @@ -4556,7 +4576,8 @@ function completeWork(current, workInProgress, renderLanes) { else { if ( 0 === workInProgressRootExitStatus || - 3 === workInProgressRootExitStatus + 3 === workInProgressRootExitStatus || + 2 === workInProgressRootExitStatus ) workInProgressRootExitStatus = 4; null === workInProgressRoot || @@ -4621,7 +4642,7 @@ function completeWork(current, workInProgress, renderLanes) { for (newProps = workInProgress.child; null !== newProps; ) (renderLanes = newProps), (updatePayload = current), - (renderLanes.flags &= 3670018), + (renderLanes.flags &= 7340034), (type = renderLanes.alternate), null === type ? ((renderLanes.childLanes = 0), @@ -4727,14 +4748,14 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current.memoizedState) !== renderLanes && "unstable-defer-without-hiding" !== newProps.mode && 23 !== workInProgress.tag && - (workInProgress.flags |= 4096), + (workInProgress.flags |= 8192), renderLanes && 0 !== (workInProgress.mode & 1) ? 0 !== (subtreeRenderLanes & 1073741824) && (bubbleProperties(workInProgress), 23 !== workInProgress.tag && workInProgress.subtreeFlags & 6 && "unstable-defer-without-hiding" !== newProps.mode && - (workInProgress.flags |= 4096)) + (workInProgress.flags |= 8192)) : bubbleProperties(workInProgress), null ); @@ -4779,7 +4800,7 @@ function updateForwardRef( if (null !== current && !didReceiveUpdate) return ( (workInProgress.updateQueue = current.updateQueue), - (workInProgress.flags &= -1029), + (workInProgress.flags &= -2053), (current.lanes &= ~renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); @@ -4853,7 +4874,7 @@ function updateSimpleMemoComponent( current.ref === workInProgress.ref ) if (((didReceiveUpdate = !1), 0 !== (current.lanes & renderLanes))) - 0 !== (current.flags & 65536) && (didReceiveUpdate = !0); + 0 !== (current.flags & 131072) && (didReceiveUpdate = !0); else return ( (workInProgress.lanes = current.lanes), @@ -4917,7 +4938,7 @@ function markRef$1(current, workInProgress) { (null === current && null !== ref) || (null !== current && current.ref !== ref) ) - workInProgress.flags |= 256; + workInProgress.flags |= 512; } function updateFunctionComponent( current, @@ -4942,7 +4963,7 @@ function updateFunctionComponent( if (null !== current && !didReceiveUpdate) return ( (workInProgress.updateQueue = current.updateQueue), - (workInProgress.flags &= -1029), + (workInProgress.flags &= -2053), (current.lanes &= ~renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); @@ -5118,7 +5139,7 @@ function updateClassComponent( "function" === typeof instance.componentDidUpdate && (workInProgress.flags |= 4), "function" === typeof instance.getSnapshotBeforeUpdate && - (workInProgress.flags |= 512)) + (workInProgress.flags |= 1024)) : ("function" !== typeof instance.componentDidUpdate || (oldProps === current.memoizedProps && oldState === current.memoizedState) || @@ -5126,7 +5147,7 @@ function updateClassComponent( "function" !== typeof instance.getSnapshotBeforeUpdate || (oldProps === current.memoizedProps && oldState === current.memoizedState) || - (workInProgress.flags |= 512), + (workInProgress.flags |= 1024), (workInProgress.memoizedProps = nextProps), (workInProgress.memoizedState = newState)), (instance.props = nextProps), @@ -5140,7 +5161,7 @@ function updateClassComponent( "function" !== typeof instance.getSnapshotBeforeUpdate || (oldProps === current.memoizedProps && oldState === current.memoizedState) || - (workInProgress.flags |= 512), + (workInProgress.flags |= 1024), (nextProps = !1)); } return finishClassComponent( @@ -5411,7 +5432,7 @@ function updateSuspenseFallbackChildren( (primaryChildren.treeBaseDuration = current.treeBaseDuration)), (workInProgress.deletions = null)) : ((primaryChildren = createWorkInProgress(current, primaryChildProps)), - (primaryChildren.subtreeFlags = current.subtreeFlags & 3670016)); + (primaryChildren.subtreeFlags = current.subtreeFlags & 7340032)); null !== currentFallbackChildFragment ? (fallbackChildren = createWorkInProgress( currentFallbackChildFragment, @@ -5647,8 +5668,8 @@ function unwindWork(workInProgress) { case 1: isContextProvider(workInProgress.type) && popContext(); var flags = workInProgress.flags; - return flags & 32768 - ? ((workInProgress.flags = (flags & -32769) | 128), + return flags & 65536 + ? ((workInProgress.flags = (flags & -65537) | 128), 0 !== (workInProgress.mode & 2) && transferActualDuration(workInProgress), workInProgress) @@ -5663,7 +5684,7 @@ function unwindWork(workInProgress) { throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." ); - workInProgress.flags = (flags & -32769) | 128; + workInProgress.flags = (flags & -65537) | 128; return workInProgress; case 5: return popHostContext(workInProgress), null; @@ -5671,8 +5692,8 @@ function unwindWork(workInProgress) { return ( pop(suspenseStackCursor), (flags = workInProgress.flags), - flags & 32768 - ? ((workInProgress.flags = (flags & -32769) | 128), + flags & 65536 + ? ((workInProgress.flags = (flags & -65537) | 128), 0 !== (workInProgress.mode & 2) && transferActualDuration(workInProgress), workInProgress) @@ -5727,7 +5748,7 @@ function commitBeforeMutationEffects(root, firstChild) { if ( ((root = nextEffect), (firstChild = root.child), - 0 !== (root.subtreeFlags & 516) && null !== firstChild) + 0 !== (root.subtreeFlags & 1028) && null !== firstChild) ) (firstChild.return = root), (nextEffect = firstChild); else @@ -5735,7 +5756,7 @@ function commitBeforeMutationEffects(root, firstChild) { root = nextEffect; try { var current = root.alternate; - if (0 !== (root.flags & 512)) + if (0 !== (root.flags & 1024)) switch (root.tag) { case 0: case 11: @@ -5809,8 +5830,8 @@ function commitHookEffectListMount(tag, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & tag) === tag) { - var create$89 = effect.create; - effect.destroy = create$89(); + var create$86 = effect.create; + effect.destroy = create$86(); } effect = effect.next; } while (effect !== finishedWork); @@ -6267,14 +6288,14 @@ function commitMutationEffects(root, firstChild, committedLanes) { } } committedLanes = firstChild.child; - if (0 !== (firstChild.subtreeFlags & 6454) && null !== committedLanes) + if (0 !== (firstChild.subtreeFlags & 12854) && null !== committedLanes) (committedLanes.return = firstChild), (nextEffect = committedLanes); else for (; null !== nextEffect; ) { firstChild = nextEffect; try { var flags = firstChild.flags; - if (flags & 256) { + if (flags & 512) { var current = firstChild.alternate; if (null !== current) { committedLanes = current; @@ -6291,12 +6312,12 @@ function commitMutationEffects(root, firstChild, committedLanes) { else currentRef.current = null; } } - if (flags & 4096) + if (flags & 8192) switch (firstChild.tag) { case 13: if (null !== firstChild.memoizedState) { - var current$96 = firstChild.alternate; - if (null === current$96 || null === current$96.memoizedState) + var current$93 = firstChild.alternate; + if (null === current$93 || null === current$93.memoizedState) globalMostRecentFallbackTime = now(); } break; @@ -6372,7 +6393,7 @@ function commitMutationEffects(root, firstChild, committedLanes) { } } } - switch (flags & 2054) { + switch (flags & 4102) { case 2: commitPlacement(firstChild); firstChild.flags &= -3; @@ -6382,11 +6403,11 @@ function commitMutationEffects(root, firstChild, committedLanes) { firstChild.flags &= -3; commitWork(firstChild.alternate, firstChild); break; - case 2048: - firstChild.flags &= -2049; + case 4096: + firstChild.flags &= -4097; break; - case 2052: - firstChild.flags &= -2049; + case 4100: + firstChild.flags &= -4097; commitWork(firstChild.alternate, firstChild); break; case 4: @@ -6413,16 +6434,16 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { if ( ((root = nextEffect), (committedLanes = root.child), - 0 !== (root.subtreeFlags & 4420) && null !== committedLanes) + 0 !== (root.subtreeFlags & 8772) && null !== committedLanes) ) (committedLanes.return = root), (nextEffect = committedLanes); else for (root = finishedWork; null !== nextEffect; ) { committedLanes = nextEffect; - if (0 !== (committedLanes.flags & 4420)) { + if (0 !== (committedLanes.flags & 8772)) { var current = committedLanes.alternate; try { - if (0 !== (committedLanes.flags & 4420)) + if (0 !== (committedLanes.flags & 8772)) switch (committedLanes.tag) { case 0: case 11: @@ -6480,21 +6501,21 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { commitUpdateQueue(committedLanes, updateQueue, instance); break; case 3: - var updateQueue$91 = committedLanes.updateQueue; - if (null !== updateQueue$91) { - var instance$92 = null; + var updateQueue$88 = committedLanes.updateQueue; + if (null !== updateQueue$88) { + var instance$89 = null; if (null !== committedLanes.child) switch (committedLanes.child.tag) { case 5: - instance$92 = committedLanes.child.stateNode; + instance$89 = committedLanes.child.stateNode; break; case 1: - instance$92 = committedLanes.child.stateNode; + instance$89 = committedLanes.child.stateNode; } commitUpdateQueue( committedLanes, - updateQueue$91, - instance$92 + updateQueue$88, + instance$89 ); } break; @@ -6509,7 +6530,7 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender, effectDuration = committedLanes.stateNode.effectDuration; - instance$92 = commitTime; + instance$89 = commitTime; current = null === current ? "mount" : "update"; currentUpdateIsNested && (current = "nested-update"); "function" === typeof onRender && @@ -6519,14 +6540,14 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { committedLanes.actualDuration, committedLanes.treeBaseDuration, committedLanes.actualStartTime, - instance$92 + instance$89 ); "function" === typeof onCommit && onCommit( committedLanes.memoizedProps.id, current, effectDuration, - instance$92 + instance$89 ); enqueuePendingPassiveProfilerEffect(committedLanes); var parentFiber = committedLanes.return; @@ -6555,28 +6576,28 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); } - if (committedLanes.flags & 256) { - instance$92 = void 0; + if (committedLanes.flags & 512) { + instance$89 = void 0; current = committedLanes; var ref = current.ref; if (null !== ref) { var instance$jscomp$0 = current.stateNode; switch (current.tag) { case 5: - instance$92 = instance$jscomp$0; + instance$89 = instance$jscomp$0; break; default: - instance$92 = instance$jscomp$0; + instance$89 = instance$jscomp$0; } if ("function" === typeof ref) if (current.mode & 2) try { - startLayoutEffectTimer(), ref(instance$92); + startLayoutEffectTimer(), ref(instance$89); } finally { recordLayoutEffectDuration(current); } - else ref(instance$92); - else ref.current = instance$92; + else ref(instance$89); + else ref.current = instance$89; } } } catch (error) { @@ -6591,10 +6612,10 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { nextEffect = null; break; } - instance$92 = committedLanes.sibling; - if (null !== instance$92) { - instance$92.return = committedLanes.return; - nextEffect = instance$92; + instance$89 = committedLanes.sibling; + if (null !== instance$89) { + instance$89.return = committedLanes.return; + nextEffect = instance$89; break; } nextEffect = committedLanes.return; @@ -6927,14 +6948,14 @@ function performConcurrentWorkOnRoot(root, didTimeout) { function recoverFromConcurrentError(root, errorRetryLanes) { var prevExecutionContext = executionContext; executionContext |= 8; - root.hydrate && (root.hydrate = !1); + root.isDehydrated && (root.isDehydrated = !1); root = renderRootSync(root, errorRetryLanes); executionContext = prevExecutionContext; return root; } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { - if (node.flags & 8192) { + if (node.flags & 16384) { var updateQueue = node.updateQueue; if ( null !== updateQueue && @@ -6952,7 +6973,7 @@ function isRenderConsistentWithExternalStores(finishedWork) { } } updateQueue = node.child; - if (node.subtreeFlags & 8192 && null !== updateQueue) + if (node.subtreeFlags & 16384 && null !== updateQueue) (updateQueue.return = node), (node = updateQueue); else { if (node === finishedWork) break; @@ -6990,7 +7011,7 @@ function performSyncWorkOnRoot(root) { if (0 !== root.tag && 2 === exitStatus) { var prevExecutionContext = executionContext; executionContext |= 8; - root.hydrate && (root.hydrate = !1); + root.isDehydrated && (root.isDehydrated = !1); var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); 0 !== errorRetryLanes && ((lanes = errorRetryLanes), (exitStatus = renderRootSync(root, lanes))); @@ -7117,7 +7138,7 @@ function handleError(root$jscomp$0, thrownValue) { sourceFiber = erroredWork, value = thrownValue; thrownValue = workInProgressRootRenderLanes; - sourceFiber.flags |= 16384; + sourceFiber.flags |= 32768; isDevToolsPresent && restorePendingUpdaters(root, thrownValue); if ( null !== value && @@ -7125,64 +7146,76 @@ function handleError(root$jscomp$0, thrownValue) { "function" === typeof value.then ) { var wakeable = value, - tag = sourceFiber.tag; + sourceFiber$jscomp$0 = sourceFiber, + tag = sourceFiber$jscomp$0.tag; if ( - 0 === (sourceFiber.mode & 1) && + 0 === (sourceFiber$jscomp$0.mode & 1) && (0 === tag || 11 === tag || 15 === tag) ) { - var currentSource = sourceFiber.alternate; + var currentSource = sourceFiber$jscomp$0.alternate; currentSource - ? ((sourceFiber.updateQueue = currentSource.updateQueue), - (sourceFiber.memoizedState = currentSource.memoizedState), - (sourceFiber.lanes = currentSource.lanes)) - : ((sourceFiber.updateQueue = null), - (sourceFiber.memoizedState = null)); + ? ((sourceFiber$jscomp$0.updateQueue = currentSource.updateQueue), + (sourceFiber$jscomp$0.memoizedState = + currentSource.memoizedState), + (sourceFiber$jscomp$0.lanes = currentSource.lanes)) + : ((sourceFiber$jscomp$0.updateQueue = null), + (sourceFiber$jscomp$0.memoizedState = null)); } - var hasInvisibleParentBoundary = - 0 !== (suspenseStackCursor.current & 1), - workInProgress$34 = returnFiber; - do { - var JSCompiler_temp; - if ((JSCompiler_temp = 13 === workInProgress$34.tag)) { - var nextState = workInProgress$34.memoizedState; - JSCompiler_temp = - null !== nextState - ? null !== nextState.dehydrated + b: { + sourceFiber$jscomp$0 = returnFiber; + var sourceFiber$jscomp$1 = sourceFiber, + rootRenderLanes = thrownValue, + hasInvisibleParentBoundary = + 0 !== (suspenseStackCursor.current & 1), + node = sourceFiber$jscomp$0; + do { + var JSCompiler_temp; + if ((JSCompiler_temp = 13 === node.tag)) { + var nextState = node.memoizedState; + JSCompiler_temp = + null !== nextState + ? null !== nextState.dehydrated + ? !0 + : !1 + : !0 !== node.memoizedProps.unstable_avoidThisFallback ? !0 - : !1 - : !0 !== - workInProgress$34.memoizedProps.unstable_avoidThisFallback - ? !0 - : hasInvisibleParentBoundary - ? !1 - : !0; - } - if (JSCompiler_temp) { - var wakeables = workInProgress$34.updateQueue; - if (null === wakeables) { - var updateQueue = new Set(); - updateQueue.add(wakeable); - workInProgress$34.updateQueue = updateQueue; - } else wakeables.add(wakeable); - if ( - 0 === (workInProgress$34.mode & 1) && - workInProgress$34 !== returnFiber - ) { - workInProgress$34.flags |= 128; - sourceFiber.flags |= 65536; - sourceFiber.flags &= -26437; - if (1 === sourceFiber.tag) - if (null === sourceFiber.alternate) sourceFiber.tag = 17; + : hasInvisibleParentBoundary + ? !1 + : !0; + } + if (JSCompiler_temp) { + if (0 === (node.mode & 1)) { + if (node === sourceFiber$jscomp$0) node.flags |= 65536; else { - var update = createUpdate(-1, 1); - update.tag = 2; - enqueueUpdate(sourceFiber, update); + node.flags |= 128; + sourceFiber$jscomp$1.flags |= 131072; + sourceFiber$jscomp$1.flags &= -52805; + if (1 === sourceFiber$jscomp$1.tag) + if (null === sourceFiber$jscomp$1.alternate) + sourceFiber$jscomp$1.tag = 17; + else { + var update = createUpdate(-1, 1); + update.tag = 2; + enqueueUpdate(sourceFiber$jscomp$1, update); + } + sourceFiber$jscomp$1.lanes |= 1; } - sourceFiber.lanes |= 1; - break a; + var suspenseBoundary = node; + break b; + } + node.flags |= 65536; + node.lanes = rootRenderLanes; + suspenseBoundary = node; + break b; } - value = void 0; - sourceFiber = thrownValue; + node = node.return; + } while (null !== node); + suspenseBoundary = null; + } + if (null !== suspenseBoundary) { + value = void 0; + sourceFiber = suspenseBoundary; + if (sourceFiber.mode & 1) { var pingCache = root.pingCache; null === pingCache ? ((pingCache = root.pingCache = new PossiblyWeakMap()), @@ -7191,72 +7224,75 @@ function handleError(root$jscomp$0, thrownValue) { : ((value = pingCache.get(wakeable)), void 0 === value && ((value = new Set()), pingCache.set(wakeable, value))); - if (!value.has(sourceFiber)) { - value.add(sourceFiber); + if (!value.has(thrownValue)) { + value.add(thrownValue); var ping = pingSuspendedRoot.bind( null, root, wakeable, - sourceFiber + thrownValue ); - isDevToolsPresent && restorePendingUpdaters(root, sourceFiber); + isDevToolsPresent && restorePendingUpdaters(root, thrownValue); wakeable.then(ping, ping); } - workInProgress$34.flags |= 32768; - workInProgress$34.lanes = thrownValue; - break a; } - workInProgress$34 = workInProgress$34.return; - } while (null !== workInProgress$34); - value = Error( - (getComponentNameFromFiber(sourceFiber) || "A React component") + - " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." - ); + var wakeables = sourceFiber.updateQueue; + if (null === wakeables) { + var updateQueue = new Set(); + updateQueue.add(wakeable); + sourceFiber.updateQueue = updateQueue; + } else wakeables.add(wakeable); + break a; + } else + value = Error( + (getComponentNameFromFiber(sourceFiber) || "A React component") + + " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." + ); } - 5 !== workInProgressRootExitStatus && + 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); value = createCapturedValue(value, sourceFiber); - workInProgress$34 = returnFiber; + root = returnFiber; do { - switch (workInProgress$34.tag) { + switch (root.tag) { case 3: - root = value; - workInProgress$34.flags |= 32768; + wakeable = value; + root.flags |= 65536; thrownValue &= -thrownValue; - workInProgress$34.lanes |= thrownValue; - var update$35 = createRootErrorUpdate( - workInProgress$34, + root.lanes |= thrownValue; + var update$jscomp$0 = createRootErrorUpdate( root, + wakeable, thrownValue ); - enqueueCapturedUpdate(workInProgress$34, update$35); + enqueueCapturedUpdate(root, update$jscomp$0); break a; case 1: - root = value; - var ctor = workInProgress$34.type, - instance = workInProgress$34.stateNode; + wakeable = value; + var ctor = root.type, + instance = root.stateNode; if ( - 0 === (workInProgress$34.flags & 128) && + 0 === (root.flags & 128) && ("function" === typeof ctor.getDerivedStateFromError || (null !== instance && "function" === typeof instance.componentDidCatch && (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(instance)))) ) { - workInProgress$34.flags |= 32768; + root.flags |= 65536; thrownValue &= -thrownValue; - workInProgress$34.lanes |= thrownValue; - var update$38 = createClassErrorUpdate( - workInProgress$34, + root.lanes |= thrownValue; + var update$35 = createClassErrorUpdate( root, + wakeable, thrownValue ); - enqueueCapturedUpdate(workInProgress$34, update$38); + enqueueCapturedUpdate(root, update$35); break a; } } - workInProgress$34 = workInProgress$34.return; - } while (null !== workInProgress$34); + root = root.return; + } while (null !== root); } completeUnitOfWork(erroredWork); } catch (yetAnotherThrownValue) { @@ -7333,7 +7369,7 @@ function completeUnitOfWork(unitOfWork) { do { var current = completedWork.alternate; unitOfWork = completedWork.return; - if (0 === (completedWork.flags & 16384)) { + if (0 === (completedWork.flags & 32768)) { if (0 === (completedWork.mode & 2)) current = completeWork(current, completedWork, subtreeRenderLanes); else { @@ -7350,7 +7386,7 @@ function completeUnitOfWork(unitOfWork) { } else { current = unwindWork(completedWork); if (null !== current) { - current.flags &= 16383; + current.flags &= 32767; workInProgress = current; return; } @@ -7362,7 +7398,7 @@ function completeUnitOfWork(unitOfWork) { completedWork.actualDuration = current; } null !== unitOfWork && - ((unitOfWork.flags |= 16384), + ((unitOfWork.flags |= 32768), (unitOfWork.subtreeFlags = 0), (unitOfWork.deletions = null)); } @@ -7409,16 +7445,16 @@ function commitRootImpl(root, renderPriorityLevel) { root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); - (0 === (finishedWork.subtreeFlags & 1040) && - 0 === (finishedWork.flags & 1040)) || + (0 === (finishedWork.subtreeFlags & 2064) && + 0 === (finishedWork.flags & 2064)) || rootDoesHavePassiveEffects || ((rootDoesHavePassiveEffects = !0), scheduleCallback$1(NormalPriority, function() { flushPassiveEffects(); return null; })); - remainingLanes = 0 !== (finishedWork.flags & 8054); - if (0 !== (finishedWork.subtreeFlags & 8054) || remainingLanes) { + remainingLanes = 0 !== (finishedWork.flags & 15990); + if (0 !== (finishedWork.subtreeFlags & 15990) || remainingLanes) { remainingLanes = ReactCurrentBatchConfig$2.transition; ReactCurrentBatchConfig$2.transition = 0; var previousPriority = currentUpdatePriority; @@ -7540,12 +7576,12 @@ function flushPassiveEffects() { nextEffect = fiber; } } - if (0 !== (fiber.subtreeFlags & 1040) && null !== child) + if (0 !== (fiber.subtreeFlags & 2064) && null !== child) (child.return = fiber), (nextEffect = child); else b: for (; null !== nextEffect; ) { fiber = nextEffect; - if (0 !== (fiber.flags & 1024)) + if (0 !== (fiber.flags & 2048)) switch (((i = fiber), i.tag)) { case 0: case 11: @@ -7569,12 +7605,12 @@ function flushPassiveEffects() { for (nextEffect = finishedWork; null !== nextEffect; ) { child = nextEffect; var firstChild = child.child; - if (0 !== (child.subtreeFlags & 1040) && null !== firstChild) + if (0 !== (child.subtreeFlags & 2064) && null !== firstChild) (firstChild.return = child), (nextEffect = firstChild); else b: for (child = finishedWork; null !== nextEffect; ) { deletions = nextEffect; - if (0 !== (deletions.flags & 1024)) + if (0 !== (deletions.flags & 2048)) try { switch (((fiberToDelete = deletions), fiberToDelete.tag)) { case 0: @@ -7782,7 +7818,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { renderLanes ) ); - didReceiveUpdate = 0 !== (current.flags & 65536) ? !0 : !1; + didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; } else didReceiveUpdate = !1; workInProgress.lanes = 0; @@ -8263,7 +8299,7 @@ function createWorkInProgress(current, pendingProps) { (workInProgress.deletions = null), (workInProgress.actualDuration = 0), (workInProgress.actualStartTime = -1)); - workInProgress.flags = current.flags & 3670016; + workInProgress.flags = current.flags & 7340032; workInProgress.childLanes = current.childLanes; workInProgress.lanes = current.lanes; workInProgress.child = current.child; @@ -8359,8 +8395,7 @@ function createFiberFromTypeAndProps( } throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + - (null == type ? type : typeof type) + - "." + ((null == type ? type : typeof type) + ".") ); } key = createFiber(fiberTag, pendingProps, key, mode); @@ -8406,7 +8441,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.finishedWork = this.pingCache = this.current = this.pendingChildren = null; this.timeoutHandle = -1; this.pendingContext = this.context = null; - this.hydrate = hydrate; + this.isDehydrated = hydrate; this.callbackNode = null; this.callbackPriority = 0; this.eventTimes = createLaneMap(0); @@ -8434,9 +8469,9 @@ function findHostInstance(component) { if (void 0 === fiber) { if ("function" === typeof component.render) throw Error("Unable to find node on an unmounted component."); + component = Object.keys(component).join(","); throw Error( - "Argument appears to not be a ReactComponent. Keys: " + - Object.keys(component) + "Argument appears to not be a ReactComponent. Keys: " + component ); } component = findCurrentHostFiber(fiber); @@ -8627,10 +8662,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1016 = { + devToolsConfig$jscomp$inline_1006 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.0.0-e8feb11b6-20210915", + version: "18.0.0-afcb9cdc9-20211008", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8645,11 +8680,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1289 = { - bundleType: devToolsConfig$jscomp$inline_1016.bundleType, - version: devToolsConfig$jscomp$inline_1016.version, - rendererPackageName: devToolsConfig$jscomp$inline_1016.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1016.rendererConfig, +var internals$jscomp$inline_1290 = { + bundleType: devToolsConfig$jscomp$inline_1006.bundleType, + version: devToolsConfig$jscomp$inline_1006.version, + rendererPackageName: devToolsConfig$jscomp$inline_1006.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1006.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8665,27 +8700,26 @@ var internals$jscomp$inline_1289 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1016.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1006.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - getIsStrictMode: null, - reconcilerVersion: "18.0.0-e8feb11b6-20210915" + reconcilerVersion: "18.0.0-afcb9cdc9-20211008" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1290 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1291 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1290.isDisabled && - hook$jscomp$inline_1290.supportsFiber + !hook$jscomp$inline_1291.isDisabled && + hook$jscomp$inline_1291.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1290.inject( - internals$jscomp$inline_1289 + (rendererID = hook$jscomp$inline_1291.inject( + internals$jscomp$inline_1290 )), - (injectedHook = hook$jscomp$inline_1290); + (injectedHook = hook$jscomp$inline_1291); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {