From a6c792db0bc9d6ce1000f6aa3223db2c06668b0a Mon Sep 17 00:00:00 2001 From: Kacie Bawiec Date: Wed, 9 Feb 2022 11:23:21 -0800 Subject: [PATCH] React Native sync for revisions 51947a1...a3bde79 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: This sync includes the following changes: - **[a3bde7974](https://github.com/facebook/react/commit/a3bde7974 )**: Exclude react-dom/unstable_testing entry point from stable releases ([#23258](https://github.com/facebook/react/pull/23258)) //// - **[569093276](https://github.com/facebook/react/commit/569093276 )**: Add onErrorShell Callback ([#23247](https://github.com/facebook/react/pull/23247)) //// - **[0dedfcc68](https://github.com/facebook/react/commit/0dedfcc68 )**: Update the exports field ([#23257](https://github.com/facebook/react/pull/23257)) //// - **[9d4e8e84f](https://github.com/facebook/react/commit/9d4e8e84f )**: React Native raw event EventEmitter - intended for app-specific perf listeners and debugging ([#23232](https://github.com/facebook/react/pull/23232)) //// - **[1dece5235](https://github.com/facebook/react/commit/1dece5235 )**: Add back warning with component stack on Hydration mismatch ([#23241](https://github.com/facebook/react/pull/23241)) //// - **[cd4eb116c](https://github.com/facebook/react/commit/cd4eb116c )**: Revert "update node.js version for CI ([#23236](https://github.com/facebook/react/pull/23236))" ([#23239](https://github.com/facebook/react/pull/23239)) //// - **[1d7728bf9](https://github.com/facebook/react/commit/1d7728bf9 )**: update node.js version for CI ([#23236](https://github.com/facebook/react/pull/23236)) //// - **[848e802d2](https://github.com/facebook/react/commit/848e802d2 )**: Add onRecoverableError option to hydrateRoot, createRoot ([#23207](https://github.com/facebook/react/pull/23207)) //// - **[5318971f5](https://github.com/facebook/react/commit/5318971f5 )**: Remove logic for multiple error recovery attempts ([#23227](https://github.com/facebook/react/pull/23227)) //// - **[3a4462129](https://github.com/facebook/react/commit/3a4462129 )**: Disable avoidThisFallback support in Fizz ([#23224](https://github.com/facebook/react/pull/23224)) //// - **[0318ac2c4](https://github.com/facebook/react/commit/0318ac2c4 )**: Revert 4f5449 //// - **[4f5449eb4](https://github.com/facebook/react/commit/4f5449eb4 )**: Remove main from scheduler `index.js` //// - **[3f5ff16c1](https://github.com/facebook/react/commit/3f5ff16c1 )**: [Hydration] Fallback to client render if server rendered extra nodes ([#23176](https://github.com/facebook/react/pull/23176)) //// - **[529dc3ce8](https://github.com/facebook/react/commit/529dc3ce8 )**: Fix context providers in SSR when handling multiple requests ([#23171](https://github.com/facebook/react/pull/23171)) //// - **[505c15c9e](https://github.com/facebook/react/commit/505c15c9e )**: Don't inject timeline hooks unless React supports profiling ([#23151](https://github.com/facebook/react/pull/23151)) //// - **[e12a9dfc9](https://github.com/facebook/react/commit/e12a9dfc9 )**: Fix production-only updateSyncExternalStore() crash when doing setState in render ([#23150](https://github.com/facebook/react/pull/23150)) //// - **[e48940255](https://github.com/facebook/react/commit/e48940255 )**: Warn when a callback ref returns a function ([#23145](https://github.com/facebook/react/pull/23145)) //// - **[d8cfeaf22](https://github.com/facebook/react/commit/d8cfeaf22 )**: Fix context propagation for offscreen/fallback trees ([#23095](https://github.com/facebook/react/pull/23095)) //// - **[d50482478](https://github.com/facebook/react/commit/d50482478 )**: Enable scheduling profiler flag in react-dom/testing builds ([#23142](https://github.com/facebook/react/pull/23142)) //// - **[790b5246f](https://github.com/facebook/react/commit/790b5246f )**: Fix setState ignored in Safari when iframe is added to DOM in the same commit ([#23111](https://github.com/facebook/react/pull/23111)) //// Changelog: [General][Changed] - React Native sync for revisions 51947a1...a3bde79 jest_e2e[run_all_tests] Reviewed By: ShikaSD Differential Revision: D34108924 fbshipit-source-id: 96acb66c1a7da79d6ef9403490cd0e29ad23d9fb --- Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 245 +++++++--- .../implementations/ReactFabric-prod.fb.js | 427 +++++++++--------- .../ReactFabric-profiling.fb.js | 305 +++++++------ .../ReactNativeRenderer-dev.fb.js | 216 ++++++--- .../ReactNativeRenderer-prod.fb.js | 402 +++++++++-------- .../ReactNativeRenderer-profiling.fb.js | 280 ++++++------ 7 files changed, 1063 insertions(+), 814 deletions(-) diff --git a/Libraries/Renderer/REVISION b/Libraries/Renderer/REVISION index b3c49ffc21d80c..17b725fb854b51 100644 --- a/Libraries/Renderer/REVISION +++ b/Libraries/Renderer/REVISION @@ -1 +1 @@ -51947a14bb24bd151f76f6fc0acdbbc404de13f7 \ No newline at end of file +a3bde7974c48cfa749b18531700f895c86cbad91 \ 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 f37be3e0ef6880..d8d4d08befc8f2 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<<10efd73d5435b5750183622476c68681>> + * @generated SignedSource<<5cd13a68c6b2a6d7a0ea84aff011af30>> */ 'use strict'; @@ -3888,7 +3888,34 @@ function dispatchEvent(target, topLevelType, nativeEvent) { } batchedUpdates(function() { - // Heritage plugin event system + // Emit event to the RawEventEmitter. This is an unused-by-default EventEmitter + // that can be used to instrument event performance monitoring (primarily - could be useful + // for other things too). + // + // NOTE: this merely emits events into the EventEmitter below. + // If *you* do not add listeners to the `RawEventEmitter`, + // then all of these emitted events will just blackhole and are no-ops. + // It is available (although not officially supported... yet) if you want to collect + // perf data on event latency in your application, and could also be useful for debugging + // low-level events issues. + // + // If you do not have any event perf monitoring and are extremely concerned about event perf, + // it is safe to disable these "emit" statements; it will prevent checking the size of + // an empty array twice and prevent two no-ops. Practically the overhead is so low that + // we don't think it's worth thinking about in prod; your perf issues probably lie elsewhere. + // + // We emit two events here: one for listeners to this specific event, + // and one for the catchall listener '*', for any listeners that want + // to be notified for all events. + // Note that extracted events are *not* emitted, + // only events that have a 1:1 mapping with a native event, at least for now. + var event = { + eventName: topLevelType, + nativeEvent: nativeEvent + }; + ReactNativePrivateInterface.RawEventEmitter.emit(topLevelType, event); + ReactNativePrivateInterface.RawEventEmitter.emit("*", event); // Heritage plugin event system + runExtractedPluginEventsInBatch( topLevelType, targetFiber, @@ -4040,12 +4067,17 @@ function injectInternals(internals) { } try { - rendererID = hook.inject( - Object.assign({}, internals, { + if (enableSchedulingProfiler) { + // Conditionally inject these hooks only if Timeline profiler is supported by this build. + // This gives DevTools a way to feature detect that isn't tied to version number + // (since profiling and timeline are controlled by different feature flags). + internals = Object.assign({}, internals, { getLaneLabelMap: getLaneLabelMap, injectProfilingHooks: injectProfilingHooks - }) - ); // We have successfully injected, so now it is safe to set up hooks. + }); + } + + rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. injectedHook = hook; } catch (err) { @@ -4179,16 +4211,18 @@ function injectProfilingHooks(profilingHooks) { } function getLaneLabelMap() { - var map = new Map(); - var lane = 1; + { + var map = new Map(); + var lane = 1; - for (var index = 0; index < TotalLanes; index++) { - var label = getLabelForLane(lane); - map.set(lane, label); - lane *= 2; - } + for (var index = 0; index < TotalLanes; index++) { + var label = getLabelForLane(lane); + map.set(lane, label); + lane *= 2; + } - return map; + return map; + } } function markCommitStarted(lanes) { @@ -6941,7 +6975,7 @@ function popProvider(context, providerFiber) { context._currentValue2 = currentValue; } } -function scheduleWorkOnParentPath(parent, renderLanes) { +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { // Update the child lanes of all the ancestors, including the alternates. var node = parent; @@ -6959,14 +6993,23 @@ function scheduleWorkOnParentPath(parent, renderLanes) { !isSubsetOfLanes(alternate.childLanes, renderLanes) ) { alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } else { - // Neither alternate was updated, which means the rest of the - // ancestor path already has sufficient priority. + } + + if (node === propagationRoot) { break; } node = node.return; } + + { + if (node !== propagationRoot) { + error( + "Expected to find the propagation root when scheduling context work. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + } } function propagateContextChange(workInProgress, context, renderLanes) { { @@ -7031,7 +7074,11 @@ function propagateContextChange_eager(workInProgress, context, renderLanes) { alternate.lanes = mergeLanes(alternate.lanes, renderLanes); } - scheduleWorkOnParentPath(fiber.return, renderLanes); // Mark the updated lanes on the list, too. + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); // Mark the updated lanes on the list, too. list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the // dependency list. @@ -8906,7 +8953,7 @@ function popTreeContext(workInProgress) { } } -var isHydrating = false; +var isHydrating = false; // Hydration errors that were thrown inside this boundary function enterHydrationState(fiber) { { @@ -13866,7 +13913,7 @@ function throwException( // over and traverse parent path again, this time treating the exception // as an error. - renderDidError(); + renderDidError(value); value = createCapturedValue(value, sourceFiber); var workInProgress = returnFiber; @@ -16912,7 +16959,7 @@ function updateSuspenseFallbackChildren( return fallbackChildFragment; } -function scheduleWorkOnFiber(fiber, renderLanes) { +function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) { fiber.lanes = mergeLanes(fiber.lanes, renderLanes); var alternate = fiber.alternate; @@ -16920,7 +16967,7 @@ function scheduleWorkOnFiber(fiber, renderLanes) { alternate.lanes = mergeLanes(alternate.lanes, renderLanes); } - scheduleWorkOnParentPath(fiber.return, renderLanes); + scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot); } function propagateSuspenseContextChange( @@ -16938,7 +16985,7 @@ function propagateSuspenseContextChange( var state = node.memoizedState; if (state !== null) { - scheduleWorkOnFiber(node, renderLanes); + scheduleSuspenseWorkOnFiber(node, renderLanes, workInProgress); } } else if (node.tag === SuspenseListComponent) { // If the tail is hidden there might not be an Suspense boundaries @@ -16946,7 +16993,7 @@ function propagateSuspenseContextChange( // list itself. // We don't have to traverse to the children of the list since // the list will propagate the change when it rerenders. - scheduleWorkOnFiber(node, renderLanes); + scheduleSuspenseWorkOnFiber(node, renderLanes, workInProgress); } else if (node.child !== null) { node.child.return = node; node = node.child; @@ -18238,6 +18285,16 @@ function safelyDetachRef(current, nearestMountedAncestor) { reportUncaughtErrorInDEV(error); captureCommitPhaseError(current, nearestMountedAncestor, error); } + + { + if (typeof retVal === "function") { + error( + "Unexpected return value from a callback ref in %s. " + + "A callback ref should not return a function.", + getComponentNameFromFiber(current) + ); + } + } } else { ref.current = null; } @@ -18946,6 +19003,16 @@ function commitAttachRef(finishedWork) { } else { retVal = ref(instanceToUse); } + + { + if (typeof retVal === "function") { + error( + "Unexpected return value from a callback ref in %s. " + + "A callback ref should not return a function.", + getComponentNameFromFiber(finishedWork) + ); + } + } } else { { if (!ref.hasOwnProperty("current")) { @@ -20070,9 +20137,12 @@ var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). -var workInProgressRootRenderPhaseUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render. +var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. + +var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. +// We will log them once the tree commits. -var workInProgressRootPingedLanes = NoLanes; // The most recent time we committed a fallback. This lets us ensure a train +var workInProgressRootRecoverableErrors = null; // The most recent time we committed a fallback. This lets us ensure a train // model where we don't commit new loading states in too quick succession. var globalMostRecentFallbackTime = 0; @@ -20220,11 +20290,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { // function), but there are some internal React features that use this as // an implementation detail, like selective hydration. warnAboutRenderPhaseUpdatesInDEV(fiber); // Track lanes that were updated during the render phase - - workInProgressRootRenderPhaseUpdatedLanes = mergeLanes( - workInProgressRootRenderPhaseUpdatedLanes, - lane - ); } else { // This is a normal update, scheduled from outside the render phase. For // example, during an input event. @@ -20601,30 +20666,34 @@ function recoverFromConcurrentError(root, errorRetryLanes) { } } - var exitStatus; - var MAX_ERROR_RETRY_ATTEMPTS = 50; + var errorsFromFirstAttempt = workInProgressRootConcurrentErrors; + var exitStatus = renderRootSync(root, errorRetryLanes); - for (var i = 0; i < MAX_ERROR_RETRY_ATTEMPTS; i++) { - exitStatus = renderRootSync(root, errorRetryLanes); - - if ( - exitStatus === RootErrored && - workInProgressRootRenderPhaseUpdatedLanes !== NoLanes - ) { - // There was a render phase update during this render. Some internal React - // implementation details may use this as a trick to schedule another - // render pass. To protect against an inifinite loop, eventually - // we'll give up. - continue; + if (exitStatus !== RootErrored) { + // Successfully finished rendering on retry + if (errorsFromFirstAttempt !== null) { + // The errors from the failed first attempt have been recovered. Add + // them to the collection of recoverable errors. We'll log them in the + // commit phase. + queueRecoverableErrors(errorsFromFirstAttempt); } - - break; } executionContext = prevExecutionContext; return exitStatus; } +function queueRecoverableErrors(errors) { + if (workInProgressRootConcurrentErrors === null) { + workInProgressRootRecoverableErrors = errors; + } else { + workInProgressRootConcurrentErrors = workInProgressRootConcurrentErrors.push.apply( + null, + errors + ); + } +} + function finishConcurrentRender(root, exitStatus, lanes) { switch (exitStatus) { case RootIncomplete: @@ -20638,7 +20707,7 @@ function finishConcurrentRender(root, exitStatus, lanes) { case RootErrored: { // We should have already attempted to retry this tree. If we reached // this point, it errored again. Commit it. - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; } @@ -20678,14 +20747,14 @@ function finishConcurrentRender(root, exitStatus, lanes) { // immediately, wait for more data to arrive. root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root), + commitRoot.bind(null, root, workInProgressRootRecoverableErrors), msUntilTimeout ); break; } } // The work expired. Commit immediately. - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; } @@ -20716,20 +20785,20 @@ function finishConcurrentRender(root, exitStatus, lanes) { // Instead of committing the fallback immediately, wait for more data // to arrive. root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root), + commitRoot.bind(null, root, workInProgressRootRecoverableErrors), _msUntilTimeout ); break; } } // Commit the placeholder. - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; } case RootCompleted: { // The work completed. Ready to commit. - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; } @@ -20860,7 +20929,7 @@ function performSyncWorkOnRoot(root) { var finishedWork = root.current.alternate; root.finishedWork = finishedWork; root.finishedLanes = lanes; - commitRoot(root); // Before exiting, make sure there's a callback scheduled for the next + commitRoot(root, workInProgressRootRecoverableErrors); // Before exiting, make sure there's a callback scheduled for the next // pending level. ensureRootIsScheduled(root, now()); @@ -20967,8 +21036,9 @@ function prepareFreshStack(root, lanes) { workInProgressRootFatalError = null; workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; - workInProgressRootRenderPhaseUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; + workInProgressRootConcurrentErrors = null; + workInProgressRootRecoverableErrors = null; enqueueInterleavedUpdates(); { @@ -21121,10 +21191,16 @@ function renderDidSuspendDelayIfPossible() { markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes); } } -function renderDidError() { +function renderDidError(error) { if (workInProgressRootExitStatus !== RootSuspendedWithDelay) { workInProgressRootExitStatus = RootErrored; } + + if (workInProgressRootConcurrentErrors === null) { + workInProgressRootConcurrentErrors = [error]; + } else { + workInProgressRootConcurrentErrors.push(error); + } } // Called during render to determine if anything has suspended. // Returns false if we're not sure. @@ -21393,7 +21469,7 @@ function completeUnitOfWork(unitOfWork) { } } -function commitRoot(root) { +function commitRoot(root, recoverableErrors) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. var previousUpdateLanePriority = getCurrentUpdatePriority(); @@ -21402,7 +21478,7 @@ function commitRoot(root) { try { ReactCurrentBatchConfig$2.transition = 0; setCurrentUpdatePriority(DiscreteEventPriority); - commitRootImpl(root, previousUpdateLanePriority); + commitRootImpl(root, recoverableErrors, previousUpdateLanePriority); } finally { ReactCurrentBatchConfig$2.transition = prevTransition; setCurrentUpdatePriority(previousUpdateLanePriority); @@ -21411,7 +21487,7 @@ function commitRoot(root) { return null; } -function commitRootImpl(root, renderPriorityLevel) { +function commitRootImpl(root, recoverableErrors, renderPriorityLevel) { do { // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which // means `flushPassiveEffects` will sometimes result in additional @@ -21616,6 +21692,19 @@ function commitRootImpl(root, renderPriorityLevel) { ensureRootIsScheduled(root, now()); + if (recoverableErrors !== null) { + // There were errors during this render, but recovered from them without + // needing to surface it to the UI. We log them here. + for (var i = 0; i < recoverableErrors.length; i++) { + var recoverableError = recoverableErrors[i]; + var onRecoverableError = root.onRecoverableError; + + if (onRecoverableError !== null) { + onRecoverableError(recoverableError); + } + } + } + if (hasUncaughtError) { hasUncaughtError = false; var error$1 = firstUncaughtError; @@ -23443,7 +23532,13 @@ function assignFiberPropertiesInDEV(target, source) { return target; } -function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { +function FiberRootNode( + containerInfo, + tag, + hydrate, + identifierPrefix, + onRecoverableError +) { this.tag = tag; this.containerInfo = containerInfo; this.pendingChildren = null; @@ -23467,6 +23562,7 @@ function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { this.entangledLanes = NoLanes; this.entanglements = createLaneMap(NoLanes); this.identifierPrefix = identifierPrefix; + this.onRecoverableError = onRecoverableError; { this.effectDuration = 0; @@ -23501,10 +23597,20 @@ function createFiberRoot( hydrate, hydrationCallbacks, isStrictMode, - concurrentUpdatesByDefaultOverride, - identifierPrefix + concurrentUpdatesByDefaultOverride, // TODO: We have several of these arguments that are conceptually part of the + // host config, but because they are passed in at runtime, we have to thread + // them through the root constructor. Perhaps we should put them all into a + // single type, like a DynamicHostConfig that is defined by the renderer. + identifierPrefix, + onRecoverableError ) { - var root = new FiberRootNode(containerInfo, tag, hydrate, identifierPrefix); + var root = new FiberRootNode( + containerInfo, + tag, + hydrate, + identifierPrefix, + onRecoverableError + ); // stateNode is any. var uninitializedFiber = createHostRootFiber( @@ -23526,7 +23632,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.0.0-rc.0-51947a14b-20220113"; +var ReactVersion = "18.0.0-rc.0-a3bde7974-20220208"; function createPortal( children, @@ -23654,7 +23760,8 @@ function createContainer( hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, - identifierPrefix + identifierPrefix, + onRecoverableError ) { return createFiberRoot( containerInfo, @@ -23663,7 +23770,8 @@ function createContainer( hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, - identifierPrefix + identifierPrefix, + onRecoverableError ); } function updateContainer(element, container, parentComponent, callback) { @@ -24458,7 +24566,8 @@ function render(element, containerTag, callback, concurrentRoot) { null, false, null, - "" + "", + null ); roots.set(containerTag, root); } diff --git a/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index bd8208a27d7e10..5014f1e088bef9 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<> + * @generated SignedSource<<97d9d60e7b93063137af17ba2abdf915>> */ "use strict"; @@ -927,7 +927,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_220 = { +var injectedNamesToPlugins$jscomp$inline_219 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -962,33 +962,33 @@ var injectedNamesToPlugins$jscomp$inline_220 = { } } }, - isOrderingDirty$jscomp$inline_221 = !1, - pluginName$jscomp$inline_222; -for (pluginName$jscomp$inline_222 in injectedNamesToPlugins$jscomp$inline_220) + isOrderingDirty$jscomp$inline_220 = !1, + pluginName$jscomp$inline_221; +for (pluginName$jscomp$inline_221 in injectedNamesToPlugins$jscomp$inline_219) if ( - injectedNamesToPlugins$jscomp$inline_220.hasOwnProperty( - pluginName$jscomp$inline_222 + injectedNamesToPlugins$jscomp$inline_219.hasOwnProperty( + pluginName$jscomp$inline_221 ) ) { - var pluginModule$jscomp$inline_223 = - injectedNamesToPlugins$jscomp$inline_220[pluginName$jscomp$inline_222]; + var pluginModule$jscomp$inline_222 = + injectedNamesToPlugins$jscomp$inline_219[pluginName$jscomp$inline_221]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_222) || - namesToPlugins[pluginName$jscomp$inline_222] !== - pluginModule$jscomp$inline_223 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_221) || + namesToPlugins[pluginName$jscomp$inline_221] !== + pluginModule$jscomp$inline_222 ) { - if (namesToPlugins[pluginName$jscomp$inline_222]) + if (namesToPlugins[pluginName$jscomp$inline_221]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_222 + "`.") + (pluginName$jscomp$inline_221 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_222 - ] = pluginModule$jscomp$inline_223; - isOrderingDirty$jscomp$inline_221 = !0; + pluginName$jscomp$inline_221 + ] = pluginModule$jscomp$inline_222; + isOrderingDirty$jscomp$inline_220 = !0; } } -isOrderingDirty$jscomp$inline_221 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_220 && recomputePluginOrdering(); function getInstanceFromInstance(instanceHandle) { return instanceHandle; } @@ -1559,7 +1559,10 @@ function dispatchEvent(target, topLevelType, nativeEvent) { null != stateNode && (eventTarget = stateNode.canonical); } batchedUpdates(function() { - var JSCompiler_inline_result = eventTarget; + var event = { eventName: topLevelType, nativeEvent: nativeEvent }; + ReactNativePrivateInterface.RawEventEmitter.emit(topLevelType, event); + ReactNativePrivateInterface.RawEventEmitter.emit("*", event); + event = eventTarget; for ( var events = null, legacyPlugins = plugins, i = 0; i < legacyPlugins.length; @@ -1571,29 +1574,25 @@ function dispatchEvent(target, topLevelType, nativeEvent) { topLevelType, target, nativeEvent, - JSCompiler_inline_result + event )) && (events = accumulateInto(events, possiblePlugin)); } - JSCompiler_inline_result = events; - null !== JSCompiler_inline_result && - (eventQueue = accumulateInto(eventQueue, JSCompiler_inline_result)); - JSCompiler_inline_result = eventQueue; + event = events; + null !== event && (eventQueue = accumulateInto(eventQueue, event)); + event = eventQueue; eventQueue = null; - if (JSCompiler_inline_result) { - forEachAccumulated( - JSCompiler_inline_result, - executeDispatchesAndReleaseTopLevel - ); + if (event) { + forEachAccumulated(event, executeDispatchesAndReleaseTopLevel); if (eventQueue) throw Error( "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." ); if (hasRethrowError) - throw ((JSCompiler_inline_result = rethrowError), + throw ((event = rethrowError), (hasRethrowError = !1), (rethrowError = null), - JSCompiler_inline_result); + event); } }); } @@ -1619,12 +1618,6 @@ function onCommitRoot(root) { ); } catch (err) {} } -function injectProfilingHooks() {} -function getLaneLabelMap() { - for (var map = new Map(), lane = 1, index$3 = 0; 31 > index$3; index$3++) - map.set(lane, void 0), (lane *= 2); - return map; -} var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, log = Math.log, LN2 = Math.LN2; @@ -1797,21 +1790,21 @@ function markRootFinished(root, remainingLanes) { remainingLanes = root.entanglements; var eventTimes = root.eventTimes; for (root = root.expirationTimes; 0 < noLongerPendingLanes; ) { - var index$8 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$8; - remainingLanes[index$8] = 0; - eventTimes[index$8] = -1; - root[index$8] = -1; + var index$7 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$7; + remainingLanes[index$7] = 0; + eventTimes[index$7] = -1; + root[index$7] = -1; noLongerPendingLanes &= ~lane; } } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$9 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$9; - (lane & entangledLanes) | (root[index$9] & entangledLanes) && - (root[index$9] |= entangledLanes); + var index$8 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$8; + (lane & entangledLanes) | (root[index$8] & entangledLanes) && + (root[index$8] |= entangledLanes); rootEntangledLanes &= ~lane; } } @@ -2185,19 +2178,16 @@ function popProvider(context) { pop(valueCursor); context._currentValue2 = currentValue; } -function scheduleWorkOnParentPath(parent, renderLanes) { +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { for (; null !== parent; ) { var alternate = parent.alternate; - if ((parent.childLanes & renderLanes) === renderLanes) - if ( - null === alternate || - (alternate.childLanes & renderLanes) === renderLanes - ) - break; - else alternate.childLanes |= renderLanes; - else - (parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes); + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; parent = parent.return; } } @@ -3666,28 +3656,37 @@ function updateMutableSource(source, getSnapshot, subscribe) { var hook = updateWorkInProgressHook(); return useMutableSource(hook, source, getSnapshot, subscribe); } -function mountSyncExternalStore(subscribe, getSnapshot) { +function updateSyncExternalStore(subscribe, getSnapshot) { var fiber = currentlyRenderingFiber$1, - 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." + hook = updateWorkInProgressHook(), + nextSnapshot = getSnapshot(), + snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot); + snapshotChanged && + ((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0)); + hook = hook.queue; + updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [ + subscribe + ]); + if ( + hook.getSnapshot !== getSnapshot || + snapshotChanged || + (null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1) + ) { + fiber.flags |= 2048; + pushEffect( + 9, + updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot), + void 0, + null ); - includesBlockingLane(root, renderLanes) || - pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); - hook.memoizedState = nextSnapshot; - 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, 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) { @@ -4075,7 +4074,32 @@ var ContextOnlyDispatcher = { }; return useMutableSource(hook, source, getSnapshot, subscribe); }, - useSyncExternalStore: mountSyncExternalStore, + useSyncExternalStore: function(subscribe, getSnapshot) { + var fiber = currentlyRenderingFiber$1, + 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; + 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, root, nextSnapshot, getSnapshot), + void 0, + null + ); + return nextSnapshot; + }, useId: function() { var hook = mountWorkInProgressHook(), identifierPrefix = workInProgressRoot.identifierPrefix, @@ -4124,46 +4148,7 @@ var ContextOnlyDispatcher = { return [isPending, start]; }, useMutableSource: updateMutableSource, - useSyncExternalStore: function(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, - hook = updateWorkInProgressHook(), - nextSnapshot = getSnapshot(), - snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot); - snapshotChanged && - ((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0)); - hook = hook.queue; - updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [ - subscribe - ]); - if ( - hook.getSnapshot !== getSnapshot || - snapshotChanged || - (null !== workInProgressHook && - workInProgressHook.memoizedState.tag & 1) - ) { - fiber.flags |= 2048; - pushEffect( - 9, - updateStoreInstance.bind( - null, - fiber, - hook, - 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; - }, + useSyncExternalStore: updateSyncExternalStore, useId: updateId, unstable_isNewReconciler: !1 }, @@ -4206,7 +4191,7 @@ var ContextOnlyDispatcher = { return [isPending, start]; }, useMutableSource: updateMutableSource, - useSyncExternalStore: mountSyncExternalStore, + useSyncExternalStore: updateSyncExternalStore, useId: updateId, unstable_isNewReconciler: !1 }; @@ -4454,14 +4439,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$36 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$36 = lastTailNode), + for (var lastTailNode$35 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$35 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$36 + null === lastTailNode$35 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$36.sibling = null); + : (lastTailNode$35.sibling = null); } } function bubbleProperties(completedWork) { @@ -4471,19 +4456,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$37 = completedWork.child; null !== child$37; ) - (newChildLanes |= child$37.lanes | child$37.childLanes), - (subtreeFlags |= child$37.subtreeFlags & 14680064), - (subtreeFlags |= child$37.flags & 14680064), - (child$37.return = completedWork), - (child$37 = child$37.sibling); + for (var child$36 = completedWork.child; null !== child$36; ) + (newChildLanes |= child$36.lanes | child$36.childLanes), + (subtreeFlags |= child$36.subtreeFlags & 14680064), + (subtreeFlags |= child$36.flags & 14680064), + (child$36.return = completedWork), + (child$36 = child$36.sibling); else - for (child$37 = completedWork.child; null !== child$37; ) - (newChildLanes |= child$37.lanes | child$37.childLanes), - (subtreeFlags |= child$37.subtreeFlags), - (subtreeFlags |= child$37.flags), - (child$37.return = completedWork), - (child$37 = child$37.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; @@ -5548,11 +5533,11 @@ function updateSuspenseFallbackChildren( workInProgress.child = current; return fallbackChildren; } -function scheduleWorkOnFiber(fiber, renderLanes) { +function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) { fiber.lanes |= renderLanes; var alternate = fiber.alternate; null !== alternate && (alternate.lanes |= renderLanes); - scheduleWorkOnParentPath(fiber.return, renderLanes); + scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot); } function initSuspenseListRenderState( workInProgress, @@ -5591,8 +5576,9 @@ function updateSuspenseListComponent(current, workInProgress, renderLanes) { a: for (current = workInProgress.child; null !== current; ) { if (13 === current.tag) null !== current.memoizedState && - scheduleWorkOnFiber(current, renderLanes); - else if (19 === current.tag) scheduleWorkOnFiber(current, renderLanes); + scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress); + else if (19 === current.tag) + scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress); else if (null !== current.child) { current.child.return = current; current = current.child; @@ -5906,8 +5892,8 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$81 = effect.create; - effect.destroy = create$81(); + var create$80 = effect.create; + effect.destroy = create$80(); } effect = effect.next; } while (effect !== finishedWork); @@ -6084,8 +6070,8 @@ function commitMutationEffects(root, firstChild) { switch (root.tag) { case 13: if (null !== root.memoizedState) { - var current$85 = root.alternate; - if (null === current$85 || null === current$85.memoizedState) + var current$84 = root.alternate; + if (null === current$84 || null === current$84.memoizedState) globalMostRecentFallbackTime = now(); } } @@ -6162,8 +6148,8 @@ function commitLayoutEffects(finishedWork) { commitUpdateQueue(firstChild, updateQueue, instance); break; case 3: - var updateQueue$82 = firstChild.updateQueue; - if (null !== updateQueue$82) { + var updateQueue$81 = firstChild.updateQueue; + if (null !== updateQueue$81) { current = null; if (null !== firstChild.child) switch (firstChild.child.tag) { @@ -6173,7 +6159,7 @@ function commitLayoutEffects(finishedWork) { case 1: current = firstChild.child.stateNode; } - commitUpdateQueue(firstChild, updateQueue$82, current); + commitUpdateQueue(firstChild, updateQueue$81, current); } break; case 5: @@ -6250,8 +6236,9 @@ var ceil = Math.ceil, workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, - workInProgressRootRenderPhaseUpdatedLanes = 0, workInProgressRootPingedLanes = 0, + workInProgressRootConcurrentErrors = null, + workInProgressRootRecoverableErrors = null, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, hasUncaughtError = !1, @@ -6310,19 +6297,18 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { var root = markUpdateLaneFromFiberToRoot(fiber, lane); if (null === root) return null; markRootUpdated(root, lane, eventTime); - 0 !== (executionContext & 2) && root === workInProgressRoot - ? (workInProgressRootRenderPhaseUpdatedLanes |= lane) - : (root === workInProgressRoot && - (0 === (executionContext & 2) && - (workInProgressRootInterleavedUpdatedLanes |= lane), - 4 === workInProgressRootExitStatus && - markRootSuspended$1(root, workInProgressRootRenderLanes)), + if (0 === (executionContext & 2) || root !== workInProgressRoot) + root === workInProgressRoot && + (0 === (executionContext & 2) && + (workInProgressRootInterleavedUpdatedLanes |= lane), + 4 === workInProgressRootExitStatus && + markRootSuspended$1(root, workInProgressRootRenderLanes)), ensureRootIsScheduled(root, eventTime), 1 === lane && 0 === executionContext && 0 === (fiber.mode & 1) && ((workInProgressRootRenderTargetTime = now() + 500), - includesLegacySyncCallbacks && flushSyncCallbacks())); + includesLegacySyncCallbacks && flushSyncCallbacks()); return root; } function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { @@ -6348,12 +6334,12 @@ function ensureRootIsScheduled(root, currentTime) { 0 < lanes; ) { - var index$6 = 31 - clz32(lanes), - lane = 1 << index$6, - expirationTime = expirationTimes[index$6]; + var index$5 = 31 - clz32(lanes), + lane = 1 << index$5, + expirationTime = expirationTimes[index$5]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$6] = computeExpirationTime(lane, currentTime); + expirationTimes[index$5] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } @@ -6493,7 +6479,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 1: throw Error("Root did not complete. This is a bug in React."); case 2: - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; case 3: markRootSuspended$1(root, lanes); @@ -6510,22 +6496,22 @@ function performConcurrentWorkOnRoot(root, didTimeout) { break; } root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root), + commitRoot.bind(null, root, workInProgressRootRecoverableErrors), didTimeout ); break; } - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; case 4: markRootSuspended$1(root, lanes); if ((lanes & 4194240) === lanes) break; didTimeout = root.eventTimes; for (prevExecutionContext = -1; 0 < lanes; ) { - var index$5 = 31 - clz32(lanes); - prevDispatcher = 1 << index$5; - index$5 = didTimeout[index$5]; - index$5 > prevExecutionContext && (prevExecutionContext = index$5); + var index$4 = 31 - clz32(lanes); + prevDispatcher = 1 << index$4; + index$4 = didTimeout[index$4]; + index$4 > prevExecutionContext && (prevExecutionContext = index$4); lanes &= ~prevDispatcher; } lanes = prevExecutionContext; @@ -6546,15 +6532,15 @@ function performConcurrentWorkOnRoot(root, didTimeout) { : 1960 * ceil(lanes / 1960)) - lanes; if (10 < lanes) { root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root), + commitRoot.bind(null, root, workInProgressRootRecoverableErrors), lanes ); break; } - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; case 5: - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; default: throw Error("Unknown root exit status."); @@ -6569,15 +6555,18 @@ function recoverFromConcurrentError(root, errorRetryLanes) { var prevExecutionContext = executionContext; executionContext |= 8; root.isDehydrated && (root.isDehydrated = !1); - for ( - var exitStatus, i = 0; - 50 > i && - ((exitStatus = renderRootSync(root, errorRetryLanes)), - 2 === exitStatus && 0 !== workInProgressRootRenderPhaseUpdatedLanes); - i++ - ); + var errorsFromFirstAttempt = workInProgressRootConcurrentErrors; + root = renderRootSync(root, errorRetryLanes); + 2 !== root && + null !== errorsFromFirstAttempt && + (null === workInProgressRootConcurrentErrors + ? (workInProgressRootRecoverableErrors = errorsFromFirstAttempt) + : (workInProgressRootConcurrentErrors = workInProgressRootConcurrentErrors.push.apply( + null, + errorsFromFirstAttempt + ))); executionContext = prevExecutionContext; - return exitStatus; + return root; } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -6619,9 +6608,9 @@ function markRootSuspended$1(root, suspendedLanes) { root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$7 = 31 - clz32(suspendedLanes), - lane = 1 << index$7; - root[index$7] = -1; + var index$6 = 31 - clz32(suspendedLanes), + lane = 1 << index$6; + root[index$6] = -1; suspendedLanes &= ~lane; } } @@ -6646,7 +6635,7 @@ function performSyncWorkOnRoot(root) { exitStatus); root.finishedWork = root.current.alternate; root.finishedLanes = lanes; - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); ensureRootIsScheduled(root, now()); return null; } @@ -6703,7 +6692,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootRenderLanes = subtreeRenderLanes = lanes; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = workInProgressRootRenderPhaseUpdatedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; + workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; + workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; if (null !== interleavedQueues) { for (root = 0; root < interleavedQueues.length; root++) if ( @@ -6871,8 +6861,12 @@ function handleError(root$jscomp$0, thrownValue) { " 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." ); } + root = value; 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); + null === workInProgressRootConcurrentErrors + ? (workInProgressRootConcurrentErrors = [root]) + : workInProgressRootConcurrentErrors.push(root); value = createCapturedValue(value, sourceFiber); root = returnFiber; do { @@ -6904,12 +6898,12 @@ function handleError(root$jscomp$0, thrownValue) { root.flags |= 65536; thrownValue &= -thrownValue; root.lanes |= thrownValue; - var update$32 = createClassErrorUpdate( + var update$31 = createClassErrorUpdate( root, wakeable, thrownValue ); - enqueueCapturedUpdate(root, update$32); + enqueueCapturedUpdate(root, update$31); break a; } } @@ -7004,20 +6998,20 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot(root) { +function commitRoot(root, recoverableErrors) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$2.transition; try { (ReactCurrentBatchConfig$2.transition = 0), (currentUpdatePriority = 1), - commitRootImpl(root, previousUpdateLanePriority); + commitRootImpl(root, recoverableErrors, previousUpdateLanePriority); } finally { (ReactCurrentBatchConfig$2.transition = prevTransition), (currentUpdatePriority = previousUpdateLanePriority); } return null; } -function commitRootImpl(root, renderPriorityLevel) { +function commitRootImpl(root, recoverableErrors, renderPriorityLevel) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); if (0 !== (executionContext & 6)) @@ -7072,6 +7066,15 @@ function commitRootImpl(root, renderPriorityLevel) { 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); onCommitRoot(finishedWork.stateNode, renderPriorityLevel); ensureRootIsScheduled(root, now()); + if (null !== recoverableErrors) + for ( + renderPriorityLevel = 0; + renderPriorityLevel < recoverableErrors.length; + renderPriorityLevel++ + ) + (finishedWork = recoverableErrors[renderPriorityLevel]), + (lanes = root.onRecoverableError), + null !== lanes && lanes(finishedWork); if (hasUncaughtError) throw ((hasUncaughtError = !1), (root = firstUncaughtError), @@ -7644,7 +7647,11 @@ beginWork$1 = function(current, workInProgress, renderLanes) { newValue.lanes |= renderLanes; dependency = newValue.alternate; null !== dependency && (dependency.lanes |= renderLanes); - scheduleWorkOnParentPath(newValue.return, renderLanes); + scheduleContextWorkOnParentPath( + newValue.return, + renderLanes, + workInProgress + ); list.lanes |= renderLanes; break; } @@ -7949,7 +7956,13 @@ function createFiberFromPortal(portal, mode, lanes) { }; return mode; } -function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { +function FiberRootNode( + containerInfo, + tag, + hydrate, + identifierPrefix, + onRecoverableError +) { this.tag = tag; this.containerInfo = containerInfo; this.finishedWork = this.pingCache = this.current = this.pendingChildren = null; @@ -7963,6 +7976,7 @@ function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); this.identifierPrefix = identifierPrefix; + this.onRecoverableError = onRecoverableError; } function createPortal(children, containerInfo, implementation) { var key = @@ -8166,10 +8180,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_926 = { + devToolsConfig$jscomp$inline_927 = { findFiberByHostInstance: getInstanceFromInstance, bundleType: 0, - version: "18.0.0-rc.0-51947a14b-20220113", + version: "18.0.0-rc.0-a3bde7974-20220208", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8184,11 +8198,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1179 = { - bundleType: devToolsConfig$jscomp$inline_926.bundleType, - version: devToolsConfig$jscomp$inline_926.version, - rendererPackageName: devToolsConfig$jscomp$inline_926.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_926.rendererConfig, +var internals$jscomp$inline_1181 = { + bundleType: devToolsConfig$jscomp$inline_927.bundleType, + version: devToolsConfig$jscomp$inline_927.version, + rendererPackageName: devToolsConfig$jscomp$inline_927.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_927.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8204,29 +8218,26 @@ var internals$jscomp$inline_1179 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_926.findFiberByHostInstance || + devToolsConfig$jscomp$inline_927.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.0.0-rc.0-51947a14b-20220113" + reconcilerVersion: "18.0.0-rc.0-a3bde7974-20220208" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1180 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1182 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1180.isDisabled && - hook$jscomp$inline_1180.supportsFiber + !hook$jscomp$inline_1182.isDisabled && + hook$jscomp$inline_1182.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1180.inject( - Object.assign({}, internals$jscomp$inline_1179, { - getLaneLabelMap: getLaneLabelMap, - injectProfilingHooks: injectProfilingHooks - }) + (rendererID = hook$jscomp$inline_1182.inject( + internals$jscomp$inline_1181 )), - (injectedHook = hook$jscomp$inline_1180); + (injectedHook = hook$jscomp$inline_1182); } catch (err) {} } exports.createPortal = function(children, containerTag) { @@ -8266,7 +8277,7 @@ exports.render = function(element, containerTag, callback, concurrentRoot) { var root = roots.get(containerTag); root || ((root = concurrentRoot ? 1 : 0), - (concurrentRoot = new FiberRootNode(containerTag, root, !1, "")), + (concurrentRoot = new FiberRootNode(containerTag, root, !1, "", null)), (root = createFiber(3, null, null, 1 === root ? 1 : 0)), (concurrentRoot.current = root), (root.stateNode = concurrentRoot), diff --git a/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index 88a4d7e8f7ae9c..6df38b40d95fd3 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<> + * @generated SignedSource<<5c079c38f5734a3f694bc72a4da400d4>> */ @@ -1570,7 +1570,10 @@ function dispatchEvent(target, topLevelType, nativeEvent) { null != stateNode && (eventTarget = stateNode.canonical); } batchedUpdates(function() { - var JSCompiler_inline_result = eventTarget; + var event = { eventName: topLevelType, nativeEvent: nativeEvent }; + ReactNativePrivateInterface.RawEventEmitter.emit(topLevelType, event); + ReactNativePrivateInterface.RawEventEmitter.emit("*", event); + event = eventTarget; for ( var events = null, legacyPlugins = plugins, i = 0; i < legacyPlugins.length; @@ -1582,29 +1585,25 @@ function dispatchEvent(target, topLevelType, nativeEvent) { topLevelType, target, nativeEvent, - JSCompiler_inline_result + event )) && (events = accumulateInto(events, possiblePlugin)); } - JSCompiler_inline_result = events; - null !== JSCompiler_inline_result && - (eventQueue = accumulateInto(eventQueue, JSCompiler_inline_result)); - JSCompiler_inline_result = eventQueue; + event = events; + null !== event && (eventQueue = accumulateInto(eventQueue, event)); + event = eventQueue; eventQueue = null; - if (JSCompiler_inline_result) { - forEachAccumulated( - JSCompiler_inline_result, - executeDispatchesAndReleaseTopLevel - ); + if (event) { + forEachAccumulated(event, executeDispatchesAndReleaseTopLevel); if (eventQueue) throw Error( "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." ); if (hasRethrowError) - throw ((JSCompiler_inline_result = rethrowError), + throw ((event = rethrowError), (hasRethrowError = !1), (rethrowError = null), - JSCompiler_inline_result); + event); } }); } @@ -2306,19 +2305,16 @@ function popProvider(context) { pop(valueCursor); context._currentValue2 = currentValue; } -function scheduleWorkOnParentPath(parent, renderLanes) { +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { for (; null !== parent; ) { var alternate = parent.alternate; - if ((parent.childLanes & renderLanes) === renderLanes) - if ( - null === alternate || - (alternate.childLanes & renderLanes) === renderLanes - ) - break; - else alternate.childLanes |= renderLanes; - else - (parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes); + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; parent = parent.return; } } @@ -3792,28 +3788,37 @@ function updateMutableSource(source, getSnapshot, subscribe) { var hook = updateWorkInProgressHook(); return useMutableSource(hook, source, getSnapshot, subscribe); } -function mountSyncExternalStore(subscribe, getSnapshot) { +function updateSyncExternalStore(subscribe, getSnapshot) { var fiber = currentlyRenderingFiber$1, - 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." + hook = updateWorkInProgressHook(), + nextSnapshot = getSnapshot(), + snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot); + snapshotChanged && + ((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0)); + hook = hook.queue; + updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [ + subscribe + ]); + if ( + hook.getSnapshot !== getSnapshot || + snapshotChanged || + (null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1) + ) { + fiber.flags |= 2048; + pushEffect( + 9, + updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot), + void 0, + null ); - includesBlockingLane(root, renderLanes) || - pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); - hook.memoizedState = nextSnapshot; - 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, 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) { @@ -4203,7 +4208,32 @@ var ContextOnlyDispatcher = { }; return useMutableSource(hook, source, getSnapshot, subscribe); }, - useSyncExternalStore: mountSyncExternalStore, + useSyncExternalStore: function(subscribe, getSnapshot) { + var fiber = currentlyRenderingFiber$1, + 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; + 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, root, nextSnapshot, getSnapshot), + void 0, + null + ); + return nextSnapshot; + }, useId: function() { var hook = mountWorkInProgressHook(), identifierPrefix = workInProgressRoot.identifierPrefix, @@ -4252,46 +4282,7 @@ var ContextOnlyDispatcher = { return [isPending, start]; }, useMutableSource: updateMutableSource, - useSyncExternalStore: function(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, - hook = updateWorkInProgressHook(), - nextSnapshot = getSnapshot(), - snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot); - snapshotChanged && - ((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0)); - hook = hook.queue; - updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [ - subscribe - ]); - if ( - hook.getSnapshot !== getSnapshot || - snapshotChanged || - (null !== workInProgressHook && - workInProgressHook.memoizedState.tag & 1) - ) { - fiber.flags |= 2048; - pushEffect( - 9, - updateStoreInstance.bind( - null, - fiber, - hook, - 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; - }, + useSyncExternalStore: updateSyncExternalStore, useId: updateId, unstable_isNewReconciler: !1 }, @@ -4334,7 +4325,7 @@ var ContextOnlyDispatcher = { return [isPending, start]; }, useMutableSource: updateMutableSource, - useSyncExternalStore: mountSyncExternalStore, + useSyncExternalStore: updateSyncExternalStore, useId: updateId, unstable_isNewReconciler: !1 }, @@ -5806,11 +5797,11 @@ function updateSuspenseFallbackChildren( workInProgress.child = current; return fallbackChildren; } -function scheduleWorkOnFiber(fiber, renderLanes) { +function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) { fiber.lanes |= renderLanes; var alternate = fiber.alternate; null !== alternate && (alternate.lanes |= renderLanes); - scheduleWorkOnParentPath(fiber.return, renderLanes); + scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot); } function initSuspenseListRenderState( workInProgress, @@ -5849,8 +5840,9 @@ function updateSuspenseListComponent(current, workInProgress, renderLanes) { a: for (current = workInProgress.child; null !== current; ) { if (13 === current.tag) null !== current.memoizedState && - scheduleWorkOnFiber(current, renderLanes); - else if (19 === current.tag) scheduleWorkOnFiber(current, renderLanes); + scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress); + else if (19 === current.tag) + scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress); else if (null !== current.child) { current.child.return = current; current = current.child; @@ -6698,8 +6690,9 @@ var ceil = Math.ceil, workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, - workInProgressRootRenderPhaseUpdatedLanes = 0, workInProgressRootPingedLanes = 0, + workInProgressRootConcurrentErrors = null, + workInProgressRootRecoverableErrors = null, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, hasUncaughtError = !1, @@ -6759,9 +6752,8 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { var root = markUpdateLaneFromFiberToRoot(fiber, lane); if (null === root) return null; markRootUpdated(root, lane, eventTime); - 0 !== (executionContext & 2) && root === workInProgressRoot - ? (workInProgressRootRenderPhaseUpdatedLanes |= lane) - : (isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), + if (0 === (executionContext & 2) || root !== workInProgressRoot) + isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), root === workInProgressRoot && (0 === (executionContext & 2) && (workInProgressRootInterleavedUpdatedLanes |= lane), @@ -6772,7 +6764,7 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { 0 === executionContext && 0 === (fiber.mode & 1) && ((workInProgressRootRenderTargetTime = now() + 500), - includesLegacySyncCallbacks && flushSyncCallbacks())); + includesLegacySyncCallbacks && flushSyncCallbacks()); return root; } function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { @@ -6957,7 +6949,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 1: throw Error("Root did not complete. This is a bug in React."); case 2: - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; case 3: markRootSuspended$1(root, lanes); @@ -6974,12 +6966,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) { break; } root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root), + commitRoot.bind(null, root, workInProgressRootRecoverableErrors), didTimeout ); break; } - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; case 4: markRootSuspended$1(root, lanes); @@ -7010,15 +7002,15 @@ function performConcurrentWorkOnRoot(root, didTimeout) { : 1960 * ceil(lanes / 1960)) - lanes; if (10 < lanes) { root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root), + commitRoot.bind(null, root, workInProgressRootRecoverableErrors), lanes ); break; } - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; case 5: - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; default: throw Error("Unknown root exit status."); @@ -7033,15 +7025,18 @@ function recoverFromConcurrentError(root, errorRetryLanes) { var prevExecutionContext = executionContext; executionContext |= 8; root.isDehydrated && (root.isDehydrated = !1); - for ( - var exitStatus, i = 0; - 50 > i && - ((exitStatus = renderRootSync(root, errorRetryLanes)), - 2 === exitStatus && 0 !== workInProgressRootRenderPhaseUpdatedLanes); - i++ - ); + var errorsFromFirstAttempt = workInProgressRootConcurrentErrors; + root = renderRootSync(root, errorRetryLanes); + 2 !== root && + null !== errorsFromFirstAttempt && + (null === workInProgressRootConcurrentErrors + ? (workInProgressRootRecoverableErrors = errorsFromFirstAttempt) + : (workInProgressRootConcurrentErrors = workInProgressRootConcurrentErrors.push.apply( + null, + errorsFromFirstAttempt + ))); executionContext = prevExecutionContext; - return exitStatus; + return root; } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -7112,7 +7107,7 @@ function performSyncWorkOnRoot(root) { exitStatus); root.finishedWork = root.current.alternate; root.finishedLanes = lanes; - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); ensureRootIsScheduled(root, now()); return null; } @@ -7169,7 +7164,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootRenderLanes = subtreeRenderLanes = lanes; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = workInProgressRootRenderPhaseUpdatedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; + workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; + workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; if (null !== interleavedQueues) { for (root = 0; root < interleavedQueues.length; root++) if ( @@ -7364,8 +7360,12 @@ function handleError(root, thrownValue) { " 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." ); } + wakeable = value; 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); + null === workInProgressRootConcurrentErrors + ? (workInProgressRootConcurrentErrors = [wakeable]) + : workInProgressRootConcurrentErrors.push(wakeable); value = createCapturedValue(value, sourceFiber); wakeable = returnFiber; do { @@ -7528,20 +7528,20 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot(root) { +function commitRoot(root, recoverableErrors) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$2.transition; try { (ReactCurrentBatchConfig$2.transition = 0), (currentUpdatePriority = 1), - commitRootImpl(root, previousUpdateLanePriority); + commitRootImpl(root, recoverableErrors, previousUpdateLanePriority); } finally { (ReactCurrentBatchConfig$2.transition = prevTransition), (currentUpdatePriority = previousUpdateLanePriority); } return null; } -function commitRootImpl(root, renderPriorityLevel) { +function commitRootImpl(root, recoverableErrors, renderPriorityLevel) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); if (0 !== (executionContext & 6)) @@ -7607,6 +7607,15 @@ function commitRootImpl(root, renderPriorityLevel) { onCommitRoot(finishedWork.stateNode, renderPriorityLevel); isDevToolsPresent && root.memoizedUpdaters.clear(); ensureRootIsScheduled(root, now()); + if (null !== recoverableErrors) + for ( + renderPriorityLevel = 0; + renderPriorityLevel < recoverableErrors.length; + renderPriorityLevel++ + ) + (finishedWork = recoverableErrors[renderPriorityLevel]), + (lanes = root.onRecoverableError), + null !== lanes && lanes(finishedWork); if (hasUncaughtError) throw ((hasUncaughtError = !1), (root = firstUncaughtError), @@ -8261,7 +8270,11 @@ beginWork$1 = function(current, workInProgress, renderLanes) { newValue.lanes |= renderLanes; dependency = newValue.alternate; null !== dependency && (dependency.lanes |= renderLanes); - scheduleWorkOnParentPath(newValue.return, renderLanes); + scheduleContextWorkOnParentPath( + newValue.return, + renderLanes, + workInProgress + ); list.lanes |= renderLanes; break; } @@ -8582,7 +8595,13 @@ function createFiberFromPortal(portal, mode, lanes) { }; return mode; } -function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { +function FiberRootNode( + containerInfo, + tag, + hydrate, + identifierPrefix, + onRecoverableError +) { this.tag = tag; this.containerInfo = containerInfo; this.finishedWork = this.pingCache = this.current = this.pendingChildren = null; @@ -8596,6 +8615,7 @@ function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); this.identifierPrefix = identifierPrefix; + this.onRecoverableError = onRecoverableError; this.passiveEffectDuration = this.effectDuration = 0; this.memoizedUpdaters = new Set(); containerInfo = this.pendingUpdatersLaneMap = []; @@ -8806,10 +8826,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1002 = { + devToolsConfig$jscomp$inline_1004 = { findFiberByHostInstance: getInstanceFromInstance, bundleType: 0, - version: "18.0.0-rc.0-51947a14b-20220113", + version: "18.0.0-rc.0-a3bde7974-20220208", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8824,11 +8844,24 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1279 = { - bundleType: devToolsConfig$jscomp$inline_1002.bundleType, - version: devToolsConfig$jscomp$inline_1002.version, - rendererPackageName: devToolsConfig$jscomp$inline_1002.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1002.rendererConfig, +(function(internals) { + if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled || !hook.supportsFiber) return !0; + try { + (internals = Object.assign({}, internals, { + getLaneLabelMap: getLaneLabelMap, + injectProfilingHooks: injectProfilingHooks + })), + (rendererID = hook.inject(internals)), + (injectedHook = hook); + } catch (err) {} + return hook.checkDCE ? !0 : !1; +})({ + bundleType: devToolsConfig$jscomp$inline_1004.bundleType, + version: devToolsConfig$jscomp$inline_1004.version, + rendererPackageName: devToolsConfig$jscomp$inline_1004.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1004.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8844,31 +8877,15 @@ var internals$jscomp$inline_1279 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1002.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1004.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.0.0-rc.0-51947a14b-20220113" -}; -if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1280 = __REACT_DEVTOOLS_GLOBAL_HOOK__; - if ( - !hook$jscomp$inline_1280.isDisabled && - hook$jscomp$inline_1280.supportsFiber - ) - try { - (rendererID = hook$jscomp$inline_1280.inject( - Object.assign({}, internals$jscomp$inline_1279, { - getLaneLabelMap: getLaneLabelMap, - injectProfilingHooks: injectProfilingHooks - }) - )), - (injectedHook = hook$jscomp$inline_1280); - } catch (err) {} -} + reconcilerVersion: "18.0.0-rc.0-a3bde7974-20220208" +}); exports.createPortal = function(children, containerTag) { return createPortal( children, @@ -8906,7 +8923,7 @@ exports.render = function(element, containerTag, callback, concurrentRoot) { var root = roots.get(containerTag); root || ((root = concurrentRoot ? 1 : 0), - (concurrentRoot = new FiberRootNode(containerTag, root, !1, "")), + (concurrentRoot = new FiberRootNode(containerTag, root, !1, "", null)), (root = 1 === root ? 1 : 0), isDevToolsPresent && (root |= 2), (root = createFiber(3, null, null, root)), diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index fa3df1e36c9a90..c913b5af61deec 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<<3ab224d749aabfd2af41824a03d0c6ce>> + * @generated SignedSource<> */ 'use strict'; @@ -4283,12 +4283,17 @@ function injectInternals(internals) { } try { - rendererID = hook.inject( - Object.assign({}, internals, { + if (enableSchedulingProfiler) { + // Conditionally inject these hooks only if Timeline profiler is supported by this build. + // This gives DevTools a way to feature detect that isn't tied to version number + // (since profiling and timeline are controlled by different feature flags). + internals = Object.assign({}, internals, { getLaneLabelMap: getLaneLabelMap, injectProfilingHooks: injectProfilingHooks - }) - ); // We have successfully injected, so now it is safe to set up hooks. + }); + } + + rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. injectedHook = hook; } catch (err) { @@ -4422,16 +4427,18 @@ function injectProfilingHooks(profilingHooks) { } function getLaneLabelMap() { - var map = new Map(); - var lane = 1; + { + var map = new Map(); + var lane = 1; - for (var index = 0; index < TotalLanes; index++) { - var label = getLabelForLane(lane); - map.set(lane, label); - lane *= 2; - } + for (var index = 0; index < TotalLanes; index++) { + var label = getLabelForLane(lane); + map.set(lane, label); + lane *= 2; + } - return map; + return map; + } } function markCommitStarted(lanes) { @@ -7175,7 +7182,7 @@ function popProvider(context, providerFiber) { context._currentValue = currentValue; } } -function scheduleWorkOnParentPath(parent, renderLanes) { +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { // Update the child lanes of all the ancestors, including the alternates. var node = parent; @@ -7193,14 +7200,23 @@ function scheduleWorkOnParentPath(parent, renderLanes) { !isSubsetOfLanes(alternate.childLanes, renderLanes) ) { alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } else { - // Neither alternate was updated, which means the rest of the - // ancestor path already has sufficient priority. + } + + if (node === propagationRoot) { break; } node = node.return; } + + { + if (node !== propagationRoot) { + error( + "Expected to find the propagation root when scheduling context work. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + } } function propagateContextChange(workInProgress, context, renderLanes) { { @@ -7265,7 +7281,11 @@ function propagateContextChange_eager(workInProgress, context, renderLanes) { alternate.lanes = mergeLanes(alternate.lanes, renderLanes); } - scheduleWorkOnParentPath(fiber.return, renderLanes); // Mark the updated lanes on the list, too. + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); // Mark the updated lanes on the list, too. list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the // dependency list. @@ -9140,7 +9160,7 @@ function popTreeContext(workInProgress) { } } -var isHydrating = false; +var isHydrating = false; // Hydration errors that were thrown inside this boundary function enterHydrationState(fiber) { { @@ -14081,7 +14101,7 @@ function throwException( // over and traverse parent path again, this time treating the exception // as an error. - renderDidError(); + renderDidError(value); value = createCapturedValue(value, sourceFiber); var workInProgress = returnFiber; @@ -16944,7 +16964,7 @@ function updateSuspenseFallbackChildren( return fallbackChildFragment; } -function scheduleWorkOnFiber(fiber, renderLanes) { +function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) { fiber.lanes = mergeLanes(fiber.lanes, renderLanes); var alternate = fiber.alternate; @@ -16952,7 +16972,7 @@ function scheduleWorkOnFiber(fiber, renderLanes) { alternate.lanes = mergeLanes(alternate.lanes, renderLanes); } - scheduleWorkOnParentPath(fiber.return, renderLanes); + scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot); } function propagateSuspenseContextChange( @@ -16970,7 +16990,7 @@ function propagateSuspenseContextChange( var state = node.memoizedState; if (state !== null) { - scheduleWorkOnFiber(node, renderLanes); + scheduleSuspenseWorkOnFiber(node, renderLanes, workInProgress); } } else if (node.tag === SuspenseListComponent) { // If the tail is hidden there might not be an Suspense boundaries @@ -16978,7 +16998,7 @@ function propagateSuspenseContextChange( // list itself. // We don't have to traverse to the children of the list since // the list will propagate the change when it rerenders. - scheduleWorkOnFiber(node, renderLanes); + scheduleSuspenseWorkOnFiber(node, renderLanes, workInProgress); } else if (node.child !== null) { node.child.return = node; node = node.child; @@ -18270,6 +18290,16 @@ function safelyDetachRef(current, nearestMountedAncestor) { reportUncaughtErrorInDEV(error); captureCommitPhaseError(current, nearestMountedAncestor, error); } + + { + if (typeof retVal === "function") { + error( + "Unexpected return value from a callback ref in %s. " + + "A callback ref should not return a function.", + getComponentNameFromFiber(current) + ); + } + } } else { ref.current = null; } @@ -19051,6 +19081,16 @@ function commitAttachRef(finishedWork) { } else { retVal = ref(instanceToUse); } + + { + if (typeof retVal === "function") { + error( + "Unexpected return value from a callback ref in %s. " + + "A callback ref should not return a function.", + getComponentNameFromFiber(finishedWork) + ); + } + } } else { { if (!ref.hasOwnProperty("current")) { @@ -20486,9 +20526,12 @@ var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). -var workInProgressRootRenderPhaseUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render. +var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. -var workInProgressRootPingedLanes = NoLanes; // The most recent time we committed a fallback. This lets us ensure a train +var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. +// We will log them once the tree commits. + +var workInProgressRootRecoverableErrors = null; // The most recent time we committed a fallback. This lets us ensure a train // model where we don't commit new loading states in too quick succession. var globalMostRecentFallbackTime = 0; @@ -20636,11 +20679,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { // function), but there are some internal React features that use this as // an implementation detail, like selective hydration. warnAboutRenderPhaseUpdatesInDEV(fiber); // Track lanes that were updated during the render phase - - workInProgressRootRenderPhaseUpdatedLanes = mergeLanes( - workInProgressRootRenderPhaseUpdatedLanes, - lane - ); } else { // This is a normal update, scheduled from outside the render phase. For // example, during an input event. @@ -21017,30 +21055,34 @@ function recoverFromConcurrentError(root, errorRetryLanes) { } } - var exitStatus; - var MAX_ERROR_RETRY_ATTEMPTS = 50; - - for (var i = 0; i < MAX_ERROR_RETRY_ATTEMPTS; i++) { - exitStatus = renderRootSync(root, errorRetryLanes); + var errorsFromFirstAttempt = workInProgressRootConcurrentErrors; + var exitStatus = renderRootSync(root, errorRetryLanes); - if ( - exitStatus === RootErrored && - workInProgressRootRenderPhaseUpdatedLanes !== NoLanes - ) { - // There was a render phase update during this render. Some internal React - // implementation details may use this as a trick to schedule another - // render pass. To protect against an inifinite loop, eventually - // we'll give up. - continue; + if (exitStatus !== RootErrored) { + // Successfully finished rendering on retry + if (errorsFromFirstAttempt !== null) { + // The errors from the failed first attempt have been recovered. Add + // them to the collection of recoverable errors. We'll log them in the + // commit phase. + queueRecoverableErrors(errorsFromFirstAttempt); } - - break; } executionContext = prevExecutionContext; return exitStatus; } +function queueRecoverableErrors(errors) { + if (workInProgressRootConcurrentErrors === null) { + workInProgressRootRecoverableErrors = errors; + } else { + workInProgressRootConcurrentErrors = workInProgressRootConcurrentErrors.push.apply( + null, + errors + ); + } +} + function finishConcurrentRender(root, exitStatus, lanes) { switch (exitStatus) { case RootIncomplete: @@ -21054,7 +21096,7 @@ function finishConcurrentRender(root, exitStatus, lanes) { case RootErrored: { // We should have already attempted to retry this tree. If we reached // this point, it errored again. Commit it. - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; } @@ -21094,14 +21136,14 @@ function finishConcurrentRender(root, exitStatus, lanes) { // immediately, wait for more data to arrive. root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root), + commitRoot.bind(null, root, workInProgressRootRecoverableErrors), msUntilTimeout ); break; } } // The work expired. Commit immediately. - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; } @@ -21132,20 +21174,20 @@ function finishConcurrentRender(root, exitStatus, lanes) { // Instead of committing the fallback immediately, wait for more data // to arrive. root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root), + commitRoot.bind(null, root, workInProgressRootRecoverableErrors), _msUntilTimeout ); break; } } // Commit the placeholder. - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; } case RootCompleted: { // The work completed. Ready to commit. - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; } @@ -21276,7 +21318,7 @@ function performSyncWorkOnRoot(root) { var finishedWork = root.current.alternate; root.finishedWork = finishedWork; root.finishedLanes = lanes; - commitRoot(root); // Before exiting, make sure there's a callback scheduled for the next + commitRoot(root, workInProgressRootRecoverableErrors); // Before exiting, make sure there's a callback scheduled for the next // pending level. ensureRootIsScheduled(root, now()); @@ -21383,8 +21425,9 @@ function prepareFreshStack(root, lanes) { workInProgressRootFatalError = null; workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; - workInProgressRootRenderPhaseUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; + workInProgressRootConcurrentErrors = null; + workInProgressRootRecoverableErrors = null; enqueueInterleavedUpdates(); { @@ -21537,10 +21580,16 @@ function renderDidSuspendDelayIfPossible() { markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes); } } -function renderDidError() { +function renderDidError(error) { if (workInProgressRootExitStatus !== RootSuspendedWithDelay) { workInProgressRootExitStatus = RootErrored; } + + if (workInProgressRootConcurrentErrors === null) { + workInProgressRootConcurrentErrors = [error]; + } else { + workInProgressRootConcurrentErrors.push(error); + } } // Called during render to determine if anything has suspended. // Returns false if we're not sure. @@ -21809,7 +21858,7 @@ function completeUnitOfWork(unitOfWork) { } } -function commitRoot(root) { +function commitRoot(root, recoverableErrors) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. var previousUpdateLanePriority = getCurrentUpdatePriority(); @@ -21818,7 +21867,7 @@ function commitRoot(root) { try { ReactCurrentBatchConfig$2.transition = 0; setCurrentUpdatePriority(DiscreteEventPriority); - commitRootImpl(root, previousUpdateLanePriority); + commitRootImpl(root, recoverableErrors, previousUpdateLanePriority); } finally { ReactCurrentBatchConfig$2.transition = prevTransition; setCurrentUpdatePriority(previousUpdateLanePriority); @@ -21827,7 +21876,7 @@ function commitRoot(root) { return null; } -function commitRootImpl(root, renderPriorityLevel) { +function commitRootImpl(root, recoverableErrors, renderPriorityLevel) { do { // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which // means `flushPassiveEffects` will sometimes result in additional @@ -22032,6 +22081,19 @@ function commitRootImpl(root, renderPriorityLevel) { ensureRootIsScheduled(root, now()); + if (recoverableErrors !== null) { + // There were errors during this render, but recovered from them without + // needing to surface it to the UI. We log them here. + for (var i = 0; i < recoverableErrors.length; i++) { + var recoverableError = recoverableErrors[i]; + var onRecoverableError = root.onRecoverableError; + + if (onRecoverableError !== null) { + onRecoverableError(recoverableError); + } + } + } + if (hasUncaughtError) { hasUncaughtError = false; var error$1 = firstUncaughtError; @@ -23855,7 +23917,13 @@ function assignFiberPropertiesInDEV(target, source) { return target; } -function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { +function FiberRootNode( + containerInfo, + tag, + hydrate, + identifierPrefix, + onRecoverableError +) { this.tag = tag; this.containerInfo = containerInfo; this.pendingChildren = null; @@ -23879,6 +23947,7 @@ function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { this.entangledLanes = NoLanes; this.entanglements = createLaneMap(NoLanes); this.identifierPrefix = identifierPrefix; + this.onRecoverableError = onRecoverableError; { this.effectDuration = 0; @@ -23913,10 +23982,20 @@ function createFiberRoot( hydrate, hydrationCallbacks, isStrictMode, - concurrentUpdatesByDefaultOverride, - identifierPrefix + concurrentUpdatesByDefaultOverride, // TODO: We have several of these arguments that are conceptually part of the + // host config, but because they are passed in at runtime, we have to thread + // them through the root constructor. Perhaps we should put them all into a + // single type, like a DynamicHostConfig that is defined by the renderer. + identifierPrefix, + onRecoverableError ) { - var root = new FiberRootNode(containerInfo, tag, hydrate, identifierPrefix); + var root = new FiberRootNode( + containerInfo, + tag, + hydrate, + identifierPrefix, + onRecoverableError + ); // stateNode is any. var uninitializedFiber = createHostRootFiber( @@ -23938,7 +24017,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.0.0-rc.0-51947a14b-20220113"; +var ReactVersion = "18.0.0-rc.0-a3bde7974-20220208"; function createPortal( children, @@ -24066,7 +24145,8 @@ function createContainer( hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, - identifierPrefix + identifierPrefix, + onRecoverableError ) { return createFiberRoot( containerInfo, @@ -24075,7 +24155,8 @@ function createContainer( hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, - identifierPrefix + identifierPrefix, + onRecoverableError ); } function updateContainer(element, container, parentComponent, callback) { @@ -24861,7 +24942,8 @@ function render(element, containerTag, callback) { null, false, null, - "" + "", + null ); roots.set(containerTag, root); } diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index 34c20b44f2e79c..2087079f42a22e 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<> + * @generated SignedSource<<74ace7caaea78f5e62bae1f9669d8351>> */ "use strict"; @@ -926,7 +926,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_223 = { +var injectedNamesToPlugins$jscomp$inline_222 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -961,33 +961,33 @@ var injectedNamesToPlugins$jscomp$inline_223 = { } } }, - isOrderingDirty$jscomp$inline_224 = !1, - pluginName$jscomp$inline_225; -for (pluginName$jscomp$inline_225 in injectedNamesToPlugins$jscomp$inline_223) + isOrderingDirty$jscomp$inline_223 = !1, + pluginName$jscomp$inline_224; +for (pluginName$jscomp$inline_224 in injectedNamesToPlugins$jscomp$inline_222) if ( - injectedNamesToPlugins$jscomp$inline_223.hasOwnProperty( - pluginName$jscomp$inline_225 + injectedNamesToPlugins$jscomp$inline_222.hasOwnProperty( + pluginName$jscomp$inline_224 ) ) { - var pluginModule$jscomp$inline_226 = - injectedNamesToPlugins$jscomp$inline_223[pluginName$jscomp$inline_225]; + var pluginModule$jscomp$inline_225 = + injectedNamesToPlugins$jscomp$inline_222[pluginName$jscomp$inline_224]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_225) || - namesToPlugins[pluginName$jscomp$inline_225] !== - pluginModule$jscomp$inline_226 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_224) || + namesToPlugins[pluginName$jscomp$inline_224] !== + pluginModule$jscomp$inline_225 ) { - if (namesToPlugins[pluginName$jscomp$inline_225]) + if (namesToPlugins[pluginName$jscomp$inline_224]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_225 + "`.") + (pluginName$jscomp$inline_224 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_225 - ] = pluginModule$jscomp$inline_226; - isOrderingDirty$jscomp$inline_224 = !0; + pluginName$jscomp$inline_224 + ] = pluginModule$jscomp$inline_225; + isOrderingDirty$jscomp$inline_223 = !0; } } -isOrderingDirty$jscomp$inline_224 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_223 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -1697,12 +1697,6 @@ function onCommitRoot(root) { ); } catch (err) {} } -function injectProfilingHooks() {} -function getLaneLabelMap() { - for (var map = new Map(), lane = 1, index$4 = 0; 31 > index$4; index$4++) - map.set(lane, void 0), (lane *= 2); - return map; -} var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, log = Math.log, LN2 = Math.LN2; @@ -1875,21 +1869,21 @@ function markRootFinished(root, remainingLanes) { remainingLanes = root.entanglements; var eventTimes = root.eventTimes; for (root = root.expirationTimes; 0 < noLongerPendingLanes; ) { - var index$9 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$9; - remainingLanes[index$9] = 0; - eventTimes[index$9] = -1; - root[index$9] = -1; + var index$8 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$8; + remainingLanes[index$8] = 0; + eventTimes[index$8] = -1; + root[index$8] = -1; noLongerPendingLanes &= ~lane; } } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$10 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$10; - (lane & entangledLanes) | (root[index$10] & entangledLanes) && - (root[index$10] |= entangledLanes); + var index$9 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$9; + (lane & entangledLanes) | (root[index$9] & entangledLanes) && + (root[index$9] |= entangledLanes); rootEntangledLanes &= ~lane; } } @@ -2161,19 +2155,16 @@ function popProvider(context) { pop(valueCursor); context._currentValue = currentValue; } -function scheduleWorkOnParentPath(parent, renderLanes) { +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { for (; null !== parent; ) { var alternate = parent.alternate; - if ((parent.childLanes & renderLanes) === renderLanes) - if ( - null === alternate || - (alternate.childLanes & renderLanes) === renderLanes - ) - break; - else alternate.childLanes |= renderLanes; - else - (parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes); + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; parent = parent.return; } } @@ -3642,28 +3633,37 @@ function updateMutableSource(source, getSnapshot, subscribe) { var hook = updateWorkInProgressHook(); return useMutableSource(hook, source, getSnapshot, subscribe); } -function mountSyncExternalStore(subscribe, getSnapshot) { +function updateSyncExternalStore(subscribe, getSnapshot) { var fiber = currentlyRenderingFiber$1, - 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." + hook = updateWorkInProgressHook(), + nextSnapshot = getSnapshot(), + snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot); + snapshotChanged && + ((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0)); + hook = hook.queue; + updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [ + subscribe + ]); + if ( + hook.getSnapshot !== getSnapshot || + snapshotChanged || + (null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1) + ) { + fiber.flags |= 2048; + pushEffect( + 9, + updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot), + void 0, + null ); - includesBlockingLane(root, renderLanes) || - pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); - hook.memoizedState = nextSnapshot; - 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, 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) { @@ -4051,7 +4051,32 @@ var ContextOnlyDispatcher = { }; return useMutableSource(hook, source, getSnapshot, subscribe); }, - useSyncExternalStore: mountSyncExternalStore, + useSyncExternalStore: function(subscribe, getSnapshot) { + var fiber = currentlyRenderingFiber$1, + 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; + 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, root, nextSnapshot, getSnapshot), + void 0, + null + ); + return nextSnapshot; + }, useId: function() { var hook = mountWorkInProgressHook(), identifierPrefix = workInProgressRoot.identifierPrefix, @@ -4100,46 +4125,7 @@ var ContextOnlyDispatcher = { return [isPending, start]; }, useMutableSource: updateMutableSource, - useSyncExternalStore: function(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, - hook = updateWorkInProgressHook(), - nextSnapshot = getSnapshot(), - snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot); - snapshotChanged && - ((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0)); - hook = hook.queue; - updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [ - subscribe - ]); - if ( - hook.getSnapshot !== getSnapshot || - snapshotChanged || - (null !== workInProgressHook && - workInProgressHook.memoizedState.tag & 1) - ) { - fiber.flags |= 2048; - pushEffect( - 9, - updateStoreInstance.bind( - null, - fiber, - hook, - 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; - }, + useSyncExternalStore: updateSyncExternalStore, useId: updateId, unstable_isNewReconciler: !1 }, @@ -4182,7 +4168,7 @@ var ContextOnlyDispatcher = { return [isPending, start]; }, useMutableSource: updateMutableSource, - useSyncExternalStore: mountSyncExternalStore, + useSyncExternalStore: updateSyncExternalStore, useId: updateId, unstable_isNewReconciler: !1 }; @@ -4298,14 +4284,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$36 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$36 = lastTailNode), + for (var lastTailNode$35 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$35 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$36 + null === lastTailNode$35 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$36.sibling = null); + : (lastTailNode$35.sibling = null); } } function bubbleProperties(completedWork) { @@ -4315,19 +4301,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$37 = completedWork.child; null !== child$37; ) - (newChildLanes |= child$37.lanes | child$37.childLanes), - (subtreeFlags |= child$37.subtreeFlags & 14680064), - (subtreeFlags |= child$37.flags & 14680064), - (child$37.return = completedWork), - (child$37 = child$37.sibling); + for (var child$36 = completedWork.child; null !== child$36; ) + (newChildLanes |= child$36.lanes | child$36.childLanes), + (subtreeFlags |= child$36.subtreeFlags & 14680064), + (subtreeFlags |= child$36.flags & 14680064), + (child$36.return = completedWork), + (child$36 = child$36.sibling); else - for (child$37 = completedWork.child; null !== child$37; ) - (newChildLanes |= child$37.lanes | child$37.childLanes), - (subtreeFlags |= child$37.subtreeFlags), - (subtreeFlags |= child$37.flags), - (child$37.return = completedWork), - (child$37 = child$37.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; @@ -5321,11 +5307,11 @@ function updateSuspenseFallbackChildren( workInProgress.child = primaryChildren; return fallbackChildren; } -function scheduleWorkOnFiber(fiber, renderLanes) { +function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) { fiber.lanes |= renderLanes; var alternate = fiber.alternate; null !== alternate && (alternate.lanes |= renderLanes); - scheduleWorkOnParentPath(fiber.return, renderLanes); + scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot); } function initSuspenseListRenderState( workInProgress, @@ -5364,8 +5350,9 @@ function updateSuspenseListComponent(current, workInProgress, renderLanes) { a: for (current = workInProgress.child; null !== current; ) { if (13 === current.tag) null !== current.memoizedState && - scheduleWorkOnFiber(current, renderLanes); - else if (19 === current.tag) scheduleWorkOnFiber(current, renderLanes); + scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress); + else if (19 === current.tag) + scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress); else if (null !== current.child) { current.child.return = current; current = current.child; @@ -5679,8 +5666,8 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$81 = effect.create; - effect.destroy = create$81(); + var create$80 = effect.create; + effect.destroy = create$80(); } effect = effect.next; } while (effect !== finishedWork); @@ -6130,8 +6117,8 @@ function commitMutationEffects(root, firstChild) { switch (firstChild.tag) { case 13: if (null !== firstChild.memoizedState) { - var current$86 = firstChild.alternate; - if (null === current$86 || null === current$86.memoizedState) + var current$85 = firstChild.alternate; + if (null === current$85 || null === current$85.memoizedState) globalMostRecentFallbackTime = now(); } break; @@ -6282,8 +6269,8 @@ function commitLayoutEffects(finishedWork) { commitUpdateQueue(firstChild, updateQueue, instance); break; case 3: - var updateQueue$82 = firstChild.updateQueue; - if (null !== updateQueue$82) { + var updateQueue$81 = firstChild.updateQueue; + if (null !== updateQueue$81) { current = null; if (null !== firstChild.child) switch (firstChild.child.tag) { @@ -6293,7 +6280,7 @@ function commitLayoutEffects(finishedWork) { case 1: current = firstChild.child.stateNode; } - commitUpdateQueue(firstChild, updateQueue$82, current); + commitUpdateQueue(firstChild, updateQueue$81, current); } break; case 5: @@ -6366,8 +6353,9 @@ var ceil = Math.ceil, workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, - workInProgressRootRenderPhaseUpdatedLanes = 0, workInProgressRootPingedLanes = 0, + workInProgressRootConcurrentErrors = null, + workInProgressRootRecoverableErrors = null, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, hasUncaughtError = !1, @@ -6413,19 +6401,18 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { var root = markUpdateLaneFromFiberToRoot(fiber, lane); if (null === root) return null; markRootUpdated(root, lane, eventTime); - 0 !== (executionContext & 2) && root === workInProgressRoot - ? (workInProgressRootRenderPhaseUpdatedLanes |= lane) - : (root === workInProgressRoot && - (0 === (executionContext & 2) && - (workInProgressRootInterleavedUpdatedLanes |= lane), - 4 === workInProgressRootExitStatus && - markRootSuspended$1(root, workInProgressRootRenderLanes)), + if (0 === (executionContext & 2) || root !== workInProgressRoot) + root === workInProgressRoot && + (0 === (executionContext & 2) && + (workInProgressRootInterleavedUpdatedLanes |= lane), + 4 === workInProgressRootExitStatus && + markRootSuspended$1(root, workInProgressRootRenderLanes)), ensureRootIsScheduled(root, eventTime), 1 === lane && 0 === executionContext && 0 === (fiber.mode & 1) && ((workInProgressRootRenderTargetTime = now() + 500), - includesLegacySyncCallbacks && flushSyncCallbacks())); + includesLegacySyncCallbacks && flushSyncCallbacks()); return root; } function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { @@ -6451,12 +6438,12 @@ function ensureRootIsScheduled(root, currentTime) { 0 < lanes; ) { - var index$7 = 31 - clz32(lanes), - lane = 1 << index$7, - expirationTime = expirationTimes[index$7]; + var index$6 = 31 - clz32(lanes), + lane = 1 << index$6, + expirationTime = expirationTimes[index$6]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$7] = computeExpirationTime(lane, currentTime); + expirationTimes[index$6] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } @@ -6596,7 +6583,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 1: throw Error("Root did not complete. This is a bug in React."); case 2: - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; case 3: markRootSuspended$1(root, lanes); @@ -6613,22 +6600,22 @@ function performConcurrentWorkOnRoot(root, didTimeout) { break; } root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root), + commitRoot.bind(null, root, workInProgressRootRecoverableErrors), didTimeout ); break; } - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; case 4: markRootSuspended$1(root, lanes); if ((lanes & 4194240) === lanes) break; didTimeout = root.eventTimes; for (prevExecutionContext = -1; 0 < lanes; ) { - var index$6 = 31 - clz32(lanes); - prevDispatcher = 1 << index$6; - index$6 = didTimeout[index$6]; - index$6 > prevExecutionContext && (prevExecutionContext = index$6); + var index$5 = 31 - clz32(lanes); + prevDispatcher = 1 << index$5; + index$5 = didTimeout[index$5]; + index$5 > prevExecutionContext && (prevExecutionContext = index$5); lanes &= ~prevDispatcher; } lanes = prevExecutionContext; @@ -6649,15 +6636,15 @@ function performConcurrentWorkOnRoot(root, didTimeout) { : 1960 * ceil(lanes / 1960)) - lanes; if (10 < lanes) { root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root), + commitRoot.bind(null, root, workInProgressRootRecoverableErrors), lanes ); break; } - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; case 5: - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; default: throw Error("Unknown root exit status."); @@ -6672,15 +6659,18 @@ function recoverFromConcurrentError(root, errorRetryLanes) { var prevExecutionContext = executionContext; executionContext |= 8; root.isDehydrated && (root.isDehydrated = !1); - for ( - var exitStatus, i = 0; - 50 > i && - ((exitStatus = renderRootSync(root, errorRetryLanes)), - 2 === exitStatus && 0 !== workInProgressRootRenderPhaseUpdatedLanes); - i++ - ); + var errorsFromFirstAttempt = workInProgressRootConcurrentErrors; + root = renderRootSync(root, errorRetryLanes); + 2 !== root && + null !== errorsFromFirstAttempt && + (null === workInProgressRootConcurrentErrors + ? (workInProgressRootRecoverableErrors = errorsFromFirstAttempt) + : (workInProgressRootConcurrentErrors = workInProgressRootConcurrentErrors.push.apply( + null, + errorsFromFirstAttempt + ))); executionContext = prevExecutionContext; - return exitStatus; + return root; } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -6722,9 +6712,9 @@ function markRootSuspended$1(root, suspendedLanes) { root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$8 = 31 - clz32(suspendedLanes), - lane = 1 << index$8; - root[index$8] = -1; + var index$7 = 31 - clz32(suspendedLanes), + lane = 1 << index$7; + root[index$7] = -1; suspendedLanes &= ~lane; } } @@ -6749,7 +6739,7 @@ function performSyncWorkOnRoot(root) { exitStatus); root.finishedWork = root.current.alternate; root.finishedLanes = lanes; - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); ensureRootIsScheduled(root, now()); return null; } @@ -6806,7 +6796,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootRenderLanes = subtreeRenderLanes = lanes; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = workInProgressRootRenderPhaseUpdatedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; + workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; + workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; if (null !== interleavedQueues) { for (root = 0; root < interleavedQueues.length; root++) if ( @@ -6960,8 +6951,12 @@ function handleError(root$jscomp$0, thrownValue) { " 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." ); } + root = value; 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); + null === workInProgressRootConcurrentErrors + ? (workInProgressRootConcurrentErrors = [root]) + : workInProgressRootConcurrentErrors.push(root); value = createCapturedValue(value, sourceFiber); root = returnFiber; do { @@ -6993,12 +6988,12 @@ function handleError(root$jscomp$0, thrownValue) { root.flags |= 65536; thrownValue &= -thrownValue; root.lanes |= thrownValue; - var update$34 = createClassErrorUpdate( + var update$33 = createClassErrorUpdate( root, wakeable, thrownValue ); - enqueueCapturedUpdate(root, update$34); + enqueueCapturedUpdate(root, update$33); break a; } } @@ -7093,20 +7088,20 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot(root) { +function commitRoot(root, recoverableErrors) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$2.transition; try { (ReactCurrentBatchConfig$2.transition = 0), (currentUpdatePriority = 1), - commitRootImpl(root, previousUpdateLanePriority); + commitRootImpl(root, recoverableErrors, previousUpdateLanePriority); } finally { (ReactCurrentBatchConfig$2.transition = prevTransition), (currentUpdatePriority = previousUpdateLanePriority); } return null; } -function commitRootImpl(root, renderPriorityLevel) { +function commitRootImpl(root, recoverableErrors, renderPriorityLevel) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); if (0 !== (executionContext & 6)) @@ -7161,6 +7156,15 @@ function commitRootImpl(root, renderPriorityLevel) { 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); onCommitRoot(finishedWork.stateNode, renderPriorityLevel); ensureRootIsScheduled(root, now()); + if (null !== recoverableErrors) + for ( + renderPriorityLevel = 0; + renderPriorityLevel < recoverableErrors.length; + renderPriorityLevel++ + ) + (finishedWork = recoverableErrors[renderPriorityLevel]), + (lanes = root.onRecoverableError), + null !== lanes && lanes(finishedWork); if (hasUncaughtError) throw ((hasUncaughtError = !1), (root = firstUncaughtError), @@ -7733,7 +7737,11 @@ beginWork$1 = function(current, workInProgress, renderLanes) { newValue.lanes |= renderLanes; dependency = newValue.alternate; null !== dependency && (dependency.lanes |= renderLanes); - scheduleWorkOnParentPath(newValue.return, renderLanes); + scheduleContextWorkOnParentPath( + newValue.return, + renderLanes, + workInProgress + ); list.lanes |= renderLanes; break; } @@ -8031,7 +8039,13 @@ function createFiberFromPortal(portal, mode, lanes) { }; return mode; } -function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { +function FiberRootNode( + containerInfo, + tag, + hydrate, + identifierPrefix, + onRecoverableError +) { this.tag = tag; this.containerInfo = containerInfo; this.finishedWork = this.pingCache = this.current = this.pendingChildren = null; @@ -8045,6 +8059,7 @@ function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); this.identifierPrefix = identifierPrefix; + this.onRecoverableError = onRecoverableError; } function createPortal(children, containerInfo, implementation) { var key = @@ -8255,10 +8270,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_967 = { + devToolsConfig$jscomp$inline_968 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.0.0-rc.0-51947a14b-20220113", + version: "18.0.0-rc.0-a3bde7974-20220208", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8273,11 +8288,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1230 = { - bundleType: devToolsConfig$jscomp$inline_967.bundleType, - version: devToolsConfig$jscomp$inline_967.version, - rendererPackageName: devToolsConfig$jscomp$inline_967.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_967.rendererConfig, +var internals$jscomp$inline_1232 = { + bundleType: devToolsConfig$jscomp$inline_968.bundleType, + version: devToolsConfig$jscomp$inline_968.version, + rendererPackageName: devToolsConfig$jscomp$inline_968.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_968.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8293,29 +8308,26 @@ var internals$jscomp$inline_1230 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_967.findFiberByHostInstance || + devToolsConfig$jscomp$inline_968.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.0.0-rc.0-51947a14b-20220113" + reconcilerVersion: "18.0.0-rc.0-a3bde7974-20220208" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1231 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1233 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1231.isDisabled && - hook$jscomp$inline_1231.supportsFiber + !hook$jscomp$inline_1233.isDisabled && + hook$jscomp$inline_1233.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1231.inject( - Object.assign({}, internals$jscomp$inline_1230, { - getLaneLabelMap: getLaneLabelMap, - injectProfilingHooks: injectProfilingHooks - }) + (rendererID = hook$jscomp$inline_1233.inject( + internals$jscomp$inline_1232 )), - (injectedHook = hook$jscomp$inline_1231); + (injectedHook = hook$jscomp$inline_1233); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { @@ -8361,7 +8373,7 @@ exports.findNodeHandle = findNodeHandle; exports.render = function(element, containerTag, callback) { var root = roots.get(containerTag); if (!root) { - root = new FiberRootNode(containerTag, 0, !1, ""); + root = new FiberRootNode(containerTag, 0, !1, "", null); var JSCompiler_inline_result = createFiber(3, null, null, 0); root.current = JSCompiler_inline_result; JSCompiler_inline_result.stateNode = root; diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index f9734c0a95088f..ec6c578705217a 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<<6fb23e3f27b69a5703944d58969d32f4>> */ @@ -2282,19 +2282,16 @@ function popProvider(context) { pop(valueCursor); context._currentValue = currentValue; } -function scheduleWorkOnParentPath(parent, renderLanes) { +function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { for (; null !== parent; ) { var alternate = parent.alternate; - if ((parent.childLanes & renderLanes) === renderLanes) - if ( - null === alternate || - (alternate.childLanes & renderLanes) === renderLanes - ) - break; - else alternate.childLanes |= renderLanes; - else - (parent.childLanes |= renderLanes), - null !== alternate && (alternate.childLanes |= renderLanes); + (parent.childLanes & renderLanes) !== renderLanes + ? ((parent.childLanes |= renderLanes), + null !== alternate && (alternate.childLanes |= renderLanes)) + : null !== alternate && + (alternate.childLanes & renderLanes) !== renderLanes && + (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; parent = parent.return; } } @@ -3768,28 +3765,37 @@ function updateMutableSource(source, getSnapshot, subscribe) { var hook = updateWorkInProgressHook(); return useMutableSource(hook, source, getSnapshot, subscribe); } -function mountSyncExternalStore(subscribe, getSnapshot) { +function updateSyncExternalStore(subscribe, getSnapshot) { var fiber = currentlyRenderingFiber$1, - 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." + hook = updateWorkInProgressHook(), + nextSnapshot = getSnapshot(), + snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot); + snapshotChanged && + ((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0)); + hook = hook.queue; + updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [ + subscribe + ]); + if ( + hook.getSnapshot !== getSnapshot || + snapshotChanged || + (null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1) + ) { + fiber.flags |= 2048; + pushEffect( + 9, + updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot), + void 0, + null ); - includesBlockingLane(root, renderLanes) || - pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); - hook.memoizedState = nextSnapshot; - 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, 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) { @@ -4179,7 +4185,32 @@ var ContextOnlyDispatcher = { }; return useMutableSource(hook, source, getSnapshot, subscribe); }, - useSyncExternalStore: mountSyncExternalStore, + useSyncExternalStore: function(subscribe, getSnapshot) { + var fiber = currentlyRenderingFiber$1, + 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; + 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, root, nextSnapshot, getSnapshot), + void 0, + null + ); + return nextSnapshot; + }, useId: function() { var hook = mountWorkInProgressHook(), identifierPrefix = workInProgressRoot.identifierPrefix, @@ -4228,46 +4259,7 @@ var ContextOnlyDispatcher = { return [isPending, start]; }, useMutableSource: updateMutableSource, - useSyncExternalStore: function(subscribe, getSnapshot) { - var fiber = currentlyRenderingFiber$1, - hook = updateWorkInProgressHook(), - nextSnapshot = getSnapshot(), - snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot); - snapshotChanged && - ((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0)); - hook = hook.queue; - updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [ - subscribe - ]); - if ( - hook.getSnapshot !== getSnapshot || - snapshotChanged || - (null !== workInProgressHook && - workInProgressHook.memoizedState.tag & 1) - ) { - fiber.flags |= 2048; - pushEffect( - 9, - updateStoreInstance.bind( - null, - fiber, - hook, - 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; - }, + useSyncExternalStore: updateSyncExternalStore, useId: updateId, unstable_isNewReconciler: !1 }, @@ -4310,7 +4302,7 @@ var ContextOnlyDispatcher = { return [isPending, start]; }, useMutableSource: updateMutableSource, - useSyncExternalStore: mountSyncExternalStore, + useSyncExternalStore: updateSyncExternalStore, useId: updateId, unstable_isNewReconciler: !1 }, @@ -5577,11 +5569,11 @@ function updateSuspenseFallbackChildren( workInProgress.child = primaryChildren; return fallbackChildren; } -function scheduleWorkOnFiber(fiber, renderLanes) { +function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) { fiber.lanes |= renderLanes; var alternate = fiber.alternate; null !== alternate && (alternate.lanes |= renderLanes); - scheduleWorkOnParentPath(fiber.return, renderLanes); + scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot); } function initSuspenseListRenderState( workInProgress, @@ -5620,8 +5612,9 @@ function updateSuspenseListComponent(current, workInProgress, renderLanes) { a: for (current = workInProgress.child; null !== current; ) { if (13 === current.tag) null !== current.memoizedState && - scheduleWorkOnFiber(current, renderLanes); - else if (19 === current.tag) scheduleWorkOnFiber(current, renderLanes); + scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress); + else if (19 === current.tag) + scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress); else if (null !== current.child) { current.child.return = current; current = current.child; @@ -6806,8 +6799,9 @@ var ceil = Math.ceil, workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, - workInProgressRootRenderPhaseUpdatedLanes = 0, workInProgressRootPingedLanes = 0, + workInProgressRootConcurrentErrors = null, + workInProgressRootRecoverableErrors = null, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, hasUncaughtError = !1, @@ -6854,9 +6848,8 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { var root = markUpdateLaneFromFiberToRoot(fiber, lane); if (null === root) return null; markRootUpdated(root, lane, eventTime); - 0 !== (executionContext & 2) && root === workInProgressRoot - ? (workInProgressRootRenderPhaseUpdatedLanes |= lane) - : (isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), + if (0 === (executionContext & 2) || root !== workInProgressRoot) + isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), root === workInProgressRoot && (0 === (executionContext & 2) && (workInProgressRootInterleavedUpdatedLanes |= lane), @@ -6867,7 +6860,7 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { 0 === executionContext && 0 === (fiber.mode & 1) && ((workInProgressRootRenderTargetTime = now() + 500), - includesLegacySyncCallbacks && flushSyncCallbacks())); + includesLegacySyncCallbacks && flushSyncCallbacks()); return root; } function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { @@ -7052,7 +7045,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 1: throw Error("Root did not complete. This is a bug in React."); case 2: - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; case 3: markRootSuspended$1(root, lanes); @@ -7069,12 +7062,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) { break; } root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root), + commitRoot.bind(null, root, workInProgressRootRecoverableErrors), didTimeout ); break; } - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; case 4: markRootSuspended$1(root, lanes); @@ -7105,15 +7098,15 @@ function performConcurrentWorkOnRoot(root, didTimeout) { : 1960 * ceil(lanes / 1960)) - lanes; if (10 < lanes) { root.timeoutHandle = scheduleTimeout( - commitRoot.bind(null, root), + commitRoot.bind(null, root, workInProgressRootRecoverableErrors), lanes ); break; } - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; case 5: - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); break; default: throw Error("Unknown root exit status."); @@ -7128,15 +7121,18 @@ function recoverFromConcurrentError(root, errorRetryLanes) { var prevExecutionContext = executionContext; executionContext |= 8; root.isDehydrated && (root.isDehydrated = !1); - for ( - var exitStatus, i = 0; - 50 > i && - ((exitStatus = renderRootSync(root, errorRetryLanes)), - 2 === exitStatus && 0 !== workInProgressRootRenderPhaseUpdatedLanes); - i++ - ); + var errorsFromFirstAttempt = workInProgressRootConcurrentErrors; + root = renderRootSync(root, errorRetryLanes); + 2 !== root && + null !== errorsFromFirstAttempt && + (null === workInProgressRootConcurrentErrors + ? (workInProgressRootRecoverableErrors = errorsFromFirstAttempt) + : (workInProgressRootConcurrentErrors = workInProgressRootConcurrentErrors.push.apply( + null, + errorsFromFirstAttempt + ))); executionContext = prevExecutionContext; - return exitStatus; + return root; } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -7207,7 +7203,7 @@ function performSyncWorkOnRoot(root) { exitStatus); root.finishedWork = root.current.alternate; root.finishedLanes = lanes; - commitRoot(root); + commitRoot(root, workInProgressRootRecoverableErrors); ensureRootIsScheduled(root, now()); return null; } @@ -7264,7 +7260,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootRenderLanes = subtreeRenderLanes = lanes; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = workInProgressRootRenderPhaseUpdatedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; + workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; + workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; if (null !== interleavedQueues) { for (root = 0; root < interleavedQueues.length; root++) if ( @@ -7445,8 +7442,12 @@ function handleError(root, thrownValue) { " 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." ); } + wakeable = value; 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); + null === workInProgressRootConcurrentErrors + ? (workInProgressRootConcurrentErrors = [wakeable]) + : workInProgressRootConcurrentErrors.push(wakeable); value = createCapturedValue(value, sourceFiber); wakeable = returnFiber; do { @@ -7609,20 +7610,20 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot(root) { +function commitRoot(root, recoverableErrors) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$2.transition; try { (ReactCurrentBatchConfig$2.transition = 0), (currentUpdatePriority = 1), - commitRootImpl(root, previousUpdateLanePriority); + commitRootImpl(root, recoverableErrors, previousUpdateLanePriority); } finally { (ReactCurrentBatchConfig$2.transition = prevTransition), (currentUpdatePriority = previousUpdateLanePriority); } return null; } -function commitRootImpl(root, renderPriorityLevel) { +function commitRootImpl(root, recoverableErrors, renderPriorityLevel) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); if (0 !== (executionContext & 6)) @@ -7688,6 +7689,15 @@ function commitRootImpl(root, renderPriorityLevel) { onCommitRoot(finishedWork.stateNode, renderPriorityLevel); isDevToolsPresent && root.memoizedUpdaters.clear(); ensureRootIsScheduled(root, now()); + if (null !== recoverableErrors) + for ( + renderPriorityLevel = 0; + renderPriorityLevel < recoverableErrors.length; + renderPriorityLevel++ + ) + (finishedWork = recoverableErrors[renderPriorityLevel]), + (lanes = root.onRecoverableError), + null !== lanes && lanes(finishedWork); if (hasUncaughtError) throw ((hasUncaughtError = !1), (root = firstUncaughtError), @@ -8342,7 +8352,11 @@ beginWork$1 = function(current, workInProgress, renderLanes) { newValue.lanes |= renderLanes; dependency = newValue.alternate; null !== dependency && (dependency.lanes |= renderLanes); - scheduleWorkOnParentPath(newValue.return, renderLanes); + scheduleContextWorkOnParentPath( + newValue.return, + renderLanes, + workInProgress + ); list.lanes |= renderLanes; break; } @@ -8656,7 +8670,13 @@ function createFiberFromPortal(portal, mode, lanes) { }; return mode; } -function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { +function FiberRootNode( + containerInfo, + tag, + hydrate, + identifierPrefix, + onRecoverableError +) { this.tag = tag; this.containerInfo = containerInfo; this.finishedWork = this.pingCache = this.current = this.pendingChildren = null; @@ -8670,6 +8690,7 @@ function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); this.identifierPrefix = identifierPrefix; + this.onRecoverableError = onRecoverableError; this.passiveEffectDuration = this.effectDuration = 0; this.memoizedUpdaters = new Set(); containerInfo = this.pendingUpdatersLaneMap = []; @@ -8887,10 +8908,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1043 = { + devToolsConfig$jscomp$inline_1045 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.0.0-rc.0-51947a14b-20220113", + version: "18.0.0-rc.0-a3bde7974-20220208", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8905,11 +8926,24 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1330 = { - bundleType: devToolsConfig$jscomp$inline_1043.bundleType, - version: devToolsConfig$jscomp$inline_1043.version, - rendererPackageName: devToolsConfig$jscomp$inline_1043.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1043.rendererConfig, +(function(internals) { + if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled || !hook.supportsFiber) return !0; + try { + (internals = Object.assign({}, internals, { + getLaneLabelMap: getLaneLabelMap, + injectProfilingHooks: injectProfilingHooks + })), + (rendererID = hook.inject(internals)), + (injectedHook = hook); + } catch (err) {} + return hook.checkDCE ? !0 : !1; +})({ + bundleType: devToolsConfig$jscomp$inline_1045.bundleType, + version: devToolsConfig$jscomp$inline_1045.version, + rendererPackageName: devToolsConfig$jscomp$inline_1045.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1045.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8925,31 +8959,15 @@ var internals$jscomp$inline_1330 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1043.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1045.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.0.0-rc.0-51947a14b-20220113" -}; -if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1331 = __REACT_DEVTOOLS_GLOBAL_HOOK__; - if ( - !hook$jscomp$inline_1331.isDisabled && - hook$jscomp$inline_1331.supportsFiber - ) - try { - (rendererID = hook$jscomp$inline_1331.inject( - Object.assign({}, internals$jscomp$inline_1330, { - getLaneLabelMap: getLaneLabelMap, - injectProfilingHooks: injectProfilingHooks - }) - )), - (injectedHook = hook$jscomp$inline_1331); - } catch (err) {} -} + reconcilerVersion: "18.0.0-rc.0-a3bde7974-20220208" +}); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { computeComponentStackForErrorReporting: function(reactTag) { return (reactTag = getInstanceFromTag(reactTag)) @@ -8993,7 +9011,7 @@ exports.findNodeHandle = findNodeHandle; exports.render = function(element, containerTag, callback) { var root = roots.get(containerTag); if (!root) { - root = new FiberRootNode(containerTag, 0, !1, ""); + root = new FiberRootNode(containerTag, 0, !1, "", null); var JSCompiler_inline_result = 0; isDevToolsPresent && (JSCompiler_inline_result |= 2); JSCompiler_inline_result = createFiber(