diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js index ba5d17585a..fb22b43280 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<85d4c20d55cfdfd42f825208f96c046d>> + * @generated SignedSource<<99f1fded76af1fea6984fd8b08571351>> */ 'use strict'; @@ -144,7 +144,7 @@ var enableProfilerNestedUpdatePhase = true; var createRootStrictEffectsByDefault = false; var enableLazyContextPropagation = false; var enableLegacyHidden = false; -var enableAsyncActions = false; +var enableAsyncActions = true; var alwaysThrottleRetries = true; var FunctionComponent = 0; @@ -2004,6 +2004,7 @@ function preloadInstance(type, props) { function waitForCommitToBeReady() { return null; } +var NotPendingTransition = null; function describeBuiltInComponentFrame(name, source, ownerFn) { { @@ -2595,6 +2596,27 @@ function isRootDehydrated(root) { var contextStackCursor = createCursor(null); var contextFiberStackCursor = createCursor(null); var rootInstanceStackCursor = createCursor(null); // Represents the nearest host transition provider (in React DOM, a
) +// NOTE: Since forms cannot be nested, and this feature is only implemented by +// React DOM, we don't technically need this to be a stack. It could be a single +// module variable instead. + +var hostTransitionProviderCursor = createCursor(null); // TODO: This should initialize to NotPendingTransition, a constant +// imported from the fiber config. However, because of a cycle in the module +// graph, that value isn't defined during this module's initialization. I can't +// think of a way to work around this without moving that value out of the +// fiber config. For now, the "no provider" case is handled when reading, +// inside useHostTransitionStatus. + +var HostTransitionContext = { + $$typeof: REACT_CONTEXT_TYPE, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + Provider: null, + Consumer: null, + _defaultValue: null, + _globalName: null +}; function requiredContext(c) { { @@ -2645,6 +2667,16 @@ function getHostContext() { } function pushHostContext(fiber) { + { + var stateHook = fiber.memoizedState; + + if (stateHook !== null) { + // Only provide context if this fiber has been upgraded by a host + // transition. We use the same optimization for regular host context below. + push(hostTransitionProviderCursor, fiber, fiber); + } + } + var context = requiredContext(contextStackCursor.current); var nextContext = getChildHostContext(); // Don't push this Fiber's context unless it's unique. @@ -2663,6 +2695,25 @@ function popHostContext(fiber) { pop(contextStackCursor, fiber); pop(contextFiberStackCursor, fiber); } + + { + if (hostTransitionProviderCursor.current === fiber) { + // Do not pop unless this Fiber provided the current context. This is mostly + // a performance optimization, but conveniently it also prevents a potential + // data race where a host provider is upgraded (i.e. memoizedState becomes + // non-null) during a concurrent event. This is a bit of a flaw in the way + // we upgrade host components, but because we're accounting for it here, it + // should be fine. + pop(hostTransitionProviderCursor, fiber); // When popping the transition provider, we reset the context value back + // to `null`. We can do this because you're not allowd to nest forms. If + // we allowed for multiple nested host transition providers, then we'd + // need to reset this to the parent provider's status. + + { + HostTransitionContext._currentValue2 = null; + } + } + } } var isHydrating = false; // This flag allows for warning supression when we expect there to be mismatches @@ -7076,6 +7127,35 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { return children; } + +function renderTransitionAwareHostComponentWithHooks( + current, + workInProgress, + lanes +) { + return renderWithHooks( + current, + workInProgress, + TransitionAwareHostComponent, + null, + null, + lanes + ); +} +function TransitionAwareHostComponent() { + var dispatcher = ReactCurrentDispatcher$1.current; + + var _dispatcher$useState = dispatcher.useState(), + maybeThenable = _dispatcher$useState[0]; + + if (typeof maybeThenable.then === "function") { + var thenable = maybeThenable; + return useThenable(thenable); + } else { + var status = maybeThenable; + return status; + } +} function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; // TODO: Don't need to reset the flags here, because they're reset in the // complete phase (bubbleProperties). @@ -7426,7 +7506,11 @@ function updateReducerImpl(hook, current, reducer) { ); markSkippedUpdateLanes(updateLane); } else { - { + // This update does have sufficient priority. + // Check if this is an optimistic update. + var revertLane = update.revertLane; + + if (revertLane === NoLane) { // This is not an optimistic update, and we're going to apply it now. // But, if there were earlier updates that were skipped, we need to // leave this update in the queue so it can be rebased later. @@ -7444,6 +7528,49 @@ function updateReducerImpl(hook, current, reducer) { }; newBaseQueueLast = newBaseQueueLast.next = _clone; } + } else { + // This is an optimistic update. If the "revert" priority is + // sufficient, don't apply the update. Otherwise, apply the update, + // but leave it in the queue so it can be either reverted or + // rebased in a subsequent render. + if (isSubsetOfLanes(renderLanes$1, revertLane)) { + // The transition that this optimistic update is associated with + // has finished. Pretend the update doesn't exist by skipping + // over it. + update = update.next; + continue; + } else { + var _clone2 = { + // Once we commit an optimistic update, we shouldn't uncommit it + // until the transition it is associated with has finished + // (represented by revertLane). Using NoLane here works because 0 + // is a subset of all bitmasks, so this will never be skipped by + // the check above. + lane: NoLane, + // Reuse the same revertLane so we know when the transition + // has finished. + revertLane: update.revertLane, + action: update.action, + hasEagerState: update.hasEagerState, + eagerState: update.eagerState, + next: null + }; + + if (newBaseQueueLast === null) { + newBaseQueueFirst = newBaseQueueLast = _clone2; + newBaseState = newState; + } else { + newBaseQueueLast = newBaseQueueLast.next = _clone2; + } // Update the remaining priority in the queue. + // TODO: Don't need to accumulate this. Instead, we can remove + // renderLanes from the original lanes. + + currentlyRenderingFiber$1.lanes = mergeLanes( + currentlyRenderingFiber$1.lanes, + revertLane + ); + markSkippedUpdateLanes(revertLane); + } } // Process this update. var action = update.action; @@ -7790,6 +7917,308 @@ function rerenderState(initialState) { return rerenderReducer(basicStateReducer); } +function mountOptimistic(passthrough, reducer) { + var hook = mountWorkInProgressHook(); + hook.memoizedState = hook.baseState = passthrough; + var queue = { + pending: null, + lanes: NoLanes, + dispatch: null, + // Optimistic state does not use the eager update optimization. + lastRenderedReducer: null, + lastRenderedState: null + }; + hook.queue = queue; // This is different than the normal setState function. + + var dispatch = dispatchOptimisticSetState.bind( + null, + currentlyRenderingFiber$1, + true, + queue + ); + queue.dispatch = dispatch; + return [passthrough, dispatch]; +} + +function updateOptimistic(passthrough, reducer) { + var hook = updateWorkInProgressHook(); + return updateOptimisticImpl(hook, currentHook, passthrough, reducer); +} + +function updateOptimisticImpl(hook, current, passthrough, reducer) { + // Optimistic updates are always rebased on top of the latest value passed in + // as an argument. It's called a passthrough because if there are no pending + // updates, it will be returned as-is. + // + // Reset the base state to the passthrough. Future updates will be applied + // on top of this. + hook.baseState = passthrough; // If a reducer is not provided, default to the same one used by useState. + + var resolvedReducer = + typeof reducer === "function" ? reducer : basicStateReducer; + return updateReducerImpl(hook, currentHook, resolvedReducer); +} + +function rerenderOptimistic(passthrough, reducer) { + // Unlike useState, useOptimistic doesn't support render phase updates. + // Also unlike useState, we need to replay all pending updates again in case + // the passthrough value changed. + // + // So instead of a forked re-render implementation that knows how to handle + // render phase udpates, we can use the same implementation as during a + // regular mount or update. + var hook = updateWorkInProgressHook(); + + if (currentHook !== null) { + // This is an update. Process the update queue. + return updateOptimisticImpl(hook, currentHook, passthrough, reducer); + } // This is a mount. No updates to process. + // Reset the base state to the passthrough. Future updates will be applied + // on top of this. + + hook.baseState = passthrough; + var dispatch = hook.queue.dispatch; + return [passthrough, dispatch]; +} // useFormState actions run sequentially, because each action receives the +// previous state as an argument. We store pending actions on a queue. + +function dispatchFormState(fiber, actionQueue, setState, payload) { + if (isRenderPhaseUpdate(fiber)) { + throw new Error("Cannot update form state while rendering."); + } + + var last = actionQueue.pending; + + if (last === null) { + // There are no pending actions; this is the first one. We can run + // it immediately. + var newLast = { + payload: payload, + next: null // circular + }; + newLast.next = actionQueue.pending = newLast; + runFormStateAction(actionQueue, setState, payload); + } else { + // There's already an action running. Add to the queue. + var first = last.next; + var _newLast = { + payload: payload, + next: first + }; + last.next = _newLast; + } +} + +function runFormStateAction(actionQueue, setState, payload) { + var action = actionQueue.action; + var prevState = actionQueue.state; // This is a fork of startTransition + + var prevTransition = ReactCurrentBatchConfig$2.transition; + ReactCurrentBatchConfig$2.transition = {}; + var currentTransition = ReactCurrentBatchConfig$2.transition; + + { + ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); + } + + try { + var promise = action(prevState, payload); + + if (true) { + if ( + promise === null || + typeof promise !== "object" || + typeof promise.then !== "function" + ) { + error("The action passed to useFormState must be an async function."); + } + } // Attach a listener to read the return state of the action. As soon as this + // resolves, we can run the next action in the sequence. + + promise.then( + function (nextState) { + actionQueue.state = nextState; + finishRunningFormStateAction(actionQueue, setState); + }, + function () { + return finishRunningFormStateAction(actionQueue, setState); + } + ); // Create a thenable that resolves once the current async action scope has + // finished. Then stash that thenable in state. We'll unwrap it with the + // `use` algorithm during render. This is the same logic used + // by startTransition. + + var entangledThenable = requestAsyncActionContext(promise, null); + setState(entangledThenable); + } finally { + ReactCurrentBatchConfig$2.transition = prevTransition; + + { + if (prevTransition === null && currentTransition._updatedFibers) { + var updatedFibersCount = currentTransition._updatedFibers.size; + + currentTransition._updatedFibers.clear(); + + if (updatedFibersCount > 10) { + warn( + "Detected a large number of updates inside startTransition. " + + "If this is due to a subscription please re-write it to use React provided hooks. " + + "Otherwise concurrent mode guarantees are off the table." + ); + } + } + } + } +} + +function finishRunningFormStateAction(actionQueue, setState) { + // The action finished running. Pop it from the queue and run the next pending + // action, if there are any. + var last = actionQueue.pending; + + if (last !== null) { + var first = last.next; + + if (first === last) { + // This was the last action in the queue. + actionQueue.pending = null; + } else { + // Remove the first node from the circular queue. + var next = first.next; + last.next = next; // Run the next action. + + runFormStateAction(actionQueue, setState, next.payload); + } + } +} + +function formStateReducer(oldState, newState) { + return newState; +} + +function mountFormState(action, initialStateProp, permalink) { + var initialState = initialStateProp; + + var initialStateThenable = { + status: "fulfilled", + value: initialState, + then: function () {} + }; // State hook. The state is stored in a thenable which is then unwrapped by + // the `use` algorithm during render. + + var stateHook = mountWorkInProgressHook(); + stateHook.memoizedState = stateHook.baseState = initialStateThenable; + var stateQueue = { + pending: null, + lanes: NoLanes, + dispatch: null, + lastRenderedReducer: formStateReducer, + lastRenderedState: initialStateThenable + }; + stateHook.queue = stateQueue; + var setState = dispatchSetState.bind( + null, + currentlyRenderingFiber$1, + stateQueue + ); + stateQueue.dispatch = setState; // Action queue hook. This is used to queue pending actions. The queue is + // shared between all instances of the hook. Similar to a regular state queue, + // but different because the actions are run sequentially, and they run in + // an event instead of during render. + + var actionQueueHook = mountWorkInProgressHook(); + var actionQueue = { + state: initialState, + dispatch: null, + // circular + action: action, + pending: null + }; + actionQueueHook.queue = actionQueue; + var dispatch = dispatchFormState.bind( + null, + currentlyRenderingFiber$1, + actionQueue, + setState + ); + actionQueue.dispatch = dispatch; // Stash the action function on the memoized state of the hook. We'll use this + // to detect when the action function changes so we can update it in + // an effect. + + actionQueueHook.memoizedState = action; + return [initialState, dispatch]; +} + +function updateFormState(action, initialState, permalink) { + var stateHook = updateWorkInProgressHook(); + var currentStateHook = currentHook; + return updateFormStateImpl(stateHook, currentStateHook, action); +} + +function updateFormStateImpl( + stateHook, + currentStateHook, + action, + initialState, + permalink +) { + var _updateReducerImpl = updateReducerImpl( + stateHook, + currentStateHook, + formStateReducer + ), + thenable = _updateReducerImpl[0]; // This will suspend until the action finishes. + + var state = useThenable(thenable); + var actionQueueHook = updateWorkInProgressHook(); + var actionQueue = actionQueueHook.queue; + var dispatch = actionQueue.dispatch; // Check if a new action was passed. If so, update it in an effect. + + var prevAction = actionQueueHook.memoizedState; + + if (action !== prevAction) { + currentlyRenderingFiber$1.flags |= Passive$1; + pushEffect( + HasEffect | Passive, + formStateActionEffect.bind(null, actionQueue, action), + createEffectInstance(), + null + ); + } + + return [state, dispatch]; +} + +function formStateActionEffect(actionQueue, action) { + actionQueue.action = action; +} + +function rerenderFormState(action, initialState, permalink) { + // Unlike useState, useFormState doesn't support render phase updates. + // Also unlike useState, we need to replay all pending updates again in case + // the passthrough value changed. + // + // So instead of a forked re-render implementation that knows how to handle + // render phase udpates, we can use the same implementation as during a + // regular mount or update. + var stateHook = updateWorkInProgressHook(); + var currentStateHook = currentHook; + + if (currentStateHook !== null) { + // This is an update. Process the update queue. + return updateFormStateImpl(stateHook, currentStateHook, action); + } // This is a mount. No updates to process. + + var thenable = stateHook.memoizedState; + var state = useThenable(thenable); + var actionQueueHook = updateWorkInProgressHook(); + var actionQueue = actionQueueHook.queue; + var dispatch = actionQueue.dispatch; // This may have changed during the rerender. + + actionQueueHook.memoizedState = action; + return [state, dispatch]; +} + function pushEffect(tag, create, inst, deps) { var effect = { tag: tag, @@ -8156,9 +8585,14 @@ function startTransition( var currentTransition = {}; { - ReactCurrentBatchConfig$2.transition = null; - dispatchSetState(fiber, queue, pendingState); + // We don't really need to use an optimistic update here, because we + // schedule a second "revert" update below (which we use to suspend the + // transition until the async action scope has finished). But we'll use an + // optimistic update anyway to make it less likely the behavior accidentally + // diverges; for example, both an optimistic update and this one should + // share the same lane. ReactCurrentBatchConfig$2.transition = currentTransition; + dispatchOptimisticSetState(fiber, false, queue, pendingState); } { @@ -8166,18 +8600,52 @@ function startTransition( } try { - var returnValue, thenable, entangledResult, _entangledResult; - if (enableAsyncActions); - else { - // Async actions are not enabled. - dispatchSetState(fiber, queue, finishedState); - callback(); + if (enableAsyncActions) { + var returnValue = callback(); // Check if we're inside an async action scope. If so, we'll entangle + // this new action with the existing scope. + // + // If we're not already inside an async action scope, and this action is + // async, then we'll create a new async scope. + // + // In the async case, the resulting render will suspend until the async + // action scope has finished. + + if ( + returnValue !== null && + typeof returnValue === "object" && + typeof returnValue.then === "function" + ) { + var thenable = returnValue; // This is a thenable that resolves to `finishedState` once the async + // action scope has finished. + + var entangledResult = requestAsyncActionContext( + thenable, + finishedState + ); + dispatchSetState(fiber, queue, entangledResult); + } else { + // This is either `finishedState` or a thenable that resolves to + // `finishedState`, depending on whether we're inside an async + // action scope. + var _entangledResult = requestSyncActionContext( + returnValue, + finishedState + ); + + dispatchSetState(fiber, queue, _entangledResult); + } } } catch (error) { { - // The error rethrowing behavior is only enabled when the async actions - // feature is on, even for sync actions. - throw error; + // This is a trick to get the `useTransition` hook to rethrow the error. + // When it unwraps the thenable with the `use` algorithm, the error + // will be thrown. + var rejectedThenable = { + then: function () {}, + status: "rejected", + reason: error + }; + dispatchSetState(fiber, queue, rejectedThenable); } } finally { setCurrentUpdatePriority(previousPriority); @@ -8242,6 +8710,11 @@ function rerenderTransition() { return [isPending, start]; } +function useHostTransitionStatus() { + var status = readContext(HostTransitionContext); + return status !== null ? status : NotPendingTransition; +} + function mountId() { var hook = mountWorkInProgressHook(); var root = getWorkInProgressRoot(); // TODO: In Fizz, id generation is specific to each server config. Maybe we @@ -8444,6 +8917,80 @@ function dispatchSetState(fiber, queue, action) { } } +function dispatchOptimisticSetState(fiber, throwIfDuringRender, queue, action) { + { + if (ReactCurrentBatchConfig$2.transition === null) { + // An optimistic update occurred, but startTransition is not on the stack. + // There are two likely scenarios. + // One possibility is that the optimistic update is triggered by a regular + // event handler (e.g. `onSubmit`) instead of an action. This is a mistake + // and we will warn. + // The other possibility is the optimistic update is inside an async + // action, but after an `await`. In this case, we can make it "just work" + // by associating the optimistic update with the pending async action. + // Technically it's possible that the optimistic update is unrelated to + // the pending action, but we don't have a way of knowing this for sure + // because browsers currently do not provide a way to track async scope. + // (The AsyncContext proposal, if it lands, will solve this in the + // future.) However, this is no different than the problem of unrelated + // transitions being grouped together — it's not wrong per se, but it's + // not ideal. + // Once AsyncContext starts landing in browsers, we will provide better + // warnings in development for these cases. + if (peekEntangledActionLane() !== NoLane); + else { + // There's no pending async action. The most likely cause is that we're + // inside a regular event handler (e.g. onSubmit) instead of an action. + error( + "An optimistic state update occurred outside a transition or " + + "action. To fix, move the update to an action, or wrap " + + "with startTransition." + ); + } + } + } + + var update = { + // An optimistic update commits synchronously. + lane: SyncLane, + // After committing, the optimistic update is "reverted" using the same + // lane as the transition it's associated with. + revertLane: requestTransitionLane(), + action: action, + hasEagerState: false, + eagerState: null, + next: null + }; + + if (isRenderPhaseUpdate(fiber)) { + // When calling startTransition during render, this warns instead of + // throwing because throwing would be a breaking change. setOptimisticState + // is a new API so it's OK to throw. + if (throwIfDuringRender) { + throw new Error("Cannot update optimistic state while rendering."); + } else { + // startTransition was called during render. We don't need to do anything + // besides warn here because the render phase update would be overidden by + // the second update, anyway. We can remove this branch and make it throw + // in a future release. + { + error("Cannot call startTransition while rendering."); + } + } + } else { + var root = enqueueConcurrentHookUpdate(fiber, queue, update, SyncLane); + + if (root !== null) { + // NOTE: The optimistic update implementation assumes that the transition + // will never be attempted before the optimistic update. This currently + // holds because the optimistic update is always synchronous. If we ever + // change that, we'll need to account for this. + scheduleUpdateOnFiber(root, fiber, SyncLane); // Optimistic updates are always synchronous, so we don't need to call + // entangleTransitionUpdate here. + } + } +} + function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( @@ -8514,6 +9061,15 @@ var ContextOnlyDispatcher = { ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; } +{ + ContextOnlyDispatcher.useHostTransitionStatus = throwInvalidHookError; + ContextOnlyDispatcher.useFormState = throwInvalidHookError; +} + +{ + ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; +} + var HooksDispatcherOnMountInDEV = null; var HooksDispatcherOnMountWithHookTypesInDEV = null; var HooksDispatcherOnUpdateInDEV = null; @@ -8661,6 +9217,32 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; }; } + { + HooksDispatcherOnMountInDEV.useHostTransitionStatus = + useHostTransitionStatus; + + HooksDispatcherOnMountInDEV.useFormState = function useFormState( + action, + initialState, + permalink + ) { + currentHookNameInDev = "useFormState"; + mountHookTypesDev(); + return mountFormState(action, initialState); + }; + } + + { + HooksDispatcherOnMountInDEV.useOptimistic = function useOptimistic( + passthrough, + reducer + ) { + currentHookNameInDev = "useOptimistic"; + mountHookTypesDev(); + return mountOptimistic(passthrough); + }; + } + HooksDispatcherOnMountWithHookTypesInDEV = { readContext: function (context) { return readContext(context); @@ -8776,6 +9358,27 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; }; } + { + HooksDispatcherOnMountWithHookTypesInDEV.useHostTransitionStatus = + useHostTransitionStatus; + + HooksDispatcherOnMountWithHookTypesInDEV.useFormState = + function useFormState(action, initialState, permalink) { + currentHookNameInDev = "useFormState"; + updateHookTypesDev(); + return mountFormState(action, initialState); + }; + } + + { + HooksDispatcherOnMountWithHookTypesInDEV.useOptimistic = + function useOptimistic(passthrough, reducer) { + currentHookNameInDev = "useOptimistic"; + updateHookTypesDev(); + return mountOptimistic(passthrough); + }; + } + HooksDispatcherOnUpdateInDEV = { readContext: function (context) { return readContext(context); @@ -8890,6 +9493,32 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; }; } + { + HooksDispatcherOnUpdateInDEV.useHostTransitionStatus = + useHostTransitionStatus; + + HooksDispatcherOnUpdateInDEV.useFormState = function useFormState( + action, + initialState, + permalink + ) { + currentHookNameInDev = "useFormState"; + updateHookTypesDev(); + return updateFormState(action); + }; + } + + { + HooksDispatcherOnUpdateInDEV.useOptimistic = function useOptimistic( + passthrough, + reducer + ) { + currentHookNameInDev = "useOptimistic"; + updateHookTypesDev(); + return updateOptimistic(passthrough, reducer); + }; + } + HooksDispatcherOnRerenderInDEV = { readContext: function (context) { return readContext(context); @@ -9005,6 +9634,32 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; }; } + { + HooksDispatcherOnRerenderInDEV.useHostTransitionStatus = + useHostTransitionStatus; + + HooksDispatcherOnRerenderInDEV.useFormState = function useFormState( + action, + initialState, + permalink + ) { + currentHookNameInDev = "useFormState"; + updateHookTypesDev(); + return rerenderFormState(action); + }; + } + + { + HooksDispatcherOnRerenderInDEV.useOptimistic = function useOptimistic( + passthrough, + reducer + ) { + currentHookNameInDev = "useOptimistic"; + updateHookTypesDev(); + return rerenderOptimistic(passthrough, reducer); + }; + } + InvalidNestedHooksDispatcherOnMountInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -9139,6 +9794,29 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; }; } + { + InvalidNestedHooksDispatcherOnMountInDEV.useHostTransitionStatus = + useHostTransitionStatus; + + InvalidNestedHooksDispatcherOnMountInDEV.useFormState = + function useFormState(action, initialState, permalink) { + currentHookNameInDev = "useFormState"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountFormState(action, initialState); + }; + } + + { + InvalidNestedHooksDispatcherOnMountInDEV.useOptimistic = + function useOptimistic(passthrough, reducer) { + currentHookNameInDev = "useOptimistic"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountOptimistic(passthrough); + }; + } + InvalidNestedHooksDispatcherOnUpdateInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -9273,6 +9951,29 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; }; } + { + InvalidNestedHooksDispatcherOnUpdateInDEV.useHostTransitionStatus = + useHostTransitionStatus; + + InvalidNestedHooksDispatcherOnUpdateInDEV.useFormState = + function useFormState(action, initialState, permalink) { + currentHookNameInDev = "useFormState"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateFormState(action); + }; + } + + { + InvalidNestedHooksDispatcherOnUpdateInDEV.useOptimistic = + function useOptimistic(passthrough, reducer) { + currentHookNameInDev = "useOptimistic"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateOptimistic(passthrough, reducer); + }; + } + InvalidNestedHooksDispatcherOnRerenderInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -9406,6 +10107,29 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; return updateRefresh(); }; } + + { + InvalidNestedHooksDispatcherOnRerenderInDEV.useHostTransitionStatus = + useHostTransitionStatus; + + InvalidNestedHooksDispatcherOnRerenderInDEV.useFormState = + function useFormState(action, initialState, permalink) { + currentHookNameInDev = "useFormState"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return rerenderFormState(action); + }; + } + + { + InvalidNestedHooksDispatcherOnRerenderInDEV.useOptimistic = + function useOptimistic(passthrough, reducer) { + currentHookNameInDev = "useOptimistic"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return rerenderOptimistic(passthrough, reducer); + }; + } } var now = Scheduler$1.unstable_now; @@ -12254,6 +12978,57 @@ function updateHostComponent$1(current, workInProgress, renderLanes) { workInProgress.flags |= ContentReset; } + { + var memoizedState = workInProgress.memoizedState; + + if (memoizedState !== null) { + // This fiber has been upgraded to a stateful component. The only way + // happens currently is for form actions. We use hooks to track the + // pending and error state of the form. + // + // Once a fiber is upgraded to be stateful, it remains stateful for the + // rest of its lifetime. + var newState = renderTransitionAwareHostComponentWithHooks( + current, + workInProgress, + renderLanes + ); // If the transition state changed, propagate the change to all the + // descendents. We use Context as an implementation detail for this. + // + // This is intentionally set here instead of pushHostContext because + // pushHostContext gets called before we process the state hook, to avoid + // a state mismatch in the event that something suspends. + // + // NOTE: This assumes that there cannot be nested transition providers, + // because the only renderer that implements this feature is React DOM, + // and forms cannot be nested. If we did support nested providers, then + // we would need to push a context value even for host fibers that + // haven't been upgraded yet. + + { + HostTransitionContext._currentValue2 = newState; + } + + { + if (didReceiveUpdate) { + if (current !== null) { + var oldStateHook = current.memoizedState; + var oldState = oldStateHook.memoizedState; // This uses regular equality instead of Object.is because we assume + // that host transition state doesn't include NaN as a valid type. + + if (oldState !== newState) { + propagateContextChange( + workInProgress, + HostTransitionContext, + renderLanes + ); + } + } + } + } + } + } + markRef$1(current, workInProgress); reconcileChildren(current, workInProgress, nextChildren, renderLanes); return workInProgress.child; @@ -23997,7 +24772,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-canary-88d56b8e8-20231004"; +var ReactVersion = "18.3.0-canary-bfefb2284-20231004"; // Might add PROFILE later. diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js index 217414bc38..0c1ae48bda 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<14e99fd9af6d1296fe24000cb0277c83>> + * @generated SignedSource<> */ "use strict"; @@ -668,7 +668,18 @@ function is(x, y) { var objectIs = "function" === typeof Object.is ? Object.is : is, contextStackCursor = createCursor(null), contextFiberStackCursor = createCursor(null), - rootInstanceStackCursor = createCursor(null); + rootInstanceStackCursor = createCursor(null), + hostTransitionProviderCursor = createCursor(null), + HostTransitionContext = { + $$typeof: REACT_CONTEXT_TYPE, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + Provider: null, + Consumer: null, + _defaultValue: null, + _globalName: null + }; function pushHostContainer(fiber, nextRootInstance) { push(rootInstanceStackCursor, nextRootInstance); push(contextFiberStackCursor, fiber); @@ -682,6 +693,7 @@ function popHostContainer() { pop(rootInstanceStackCursor); } function pushHostContext(fiber) { + null !== fiber.memoizedState && push(hostTransitionProviderCursor, fiber); contextStackCursor.current !== NO_CONTEXT && (push(contextFiberStackCursor, fiber), push(contextStackCursor, NO_CONTEXT)); @@ -689,6 +701,9 @@ function pushHostContext(fiber) { function popHostContext(fiber) { contextFiberStackCursor.current === fiber && (pop(contextStackCursor), pop(contextFiberStackCursor)); + hostTransitionProviderCursor.current === fiber && + (pop(hostTransitionProviderCursor), + (HostTransitionContext._currentValue2 = null)); } var hydrationErrors = null, concurrentQueues = [], @@ -729,6 +744,10 @@ function enqueueUpdate$1(fiber, queue, update, lane) { fiber = fiber.alternate; null !== fiber && (fiber.lanes |= lane); } +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + enqueueUpdate$1(fiber, queue, update, lane); + return getRootForUpdatedFiber(fiber); +} function enqueueConcurrentRenderForLane(fiber, lane) { enqueueUpdate$1(fiber, null, null, lane); return getRootForUpdatedFiber(fiber); @@ -2177,6 +2196,88 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { root.callbackNode = suspendedLanes; return currentTime; } +function requestTransitionLane() { + 0 === currentEventTransitionLane && + (currentEventTransitionLane = claimNextTransitionLane()); + return currentEventTransitionLane; +} +var currentEntangledListeners = null, + currentEntangledPendingCount = 0, + currentEntangledLane = 0; +function requestAsyncActionContext(actionReturnValue, overrideReturnValue) { + if (null === currentEntangledListeners) { + var entangledListeners = (currentEntangledListeners = []); + currentEntangledPendingCount = 0; + currentEntangledLane = requestTransitionLane(); + } else entangledListeners = currentEntangledListeners; + currentEntangledPendingCount++; + var resultThenable = createResultThenable(entangledListeners), + resultStatus = "pending", + resultValue, + rejectedReason; + actionReturnValue.then( + function (value) { + resultStatus = "fulfilled"; + resultValue = null !== overrideReturnValue ? overrideReturnValue : value; + pingEngtangledActionScope(); + }, + function (error) { + resultStatus = "rejected"; + rejectedReason = error; + pingEngtangledActionScope(); + } + ); + entangledListeners.push(function () { + switch (resultStatus) { + case "fulfilled": + resultThenable.status = "fulfilled"; + resultThenable.value = resultValue; + break; + case "rejected": + resultThenable.status = "rejected"; + resultThenable.reason = rejectedReason; + break; + default: + throw Error( + "Thenable should have already resolved. This is a bug in React." + ); + } + }); + return resultThenable; +} +function requestSyncActionContext(actionReturnValue, overrideReturnValue) { + var resultValue = + null !== overrideReturnValue ? overrideReturnValue : actionReturnValue; + if (null === currentEntangledListeners) return resultValue; + actionReturnValue = currentEntangledListeners; + var resultThenable = createResultThenable(actionReturnValue); + actionReturnValue.push(function () { + resultThenable.status = "fulfilled"; + resultThenable.value = resultValue; + }); + return resultThenable; +} +function pingEngtangledActionScope() { + if ( + null !== currentEntangledListeners && + 0 === --currentEntangledPendingCount + ) { + var listeners = currentEntangledListeners; + currentEntangledListeners = null; + for (var i = (currentEntangledLane = 0); i < listeners.length; i++) + (0, listeners[i])(); + } +} +function createResultThenable(entangledListeners) { + return { + status: "pending", + value: null, + reason: null, + then: function (resolve) { + entangledListeners.push(resolve); + } + }; +} var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes$1 = 0, @@ -2262,6 +2363,12 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { } while (didScheduleRenderPhaseUpdateDuringThisPass); return children; } +function TransitionAwareHostComponent() { + var maybeThenable = ReactCurrentDispatcher$1.current.useState()[0]; + return "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; +} function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; workInProgress.flags &= -2053; @@ -2366,9 +2473,11 @@ function basicStateReducer(state, action) { return "function" === typeof action ? action(state) : action; } function updateReducer(reducer) { - var hook = updateWorkInProgressHook(), - current = currentHook, - queue = hook.queue; + var hook = updateWorkInProgressHook(); + return updateReducerImpl(hook, currentHook, reducer); +} +function updateReducerImpl(hook, current, reducer) { + var queue = hook.queue; if (null === queue) throw Error( "Should have a queue. This is likely a bug in React. Please file an issue." @@ -2397,39 +2506,59 @@ function updateReducer(reducer) { updateLane !== update.lane ? (workInProgressRootRenderLanes & updateLane) === updateLane : (renderLanes$1 & updateLane) === updateLane - ) - null !== newBaseQueueLast && - (newBaseQueueLast = newBaseQueueLast.next = - { - lane: 0, - revertLane: 0, - action: update.action, - hasEagerState: update.hasEagerState, - eagerState: update.eagerState, - next: null - }), - (updateLane = update.action), - shouldDoubleInvokeUserFnsInHooksDEV && - reducer(pendingQueue, updateLane), - (pendingQueue = update.hasEagerState - ? update.eagerState - : reducer(pendingQueue, updateLane)); - else { - var clone = { + ) { + updateLane = update.revertLane; + if (0 === updateLane) + null !== newBaseQueueLast && + (newBaseQueueLast = newBaseQueueLast.next = + { + lane: 0, + revertLane: 0, + action: update.action, + hasEagerState: update.hasEagerState, + eagerState: update.eagerState, + next: null + }); + else if ((renderLanes$1 & updateLane) === updateLane) { + update = update.next; + continue; + } else { + var clone$27 = { + lane: 0, + revertLane: update.revertLane, + action: update.action, + hasEagerState: update.hasEagerState, + eagerState: update.eagerState, + next: null + }; + null === newBaseQueueLast + ? ((newBaseQueueFirst = newBaseQueueLast = clone$27), + (baseFirst = pendingQueue)) + : (newBaseQueueLast = newBaseQueueLast.next = clone$27); + currentlyRenderingFiber$1.lanes |= updateLane; + workInProgressRootSkippedLanes |= updateLane; + } + updateLane = update.action; + shouldDoubleInvokeUserFnsInHooksDEV && + reducer(pendingQueue, updateLane); + pendingQueue = update.hasEagerState + ? update.eagerState + : reducer(pendingQueue, updateLane); + } else + (clone$27 = { lane: updateLane, revertLane: update.revertLane, action: update.action, hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null - }; - null === newBaseQueueLast - ? ((newBaseQueueFirst = newBaseQueueLast = clone), - (baseFirst = pendingQueue)) - : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; - workInProgressRootSkippedLanes |= updateLane; - } + }), + null === newBaseQueueLast + ? ((newBaseQueueFirst = newBaseQueueLast = clone$27), + (baseFirst = pendingQueue)) + : (newBaseQueueLast = newBaseQueueLast.next = clone$27), + (currentlyRenderingFiber$1.lanes |= updateLane), + (workInProgressRootSkippedLanes |= updateLane); update = update.next; } while (null !== update && update !== current); null === newBaseQueueLast @@ -2553,6 +2682,83 @@ function mountStateImpl(initialState) { }; return hook; } +function updateOptimisticImpl(hook, current, passthrough, reducer) { + hook.baseState = passthrough; + return updateReducerImpl( + hook, + currentHook, + "function" === typeof reducer ? reducer : basicStateReducer + ); +} +function dispatchFormState(fiber, actionQueue, setState, payload) { + if (isRenderPhaseUpdate(fiber)) + throw Error("Cannot update form state while rendering."); + fiber = actionQueue.pending; + null === fiber + ? ((fiber = { payload: payload, next: null }), + (fiber.next = actionQueue.pending = fiber), + runFormStateAction(actionQueue, setState, payload)) + : (fiber.next = { payload: payload, next: fiber.next }); +} +function runFormStateAction(actionQueue, setState, payload) { + var action = actionQueue.action, + prevState = actionQueue.state, + prevTransition = ReactCurrentBatchConfig$2.transition; + ReactCurrentBatchConfig$2.transition = {}; + try { + var promise = action(prevState, payload); + promise.then( + function (nextState) { + actionQueue.state = nextState; + finishRunningFormStateAction(actionQueue, setState); + }, + function () { + return finishRunningFormStateAction(actionQueue, setState); + } + ); + var entangledThenable = requestAsyncActionContext(promise, null); + setState(entangledThenable); + } finally { + ReactCurrentBatchConfig$2.transition = prevTransition; + } +} +function finishRunningFormStateAction(actionQueue, setState) { + var last = actionQueue.pending; + if (null !== last) { + var first = last.next; + first === last + ? (actionQueue.pending = null) + : ((first = first.next), + (last.next = first), + runFormStateAction(actionQueue, setState, first.payload)); + } +} +function formStateReducer(oldState, newState) { + return newState; +} +function updateFormStateImpl(stateHook, currentStateHook, action) { + stateHook = updateReducerImpl( + stateHook, + currentStateHook, + formStateReducer + )[0]; + stateHook = useThenable(stateHook); + currentStateHook = updateWorkInProgressHook(); + var actionQueue = currentStateHook.queue, + dispatch = actionQueue.dispatch; + action !== currentStateHook.memoizedState && + ((currentlyRenderingFiber$1.flags |= 2048), + pushEffect( + 9, + formStateActionEffect.bind(null, actionQueue, action), + { destroy: void 0 }, + null + )); + return [stateHook, dispatch]; +} +function formStateActionEffect(actionQueue, action) { + actionQueue.action = action; +} function pushEffect(tag, create, inst, deps) { tag = { tag: tag, create: create, inst: inst, deps: deps, next: null }; create = currentlyRenderingFiber$1.updateQueue; @@ -2666,18 +2872,42 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = null; - dispatchSetState(fiber, queue, pendingState); ReactCurrentBatchConfig$2.transition = {}; + dispatchOptimisticSetState(fiber, !1, queue, pendingState); try { - dispatchSetState(fiber, queue, finishedState), callback(); + var returnValue = callback(); + if ( + null !== returnValue && + "object" === typeof returnValue && + "function" === typeof returnValue.then + ) { + var entangledResult = requestAsyncActionContext( + returnValue, + finishedState + ); + dispatchSetState(fiber, queue, entangledResult); + } else { + var entangledResult$30 = requestSyncActionContext( + returnValue, + finishedState + ); + dispatchSetState(fiber, queue, entangledResult$30); + } } catch (error) { - throw error; + dispatchSetState(fiber, queue, { + then: function () {}, + status: "rejected", + reason: error + }); } finally { (currentUpdatePriority = previousPriority), (ReactCurrentBatchConfig$2.transition = prevTransition); } } +function useHostTransitionStatus() { + var status = readContext(HostTransitionContext); + return null !== status ? status : null; +} function updateId() { return updateWorkInProgressHook().memoizedState; } @@ -2714,8 +2944,7 @@ function dispatchReducerAction(fiber, queue, action) { }; isRenderPhaseUpdate(fiber) ? enqueueRenderPhaseUpdate(queue, action) - : (enqueueUpdate$1(fiber, queue, action, lane), - (action = getRootForUpdatedFiber(fiber)), + : ((action = enqueueConcurrentHookUpdate(fiber, queue, action, lane)), null !== action && (scheduleUpdateOnFiber(action, fiber, lane), entangleTransitionUpdate(action, queue, lane))); @@ -2751,13 +2980,34 @@ function dispatchSetState(fiber, queue, action) { } catch (error) { } finally { } - enqueueUpdate$1(fiber, queue, update, lane); - action = getRootForUpdatedFiber(fiber); + action = enqueueConcurrentHookUpdate(fiber, queue, update, lane); null !== action && (scheduleUpdateOnFiber(action, fiber, lane), entangleTransitionUpdate(action, queue, lane)); } } +function dispatchOptimisticSetState(fiber, throwIfDuringRender, queue, action) { + action = { + lane: 2, + revertLane: requestTransitionLane(), + action: action, + hasEagerState: !1, + eagerState: null, + next: null + }; + if (isRenderPhaseUpdate(fiber)) { + if (throwIfDuringRender) + throw Error("Cannot update optimistic state while rendering."); + } else + (throwIfDuringRender = enqueueConcurrentHookUpdate( + fiber, + queue, + action, + 2 + )), + null !== throwIfDuringRender && + scheduleUpdateOnFiber(throwIfDuringRender, fiber, 2); +} function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( @@ -2803,167 +3053,236 @@ var ContextOnlyDispatcher = { useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; +ContextOnlyDispatcher.useHostTransitionStatus = throwInvalidHookError; +ContextOnlyDispatcher.useFormState = throwInvalidHookError; +ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; var HooksDispatcherOnMount = { - readContext: readContext, - use: use, - useCallback: function (callback, deps) { - mountWorkInProgressHook().memoizedState = [ - callback, - void 0 === deps ? null : deps - ]; - return callback; - }, - useContext: readContext, - useEffect: mountEffect, - useImperativeHandle: function (ref, create, deps) { - deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; - mountEffectImpl( - 4194308, - 4, - imperativeHandleEffect.bind(null, create, ref), - deps - ); - }, - useLayoutEffect: function (create, deps) { - return mountEffectImpl(4194308, 4, create, deps); - }, - useInsertionEffect: function (create, deps) { - mountEffectImpl(4, 2, create, deps); - }, - useMemo: function (nextCreate, deps) { - var hook = mountWorkInProgressHook(); - deps = void 0 === deps ? null : deps; - shouldDoubleInvokeUserFnsInHooksDEV && nextCreate(); - nextCreate = nextCreate(); - hook.memoizedState = [nextCreate, deps]; - return nextCreate; - }, - useReducer: function (reducer, initialArg, init) { - var hook = mountWorkInProgressHook(); - initialArg = void 0 !== init ? init(initialArg) : initialArg; - hook.memoizedState = hook.baseState = initialArg; - reducer = { - pending: null, - lanes: 0, - dispatch: null, - lastRenderedReducer: reducer, - lastRenderedState: initialArg - }; - hook.queue = reducer; - reducer = reducer.dispatch = dispatchReducerAction.bind( - null, - currentlyRenderingFiber$1, - reducer - ); - return [hook.memoizedState, reducer]; - }, - useRef: function (initialValue) { - var hook = mountWorkInProgressHook(); - initialValue = { current: initialValue }; - return (hook.memoizedState = initialValue); - }, - useState: function (initialState) { - initialState = mountStateImpl(initialState); - var queue = initialState.queue, - dispatch = dispatchSetState.bind( - null, - currentlyRenderingFiber$1, - queue - ); - queue.dispatch = dispatch; - return [initialState.memoizedState, dispatch]; - }, - useDebugValue: mountDebugValue, - useDeferredValue: function (value) { - return (mountWorkInProgressHook().memoizedState = value); - }, - useTransition: function () { - var stateHook = mountStateImpl(!1); - stateHook = startTransition.bind( - null, - currentlyRenderingFiber$1, - stateHook.queue, - !0, - !1 - ); - mountWorkInProgressHook().memoizedState = stateHook; - return [!1, stateHook]; - }, - 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$1) || - 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), - { destroy: void 0 }, - null - ); - return nextSnapshot; - }, - useId: function () { - var hook = mountWorkInProgressHook(), - identifierPrefix = workInProgressRoot.identifierPrefix, - globalClientId = globalClientIdCounter++; - identifierPrefix = - ":" + identifierPrefix + "r" + globalClientId.toString(32) + ":"; - return (hook.memoizedState = identifierPrefix); - }, - useCacheRefresh: function () { - return (mountWorkInProgressHook().memoizedState = refreshCache.bind( - null, - currentlyRenderingFiber$1 - )); - } + readContext: readContext, + use: use, + useCallback: function (callback, deps) { + mountWorkInProgressHook().memoizedState = [ + callback, + void 0 === deps ? null : deps + ]; + return callback; }, - HooksDispatcherOnUpdate = { - readContext: readContext, - use: use, - useCallback: updateCallback, - useContext: readContext, - useEffect: updateEffect, - useImperativeHandle: updateImperativeHandle, - useInsertionEffect: updateInsertionEffect, - useLayoutEffect: updateLayoutEffect, - useMemo: updateMemo, - useReducer: updateReducer, - useRef: updateRef, - useState: function () { - return updateReducer(basicStateReducer); + useContext: readContext, + useEffect: mountEffect, + useImperativeHandle: function (ref, create, deps) { + deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; + mountEffectImpl( + 4194308, + 4, + imperativeHandleEffect.bind(null, create, ref), + deps + ); + }, + useLayoutEffect: function (create, deps) { + return mountEffectImpl(4194308, 4, create, deps); + }, + useInsertionEffect: function (create, deps) { + mountEffectImpl(4, 2, create, deps); + }, + useMemo: function (nextCreate, deps) { + var hook = mountWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + shouldDoubleInvokeUserFnsInHooksDEV && nextCreate(); + nextCreate = nextCreate(); + hook.memoizedState = [nextCreate, deps]; + return nextCreate; + }, + useReducer: function (reducer, initialArg, init) { + var hook = mountWorkInProgressHook(); + initialArg = void 0 !== init ? init(initialArg) : initialArg; + hook.memoizedState = hook.baseState = initialArg; + reducer = { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: reducer, + lastRenderedState: initialArg + }; + hook.queue = reducer; + reducer = reducer.dispatch = dispatchReducerAction.bind( + null, + currentlyRenderingFiber$1, + reducer + ); + return [hook.memoizedState, reducer]; + }, + useRef: function (initialValue) { + var hook = mountWorkInProgressHook(); + initialValue = { current: initialValue }; + return (hook.memoizedState = initialValue); + }, + useState: function (initialState) { + initialState = mountStateImpl(initialState); + var queue = initialState.queue, + dispatch = dispatchSetState.bind(null, currentlyRenderingFiber$1, queue); + queue.dispatch = dispatch; + return [initialState.memoizedState, dispatch]; + }, + useDebugValue: mountDebugValue, + useDeferredValue: function (value) { + return (mountWorkInProgressHook().memoizedState = value); + }, + useTransition: function () { + var stateHook = mountStateImpl(!1); + stateHook = startTransition.bind( + null, + currentlyRenderingFiber$1, + stateHook.queue, + !0, + !1 + ); + mountWorkInProgressHook().memoizedState = stateHook; + return [!1, stateHook]; + }, + 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$1) || + 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), + { destroy: void 0 }, + null + ); + return nextSnapshot; + }, + useId: function () { + var hook = mountWorkInProgressHook(), + identifierPrefix = workInProgressRoot.identifierPrefix, + globalClientId = globalClientIdCounter++; + identifierPrefix = + ":" + identifierPrefix + "r" + globalClientId.toString(32) + ":"; + return (hook.memoizedState = identifierPrefix); + }, + useCacheRefresh: function () { + return (mountWorkInProgressHook().memoizedState = refreshCache.bind( + null, + currentlyRenderingFiber$1 + )); + } +}; +HooksDispatcherOnMount.useHostTransitionStatus = useHostTransitionStatus; +HooksDispatcherOnMount.useFormState = function (action, initialStateProp) { + var initialStateThenable = { + status: "fulfilled", + value: initialStateProp, + then: function () {} }, - useDebugValue: mountDebugValue, - useDeferredValue: function (value) { - var hook = updateWorkInProgressHook(); - return updateDeferredValueImpl(hook, currentHook.memoizedState, value); - }, - useTransition: function () { - var booleanOrThenable = updateReducer(basicStateReducer)[0], - start = updateWorkInProgressHook().memoizedState; - return [ - "boolean" === typeof booleanOrThenable - ? booleanOrThenable - : useThenable(booleanOrThenable), - start - ]; - }, - useSyncExternalStore: updateSyncExternalStore, - useId: updateId + stateHook = mountWorkInProgressHook(); + stateHook.memoizedState = stateHook.baseState = initialStateThenable; + initialStateThenable = { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: formStateReducer, + lastRenderedState: initialStateThenable }; + stateHook.queue = initialStateThenable; + stateHook = dispatchSetState.bind( + null, + currentlyRenderingFiber$1, + initialStateThenable + ); + initialStateThenable.dispatch = stateHook; + initialStateThenable = mountWorkInProgressHook(); + var actionQueue = { + state: initialStateProp, + dispatch: null, + action: action, + pending: null + }; + initialStateThenable.queue = actionQueue; + stateHook = dispatchFormState.bind( + null, + currentlyRenderingFiber$1, + actionQueue, + stateHook + ); + actionQueue.dispatch = stateHook; + initialStateThenable.memoizedState = action; + return [initialStateProp, stateHook]; +}; +HooksDispatcherOnMount.useOptimistic = function (passthrough) { + var hook = mountWorkInProgressHook(); + hook.memoizedState = hook.baseState = passthrough; + var queue = { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: null, + lastRenderedState: null + }; + hook.queue = queue; + hook = dispatchOptimisticSetState.bind( + null, + currentlyRenderingFiber$1, + !0, + queue + ); + queue.dispatch = hook; + return [passthrough, hook]; +}; +var HooksDispatcherOnUpdate = { + readContext: readContext, + use: use, + useCallback: updateCallback, + useContext: readContext, + useEffect: updateEffect, + useImperativeHandle: updateImperativeHandle, + useInsertionEffect: updateInsertionEffect, + useLayoutEffect: updateLayoutEffect, + useMemo: updateMemo, + useReducer: updateReducer, + useRef: updateRef, + useState: function () { + return updateReducer(basicStateReducer); + }, + useDebugValue: mountDebugValue, + useDeferredValue: function (value) { + var hook = updateWorkInProgressHook(); + return updateDeferredValueImpl(hook, currentHook.memoizedState, value); + }, + useTransition: function () { + var booleanOrThenable = updateReducer(basicStateReducer)[0], + start = updateWorkInProgressHook().memoizedState; + return [ + "boolean" === typeof booleanOrThenable + ? booleanOrThenable + : useThenable(booleanOrThenable), + start + ]; + }, + useSyncExternalStore: updateSyncExternalStore, + useId: updateId +}; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; +HooksDispatcherOnUpdate.useHostTransitionStatus = useHostTransitionStatus; +HooksDispatcherOnUpdate.useFormState = function (action) { + var stateHook = updateWorkInProgressHook(); + return updateFormStateImpl(stateHook, currentHook, action); +}; +HooksDispatcherOnUpdate.useOptimistic = function (passthrough, reducer) { + var hook = updateWorkInProgressHook(); + return updateOptimisticImpl(hook, currentHook, passthrough, reducer); +}; var HooksDispatcherOnRerender = { readContext: readContext, use: use, @@ -3000,6 +3319,25 @@ var HooksDispatcherOnRerender = { useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; +HooksDispatcherOnRerender.useHostTransitionStatus = useHostTransitionStatus; +HooksDispatcherOnRerender.useFormState = function (action) { + var stateHook = updateWorkInProgressHook(), + currentStateHook = currentHook; + if (null !== currentStateHook) + return updateFormStateImpl(stateHook, currentStateHook, action); + stateHook = useThenable(stateHook.memoizedState); + currentStateHook = updateWorkInProgressHook(); + var dispatch = currentStateHook.queue.dispatch; + currentStateHook.memoizedState = action; + return [stateHook, dispatch]; +}; +HooksDispatcherOnRerender.useOptimistic = function (passthrough, reducer) { + var hook = updateWorkInProgressHook(); + if (null !== currentHook) + return updateOptimisticImpl(hook, currentHook, passthrough, reducer); + hook.baseState = passthrough; + return [passthrough, hook.queue.dispatch]; +}; function resolveDefaultProps(Component, baseProps) { if (Component && Component.defaultProps) { baseProps = assign({}, baseProps); @@ -4513,14 +4851,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$59 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$59 = lastTailNode), + for (var lastTailNode$62 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$62 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$59 + null === lastTailNode$62 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$59.sibling = null); + : (lastTailNode$62.sibling = null); } } function bubbleProperties(completedWork) { @@ -4530,19 +4868,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$60 = completedWork.child; null !== child$60; ) - (newChildLanes |= child$60.lanes | child$60.childLanes), - (subtreeFlags |= child$60.subtreeFlags & 31457280), - (subtreeFlags |= child$60.flags & 31457280), - (child$60.return = completedWork), - (child$60 = child$60.sibling); + for (var child$63 = completedWork.child; null !== child$63; ) + (newChildLanes |= child$63.lanes | child$63.childLanes), + (subtreeFlags |= child$63.subtreeFlags & 31457280), + (subtreeFlags |= child$63.flags & 31457280), + (child$63.return = completedWork), + (child$63 = child$63.sibling); else - for (child$60 = completedWork.child; null !== child$60; ) - (newChildLanes |= child$60.lanes | child$60.childLanes), - (subtreeFlags |= child$60.subtreeFlags), - (subtreeFlags |= child$60.flags), - (child$60.return = completedWork), - (child$60 = child$60.sibling); + for (child$63 = completedWork.child; null !== child$63; ) + (newChildLanes |= child$63.lanes | child$63.childLanes), + (subtreeFlags |= child$63.subtreeFlags), + (subtreeFlags |= child$63.flags), + (child$63.return = completedWork), + (child$63 = child$63.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -4703,11 +5041,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (index = newProps.alternate.memoizedState.cachePool.pool); - var cache$64 = null; + var cache$67 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$64 = newProps.memoizedState.cachePool.pool); - cache$64 !== index && (newProps.flags |= 2048); + (cache$67 = newProps.memoizedState.cachePool.pool); + cache$67 !== index && (newProps.flags |= 2048); } renderLanes !== current && renderLanes && @@ -4734,8 +5072,8 @@ function completeWork(current, workInProgress, renderLanes) { index = workInProgress.memoizedState; if (null === index) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$64 = index.rendering; - if (null === cache$64) + cache$67 = index.rendering; + if (null === cache$67) if (newProps) cutOffTailIfNeeded(index, !1); else { if ( @@ -4743,11 +5081,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$64 = findFirstSuspended(current); - if (null !== cache$64) { + cache$67 = findFirstSuspended(current); + if (null !== cache$67) { workInProgress.flags |= 128; cutOffTailIfNeeded(index, !1); - current = cache$64.updateQueue; + current = cache$67.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -4772,7 +5110,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$64)), null !== current)) { + if (((current = findFirstSuspended(cache$67)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -4782,7 +5120,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(index, !0), null === index.tail && "hidden" === index.tailMode && - !cache$64.alternate) + !cache$67.alternate) ) return bubbleProperties(workInProgress), null; } else @@ -4794,13 +5132,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(index, !1), (workInProgress.lanes = 8388608)); index.isBackwards - ? ((cache$64.sibling = workInProgress.child), - (workInProgress.child = cache$64)) + ? ((cache$67.sibling = workInProgress.child), + (workInProgress.child = cache$67)) : ((current = index.last), null !== current - ? (current.sibling = cache$64) - : (workInProgress.child = cache$64), - (index.last = cache$64)); + ? (current.sibling = cache$67) + : (workInProgress.child = cache$67), + (index.last = cache$67)); } if (null !== index.tail) return ( @@ -5013,8 +5351,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$80) { - captureCommitPhaseError(current, nearestMountedAncestor, error$80); + } catch (error$83) { + captureCommitPhaseError(current, nearestMountedAncestor, error$83); } else ref.current = null; } @@ -5120,10 +5458,10 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$81 = effect.create, + var create$84 = effect.create, inst = effect.inst; - create$81 = create$81(); - inst.destroy = create$81; + create$84 = create$84(); + inst.destroy = create$84; } effect = effect.next; } while (effect !== finishedWork); @@ -5177,11 +5515,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$82) { + } catch (error$85) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$82 + error$85 ); } } @@ -5558,8 +5896,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$90) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$90); + } catch (error$93) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$93); } } break; @@ -5597,8 +5935,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { finishedWork.updateQueue = null; try { (flags.type = type), (flags.props = existingHiddenCallbacks); - } catch (error$93) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$93); + } catch (error$96) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$96); } } break; @@ -5614,8 +5952,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { existingHiddenCallbacks = finishedWork.memoizedProps; try { flags.text = existingHiddenCallbacks; - } catch (error$94) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$94); + } catch (error$97) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$97); } } break; @@ -5699,11 +6037,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { wasHidden.stateNode.isHidden = existingHiddenCallbacks ? !0 : !1; - } catch (error$84) { + } catch (error$87) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$84 + error$87 ); } } else if ( @@ -5781,12 +6119,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$85 = JSCompiler_inline_result.stateNode.containerInfo, - before$86 = getHostSibling(finishedWork); + var parent$88 = JSCompiler_inline_result.stateNode.containerInfo, + before$89 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$86, - parent$85 + before$89, + parent$88 ); break; default: @@ -6435,9 +6773,8 @@ function requestUpdateLane(fiber) { return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; if (null !== ReactCurrentBatchConfig$1.transition) return ( - 0 === currentEventTransitionLane && - (currentEventTransitionLane = claimNextTransitionLane()), - currentEventTransitionLane + (fiber = currentEntangledLane), + 0 !== fiber ? fiber : requestTransitionLane() ); fiber = currentUpdatePriority; return 0 !== fiber ? fiber : 32; @@ -6816,8 +7153,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$102) { - handleThrow(root, thrownValue$102); + } catch (thrownValue$105) { + handleThrow(root, thrownValue$105); } while (1); lanes && root.shellSuspendCounter++; @@ -6925,8 +7262,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$104) { - handleThrow(root, thrownValue$104); + } catch (thrownValue$107) { + handleThrow(root, thrownValue$107); } while (1); resetContextDependencies(); @@ -7097,10 +7434,10 @@ function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var retryQueue$29 = offscreenQueue.retryQueue; - null === retryQueue$29 + var retryQueue$32 = offscreenQueue.retryQueue; + null === retryQueue$32 ? (offscreenQueue.retryQueue = new Set([wakeable])) - : retryQueue$29.add(wakeable); + : retryQueue$32.add(wakeable); } attachPingListener(root, wakeable, thrownValue); } @@ -7696,6 +8033,24 @@ beginWork = function (current, workInProgress, renderLanes) { return ( pushHostContext(workInProgress), (Component = workInProgress.pendingProps.children), + null !== workInProgress.memoizedState && + ((context = renderWithHooks( + current, + workInProgress, + TransitionAwareHostComponent, + null, + null, + renderLanes + )), + (HostTransitionContext._currentValue2 = context), + didReceiveUpdate && + null !== current && + current.memoizedState.memoizedState !== context && + propagateContextChange( + workInProgress, + HostTransitionContext, + renderLanes + )), markRef$1(current, workInProgress), reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child @@ -8618,19 +8973,19 @@ function wrapFiber(fiber) { fiberToWrapper.set(fiber, wrapper)); return wrapper; } -var devToolsConfig$jscomp$inline_1030 = { +var devToolsConfig$jscomp$inline_998 = { findFiberByHostInstance: function () { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-88d56b8e8-20231004", + version: "18.3.0-canary-bfefb2284-20231004", rendererPackageName: "react-test-renderer" }; -var internals$jscomp$inline_1229 = { - bundleType: devToolsConfig$jscomp$inline_1030.bundleType, - version: devToolsConfig$jscomp$inline_1030.version, - rendererPackageName: devToolsConfig$jscomp$inline_1030.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1030.rendererConfig, +var internals$jscomp$inline_1191 = { + bundleType: devToolsConfig$jscomp$inline_998.bundleType, + version: devToolsConfig$jscomp$inline_998.version, + rendererPackageName: devToolsConfig$jscomp$inline_998.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_998.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8647,26 +9002,26 @@ var internals$jscomp$inline_1229 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1030.findFiberByHostInstance || + devToolsConfig$jscomp$inline_998.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-88d56b8e8-20231004" + reconcilerVersion: "18.3.0-canary-bfefb2284-20231004" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1230 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1192 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1230.isDisabled && - hook$jscomp$inline_1230.supportsFiber + !hook$jscomp$inline_1192.isDisabled && + hook$jscomp$inline_1192.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1230.inject( - internals$jscomp$inline_1229 + (rendererID = hook$jscomp$inline_1192.inject( + internals$jscomp$inline_1191 )), - (injectedHook = hook$jscomp$inline_1230); + (injectedHook = hook$jscomp$inline_1192); } catch (err) {} } exports._Scheduler = Scheduler; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js index ddabf62ec3..bf8ba8c15c 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<56dc6116bc4d9736f3dd6138f782afb8>> + * @generated SignedSource<> */ "use strict"; @@ -686,7 +686,18 @@ function is(x, y) { var objectIs = "function" === typeof Object.is ? Object.is : is, contextStackCursor = createCursor(null), contextFiberStackCursor = createCursor(null), - rootInstanceStackCursor = createCursor(null); + rootInstanceStackCursor = createCursor(null), + hostTransitionProviderCursor = createCursor(null), + HostTransitionContext = { + $$typeof: REACT_CONTEXT_TYPE, + _currentValue: null, + _currentValue2: null, + _threadCount: 0, + Provider: null, + Consumer: null, + _defaultValue: null, + _globalName: null + }; function pushHostContainer(fiber, nextRootInstance) { push(rootInstanceStackCursor, nextRootInstance); push(contextFiberStackCursor, fiber); @@ -700,6 +711,7 @@ function popHostContainer() { pop(rootInstanceStackCursor); } function pushHostContext(fiber) { + null !== fiber.memoizedState && push(hostTransitionProviderCursor, fiber); contextStackCursor.current !== NO_CONTEXT && (push(contextFiberStackCursor, fiber), push(contextStackCursor, NO_CONTEXT)); @@ -707,6 +719,9 @@ function pushHostContext(fiber) { function popHostContext(fiber) { contextFiberStackCursor.current === fiber && (pop(contextStackCursor), pop(contextFiberStackCursor)); + hostTransitionProviderCursor.current === fiber && + (pop(hostTransitionProviderCursor), + (HostTransitionContext._currentValue2 = null)); } var hydrationErrors = null, concurrentQueues = [], @@ -747,6 +762,10 @@ function enqueueUpdate$1(fiber, queue, update, lane) { fiber = fiber.alternate; null !== fiber && (fiber.lanes |= lane); } +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + enqueueUpdate$1(fiber, queue, update, lane); + return getRootForUpdatedFiber(fiber); +} function enqueueConcurrentRenderForLane(fiber, lane) { enqueueUpdate$1(fiber, null, null, lane); return getRootForUpdatedFiber(fiber); @@ -2197,6 +2216,88 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { root.callbackNode = suspendedLanes; return currentTime; } +function requestTransitionLane() { + 0 === currentEventTransitionLane && + (currentEventTransitionLane = claimNextTransitionLane()); + return currentEventTransitionLane; +} +var currentEntangledListeners = null, + currentEntangledPendingCount = 0, + currentEntangledLane = 0; +function requestAsyncActionContext(actionReturnValue, overrideReturnValue) { + if (null === currentEntangledListeners) { + var entangledListeners = (currentEntangledListeners = []); + currentEntangledPendingCount = 0; + currentEntangledLane = requestTransitionLane(); + } else entangledListeners = currentEntangledListeners; + currentEntangledPendingCount++; + var resultThenable = createResultThenable(entangledListeners), + resultStatus = "pending", + resultValue, + rejectedReason; + actionReturnValue.then( + function (value) { + resultStatus = "fulfilled"; + resultValue = null !== overrideReturnValue ? overrideReturnValue : value; + pingEngtangledActionScope(); + }, + function (error) { + resultStatus = "rejected"; + rejectedReason = error; + pingEngtangledActionScope(); + } + ); + entangledListeners.push(function () { + switch (resultStatus) { + case "fulfilled": + resultThenable.status = "fulfilled"; + resultThenable.value = resultValue; + break; + case "rejected": + resultThenable.status = "rejected"; + resultThenable.reason = rejectedReason; + break; + default: + throw Error( + "Thenable should have already resolved. This is a bug in React." + ); + } + }); + return resultThenable; +} +function requestSyncActionContext(actionReturnValue, overrideReturnValue) { + var resultValue = + null !== overrideReturnValue ? overrideReturnValue : actionReturnValue; + if (null === currentEntangledListeners) return resultValue; + actionReturnValue = currentEntangledListeners; + var resultThenable = createResultThenable(actionReturnValue); + actionReturnValue.push(function () { + resultThenable.status = "fulfilled"; + resultThenable.value = resultValue; + }); + return resultThenable; +} +function pingEngtangledActionScope() { + if ( + null !== currentEntangledListeners && + 0 === --currentEntangledPendingCount + ) { + var listeners = currentEntangledListeners; + currentEntangledListeners = null; + for (var i = (currentEntangledLane = 0); i < listeners.length; i++) + (0, listeners[i])(); + } +} +function createResultThenable(entangledListeners) { + return { + status: "pending", + value: null, + reason: null, + then: function (resolve) { + entangledListeners.push(resolve); + } + }; +} var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, renderLanes$1 = 0, @@ -2282,6 +2383,12 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { } while (didScheduleRenderPhaseUpdateDuringThisPass); return children; } +function TransitionAwareHostComponent() { + var maybeThenable = ReactCurrentDispatcher$1.current.useState()[0]; + return "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; +} function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; workInProgress.flags &= -2053; @@ -2386,9 +2493,11 @@ function basicStateReducer(state, action) { return "function" === typeof action ? action(state) : action; } function updateReducer(reducer) { - var hook = updateWorkInProgressHook(), - current = currentHook, - queue = hook.queue; + var hook = updateWorkInProgressHook(); + return updateReducerImpl(hook, currentHook, reducer); +} +function updateReducerImpl(hook, current, reducer) { + var queue = hook.queue; if (null === queue) throw Error( "Should have a queue. This is likely a bug in React. Please file an issue." @@ -2417,39 +2526,59 @@ function updateReducer(reducer) { updateLane !== update.lane ? (workInProgressRootRenderLanes & updateLane) === updateLane : (renderLanes$1 & updateLane) === updateLane - ) - null !== newBaseQueueLast && - (newBaseQueueLast = newBaseQueueLast.next = - { - lane: 0, - revertLane: 0, - action: update.action, - hasEagerState: update.hasEagerState, - eagerState: update.eagerState, - next: null - }), - (updateLane = update.action), - shouldDoubleInvokeUserFnsInHooksDEV && - reducer(pendingQueue, updateLane), - (pendingQueue = update.hasEagerState - ? update.eagerState - : reducer(pendingQueue, updateLane)); - else { - var clone = { + ) { + updateLane = update.revertLane; + if (0 === updateLane) + null !== newBaseQueueLast && + (newBaseQueueLast = newBaseQueueLast.next = + { + lane: 0, + revertLane: 0, + action: update.action, + hasEagerState: update.hasEagerState, + eagerState: update.eagerState, + next: null + }); + else if ((renderLanes$1 & updateLane) === updateLane) { + update = update.next; + continue; + } else { + var clone$27 = { + lane: 0, + revertLane: update.revertLane, + action: update.action, + hasEagerState: update.hasEagerState, + eagerState: update.eagerState, + next: null + }; + null === newBaseQueueLast + ? ((newBaseQueueFirst = newBaseQueueLast = clone$27), + (baseFirst = pendingQueue)) + : (newBaseQueueLast = newBaseQueueLast.next = clone$27); + currentlyRenderingFiber$1.lanes |= updateLane; + workInProgressRootSkippedLanes |= updateLane; + } + updateLane = update.action; + shouldDoubleInvokeUserFnsInHooksDEV && + reducer(pendingQueue, updateLane); + pendingQueue = update.hasEagerState + ? update.eagerState + : reducer(pendingQueue, updateLane); + } else + (clone$27 = { lane: updateLane, revertLane: update.revertLane, action: update.action, hasEagerState: update.hasEagerState, eagerState: update.eagerState, next: null - }; - null === newBaseQueueLast - ? ((newBaseQueueFirst = newBaseQueueLast = clone), - (baseFirst = pendingQueue)) - : (newBaseQueueLast = newBaseQueueLast.next = clone); - currentlyRenderingFiber$1.lanes |= updateLane; - workInProgressRootSkippedLanes |= updateLane; - } + }), + null === newBaseQueueLast + ? ((newBaseQueueFirst = newBaseQueueLast = clone$27), + (baseFirst = pendingQueue)) + : (newBaseQueueLast = newBaseQueueLast.next = clone$27), + (currentlyRenderingFiber$1.lanes |= updateLane), + (workInProgressRootSkippedLanes |= updateLane); update = update.next; } while (null !== update && update !== current); null === newBaseQueueLast @@ -2573,6 +2702,83 @@ function mountStateImpl(initialState) { }; return hook; } +function updateOptimisticImpl(hook, current, passthrough, reducer) { + hook.baseState = passthrough; + return updateReducerImpl( + hook, + currentHook, + "function" === typeof reducer ? reducer : basicStateReducer + ); +} +function dispatchFormState(fiber, actionQueue, setState, payload) { + if (isRenderPhaseUpdate(fiber)) + throw Error("Cannot update form state while rendering."); + fiber = actionQueue.pending; + null === fiber + ? ((fiber = { payload: payload, next: null }), + (fiber.next = actionQueue.pending = fiber), + runFormStateAction(actionQueue, setState, payload)) + : (fiber.next = { payload: payload, next: fiber.next }); +} +function runFormStateAction(actionQueue, setState, payload) { + var action = actionQueue.action, + prevState = actionQueue.state, + prevTransition = ReactCurrentBatchConfig$2.transition; + ReactCurrentBatchConfig$2.transition = {}; + try { + var promise = action(prevState, payload); + promise.then( + function (nextState) { + actionQueue.state = nextState; + finishRunningFormStateAction(actionQueue, setState); + }, + function () { + return finishRunningFormStateAction(actionQueue, setState); + } + ); + var entangledThenable = requestAsyncActionContext(promise, null); + setState(entangledThenable); + } finally { + ReactCurrentBatchConfig$2.transition = prevTransition; + } +} +function finishRunningFormStateAction(actionQueue, setState) { + var last = actionQueue.pending; + if (null !== last) { + var first = last.next; + first === last + ? (actionQueue.pending = null) + : ((first = first.next), + (last.next = first), + runFormStateAction(actionQueue, setState, first.payload)); + } +} +function formStateReducer(oldState, newState) { + return newState; +} +function updateFormStateImpl(stateHook, currentStateHook, action) { + stateHook = updateReducerImpl( + stateHook, + currentStateHook, + formStateReducer + )[0]; + stateHook = useThenable(stateHook); + currentStateHook = updateWorkInProgressHook(); + var actionQueue = currentStateHook.queue, + dispatch = actionQueue.dispatch; + action !== currentStateHook.memoizedState && + ((currentlyRenderingFiber$1.flags |= 2048), + pushEffect( + 9, + formStateActionEffect.bind(null, actionQueue, action), + { destroy: void 0 }, + null + )); + return [stateHook, dispatch]; +} +function formStateActionEffect(actionQueue, action) { + actionQueue.action = action; +} function pushEffect(tag, create, inst, deps) { tag = { tag: tag, create: create, inst: inst, deps: deps, next: null }; create = currentlyRenderingFiber$1.updateQueue; @@ -2686,18 +2892,42 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; var prevTransition = ReactCurrentBatchConfig$2.transition; - ReactCurrentBatchConfig$2.transition = null; - dispatchSetState(fiber, queue, pendingState); ReactCurrentBatchConfig$2.transition = {}; + dispatchOptimisticSetState(fiber, !1, queue, pendingState); try { - dispatchSetState(fiber, queue, finishedState), callback(); + var returnValue = callback(); + if ( + null !== returnValue && + "object" === typeof returnValue && + "function" === typeof returnValue.then + ) { + var entangledResult = requestAsyncActionContext( + returnValue, + finishedState + ); + dispatchSetState(fiber, queue, entangledResult); + } else { + var entangledResult$30 = requestSyncActionContext( + returnValue, + finishedState + ); + dispatchSetState(fiber, queue, entangledResult$30); + } } catch (error) { - throw error; + dispatchSetState(fiber, queue, { + then: function () {}, + status: "rejected", + reason: error + }); } finally { (currentUpdatePriority = previousPriority), (ReactCurrentBatchConfig$2.transition = prevTransition); } } +function useHostTransitionStatus() { + var status = readContext(HostTransitionContext); + return null !== status ? status : null; +} function updateId() { return updateWorkInProgressHook().memoizedState; } @@ -2734,8 +2964,7 @@ function dispatchReducerAction(fiber, queue, action) { }; isRenderPhaseUpdate(fiber) ? enqueueRenderPhaseUpdate(queue, action) - : (enqueueUpdate$1(fiber, queue, action, lane), - (action = getRootForUpdatedFiber(fiber)), + : ((action = enqueueConcurrentHookUpdate(fiber, queue, action, lane)), null !== action && (scheduleUpdateOnFiber(action, fiber, lane), entangleTransitionUpdate(action, queue, lane))); @@ -2771,13 +3000,34 @@ function dispatchSetState(fiber, queue, action) { } catch (error) { } finally { } - enqueueUpdate$1(fiber, queue, update, lane); - action = getRootForUpdatedFiber(fiber); + action = enqueueConcurrentHookUpdate(fiber, queue, update, lane); null !== action && (scheduleUpdateOnFiber(action, fiber, lane), entangleTransitionUpdate(action, queue, lane)); } } +function dispatchOptimisticSetState(fiber, throwIfDuringRender, queue, action) { + action = { + lane: 2, + revertLane: requestTransitionLane(), + action: action, + hasEagerState: !1, + eagerState: null, + next: null + }; + if (isRenderPhaseUpdate(fiber)) { + if (throwIfDuringRender) + throw Error("Cannot update optimistic state while rendering."); + } else + (throwIfDuringRender = enqueueConcurrentHookUpdate( + fiber, + queue, + action, + 2 + )), + null !== throwIfDuringRender && + scheduleUpdateOnFiber(throwIfDuringRender, fiber, 2); +} function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; return ( @@ -2823,167 +3073,236 @@ var ContextOnlyDispatcher = { useId: throwInvalidHookError }; ContextOnlyDispatcher.useCacheRefresh = throwInvalidHookError; +ContextOnlyDispatcher.useHostTransitionStatus = throwInvalidHookError; +ContextOnlyDispatcher.useFormState = throwInvalidHookError; +ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; var HooksDispatcherOnMount = { - readContext: readContext, - use: use, - useCallback: function (callback, deps) { - mountWorkInProgressHook().memoizedState = [ - callback, - void 0 === deps ? null : deps - ]; - return callback; - }, - useContext: readContext, - useEffect: mountEffect, - useImperativeHandle: function (ref, create, deps) { - deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; - mountEffectImpl( - 4194308, - 4, - imperativeHandleEffect.bind(null, create, ref), - deps - ); - }, - useLayoutEffect: function (create, deps) { - return mountEffectImpl(4194308, 4, create, deps); - }, - useInsertionEffect: function (create, deps) { - mountEffectImpl(4, 2, create, deps); - }, - useMemo: function (nextCreate, deps) { - var hook = mountWorkInProgressHook(); - deps = void 0 === deps ? null : deps; - shouldDoubleInvokeUserFnsInHooksDEV && nextCreate(); - nextCreate = nextCreate(); - hook.memoizedState = [nextCreate, deps]; - return nextCreate; - }, - useReducer: function (reducer, initialArg, init) { - var hook = mountWorkInProgressHook(); - initialArg = void 0 !== init ? init(initialArg) : initialArg; - hook.memoizedState = hook.baseState = initialArg; - reducer = { - pending: null, - lanes: 0, - dispatch: null, - lastRenderedReducer: reducer, - lastRenderedState: initialArg - }; - hook.queue = reducer; - reducer = reducer.dispatch = dispatchReducerAction.bind( - null, - currentlyRenderingFiber$1, - reducer - ); - return [hook.memoizedState, reducer]; - }, - useRef: function (initialValue) { - var hook = mountWorkInProgressHook(); - initialValue = { current: initialValue }; - return (hook.memoizedState = initialValue); - }, - useState: function (initialState) { - initialState = mountStateImpl(initialState); - var queue = initialState.queue, - dispatch = dispatchSetState.bind( - null, - currentlyRenderingFiber$1, - queue - ); - queue.dispatch = dispatch; - return [initialState.memoizedState, dispatch]; - }, - useDebugValue: mountDebugValue, - useDeferredValue: function (value) { - return (mountWorkInProgressHook().memoizedState = value); - }, - useTransition: function () { - var stateHook = mountStateImpl(!1); - stateHook = startTransition.bind( - null, - currentlyRenderingFiber$1, - stateHook.queue, - !0, - !1 - ); - mountWorkInProgressHook().memoizedState = stateHook; - return [!1, stateHook]; - }, - 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$1) || - 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), - { destroy: void 0 }, - null - ); - return nextSnapshot; - }, - useId: function () { - var hook = mountWorkInProgressHook(), - identifierPrefix = workInProgressRoot.identifierPrefix, - globalClientId = globalClientIdCounter++; - identifierPrefix = - ":" + identifierPrefix + "r" + globalClientId.toString(32) + ":"; - return (hook.memoizedState = identifierPrefix); - }, - useCacheRefresh: function () { - return (mountWorkInProgressHook().memoizedState = refreshCache.bind( - null, - currentlyRenderingFiber$1 - )); - } + readContext: readContext, + use: use, + useCallback: function (callback, deps) { + mountWorkInProgressHook().memoizedState = [ + callback, + void 0 === deps ? null : deps + ]; + return callback; }, - HooksDispatcherOnUpdate = { - readContext: readContext, - use: use, - useCallback: updateCallback, - useContext: readContext, - useEffect: updateEffect, - useImperativeHandle: updateImperativeHandle, - useInsertionEffect: updateInsertionEffect, - useLayoutEffect: updateLayoutEffect, - useMemo: updateMemo, - useReducer: updateReducer, - useRef: updateRef, - useState: function () { - return updateReducer(basicStateReducer); + useContext: readContext, + useEffect: mountEffect, + useImperativeHandle: function (ref, create, deps) { + deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; + mountEffectImpl( + 4194308, + 4, + imperativeHandleEffect.bind(null, create, ref), + deps + ); + }, + useLayoutEffect: function (create, deps) { + return mountEffectImpl(4194308, 4, create, deps); + }, + useInsertionEffect: function (create, deps) { + mountEffectImpl(4, 2, create, deps); + }, + useMemo: function (nextCreate, deps) { + var hook = mountWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + shouldDoubleInvokeUserFnsInHooksDEV && nextCreate(); + nextCreate = nextCreate(); + hook.memoizedState = [nextCreate, deps]; + return nextCreate; + }, + useReducer: function (reducer, initialArg, init) { + var hook = mountWorkInProgressHook(); + initialArg = void 0 !== init ? init(initialArg) : initialArg; + hook.memoizedState = hook.baseState = initialArg; + reducer = { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: reducer, + lastRenderedState: initialArg + }; + hook.queue = reducer; + reducer = reducer.dispatch = dispatchReducerAction.bind( + null, + currentlyRenderingFiber$1, + reducer + ); + return [hook.memoizedState, reducer]; + }, + useRef: function (initialValue) { + var hook = mountWorkInProgressHook(); + initialValue = { current: initialValue }; + return (hook.memoizedState = initialValue); + }, + useState: function (initialState) { + initialState = mountStateImpl(initialState); + var queue = initialState.queue, + dispatch = dispatchSetState.bind(null, currentlyRenderingFiber$1, queue); + queue.dispatch = dispatch; + return [initialState.memoizedState, dispatch]; + }, + useDebugValue: mountDebugValue, + useDeferredValue: function (value) { + return (mountWorkInProgressHook().memoizedState = value); + }, + useTransition: function () { + var stateHook = mountStateImpl(!1); + stateHook = startTransition.bind( + null, + currentlyRenderingFiber$1, + stateHook.queue, + !0, + !1 + ); + mountWorkInProgressHook().memoizedState = stateHook; + return [!1, stateHook]; + }, + 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$1) || + 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), + { destroy: void 0 }, + null + ); + return nextSnapshot; + }, + useId: function () { + var hook = mountWorkInProgressHook(), + identifierPrefix = workInProgressRoot.identifierPrefix, + globalClientId = globalClientIdCounter++; + identifierPrefix = + ":" + identifierPrefix + "r" + globalClientId.toString(32) + ":"; + return (hook.memoizedState = identifierPrefix); + }, + useCacheRefresh: function () { + return (mountWorkInProgressHook().memoizedState = refreshCache.bind( + null, + currentlyRenderingFiber$1 + )); + } +}; +HooksDispatcherOnMount.useHostTransitionStatus = useHostTransitionStatus; +HooksDispatcherOnMount.useFormState = function (action, initialStateProp) { + var initialStateThenable = { + status: "fulfilled", + value: initialStateProp, + then: function () {} }, - useDebugValue: mountDebugValue, - useDeferredValue: function (value) { - var hook = updateWorkInProgressHook(); - return updateDeferredValueImpl(hook, currentHook.memoizedState, value); - }, - useTransition: function () { - var booleanOrThenable = updateReducer(basicStateReducer)[0], - start = updateWorkInProgressHook().memoizedState; - return [ - "boolean" === typeof booleanOrThenable - ? booleanOrThenable - : useThenable(booleanOrThenable), - start - ]; - }, - useSyncExternalStore: updateSyncExternalStore, - useId: updateId + stateHook = mountWorkInProgressHook(); + stateHook.memoizedState = stateHook.baseState = initialStateThenable; + initialStateThenable = { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: formStateReducer, + lastRenderedState: initialStateThenable }; + stateHook.queue = initialStateThenable; + stateHook = dispatchSetState.bind( + null, + currentlyRenderingFiber$1, + initialStateThenable + ); + initialStateThenable.dispatch = stateHook; + initialStateThenable = mountWorkInProgressHook(); + var actionQueue = { + state: initialStateProp, + dispatch: null, + action: action, + pending: null + }; + initialStateThenable.queue = actionQueue; + stateHook = dispatchFormState.bind( + null, + currentlyRenderingFiber$1, + actionQueue, + stateHook + ); + actionQueue.dispatch = stateHook; + initialStateThenable.memoizedState = action; + return [initialStateProp, stateHook]; +}; +HooksDispatcherOnMount.useOptimistic = function (passthrough) { + var hook = mountWorkInProgressHook(); + hook.memoizedState = hook.baseState = passthrough; + var queue = { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: null, + lastRenderedState: null + }; + hook.queue = queue; + hook = dispatchOptimisticSetState.bind( + null, + currentlyRenderingFiber$1, + !0, + queue + ); + queue.dispatch = hook; + return [passthrough, hook]; +}; +var HooksDispatcherOnUpdate = { + readContext: readContext, + use: use, + useCallback: updateCallback, + useContext: readContext, + useEffect: updateEffect, + useImperativeHandle: updateImperativeHandle, + useInsertionEffect: updateInsertionEffect, + useLayoutEffect: updateLayoutEffect, + useMemo: updateMemo, + useReducer: updateReducer, + useRef: updateRef, + useState: function () { + return updateReducer(basicStateReducer); + }, + useDebugValue: mountDebugValue, + useDeferredValue: function (value) { + var hook = updateWorkInProgressHook(); + return updateDeferredValueImpl(hook, currentHook.memoizedState, value); + }, + useTransition: function () { + var booleanOrThenable = updateReducer(basicStateReducer)[0], + start = updateWorkInProgressHook().memoizedState; + return [ + "boolean" === typeof booleanOrThenable + ? booleanOrThenable + : useThenable(booleanOrThenable), + start + ]; + }, + useSyncExternalStore: updateSyncExternalStore, + useId: updateId +}; HooksDispatcherOnUpdate.useCacheRefresh = updateRefresh; +HooksDispatcherOnUpdate.useHostTransitionStatus = useHostTransitionStatus; +HooksDispatcherOnUpdate.useFormState = function (action) { + var stateHook = updateWorkInProgressHook(); + return updateFormStateImpl(stateHook, currentHook, action); +}; +HooksDispatcherOnUpdate.useOptimistic = function (passthrough, reducer) { + var hook = updateWorkInProgressHook(); + return updateOptimisticImpl(hook, currentHook, passthrough, reducer); +}; var HooksDispatcherOnRerender = { readContext: readContext, use: use, @@ -3020,6 +3339,25 @@ var HooksDispatcherOnRerender = { useId: updateId }; HooksDispatcherOnRerender.useCacheRefresh = updateRefresh; +HooksDispatcherOnRerender.useHostTransitionStatus = useHostTransitionStatus; +HooksDispatcherOnRerender.useFormState = function (action) { + var stateHook = updateWorkInProgressHook(), + currentStateHook = currentHook; + if (null !== currentStateHook) + return updateFormStateImpl(stateHook, currentStateHook, action); + stateHook = useThenable(stateHook.memoizedState); + currentStateHook = updateWorkInProgressHook(); + var dispatch = currentStateHook.queue.dispatch; + currentStateHook.memoizedState = action; + return [stateHook, dispatch]; +}; +HooksDispatcherOnRerender.useOptimistic = function (passthrough, reducer) { + var hook = updateWorkInProgressHook(); + if (null !== currentHook) + return updateOptimisticImpl(hook, currentHook, passthrough, reducer); + hook.baseState = passthrough; + return [passthrough, hook.queue.dispatch]; +}; var now = Scheduler$1.unstable_now, commitTime = 0, layoutEffectStartTime = -1, @@ -4617,14 +4955,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$60 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$60 = lastTailNode), + for (var lastTailNode$63 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$63 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$60 + null === lastTailNode$63 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$60.sibling = null); + : (lastTailNode$63.sibling = null); } } function bubbleProperties(completedWork) { @@ -4636,53 +4974,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$62 = completedWork.selfBaseDuration, - child$63 = completedWork.child; - null !== child$63; + var treeBaseDuration$65 = completedWork.selfBaseDuration, + child$66 = completedWork.child; + null !== child$66; ) - (newChildLanes |= child$63.lanes | child$63.childLanes), - (subtreeFlags |= child$63.subtreeFlags & 31457280), - (subtreeFlags |= child$63.flags & 31457280), - (treeBaseDuration$62 += child$63.treeBaseDuration), - (child$63 = child$63.sibling); - completedWork.treeBaseDuration = treeBaseDuration$62; + (newChildLanes |= child$66.lanes | child$66.childLanes), + (subtreeFlags |= child$66.subtreeFlags & 31457280), + (subtreeFlags |= child$66.flags & 31457280), + (treeBaseDuration$65 += child$66.treeBaseDuration), + (child$66 = child$66.sibling); + completedWork.treeBaseDuration = treeBaseDuration$65; } else for ( - treeBaseDuration$62 = completedWork.child; - null !== treeBaseDuration$62; + treeBaseDuration$65 = completedWork.child; + null !== treeBaseDuration$65; ) (newChildLanes |= - treeBaseDuration$62.lanes | treeBaseDuration$62.childLanes), - (subtreeFlags |= treeBaseDuration$62.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$62.flags & 31457280), - (treeBaseDuration$62.return = completedWork), - (treeBaseDuration$62 = treeBaseDuration$62.sibling); + treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes), + (subtreeFlags |= treeBaseDuration$65.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$65.flags & 31457280), + (treeBaseDuration$65.return = completedWork), + (treeBaseDuration$65 = treeBaseDuration$65.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$62 = completedWork.actualDuration; - child$63 = completedWork.selfBaseDuration; + treeBaseDuration$65 = completedWork.actualDuration; + child$66 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$62 += child.actualDuration), - (child$63 += child.treeBaseDuration), + (treeBaseDuration$65 += child.actualDuration), + (child$66 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$62; - completedWork.treeBaseDuration = child$63; + completedWork.actualDuration = treeBaseDuration$65; + completedWork.treeBaseDuration = child$66; } else for ( - treeBaseDuration$62 = completedWork.child; - null !== treeBaseDuration$62; + treeBaseDuration$65 = completedWork.child; + null !== treeBaseDuration$65; ) (newChildLanes |= - treeBaseDuration$62.lanes | treeBaseDuration$62.childLanes), - (subtreeFlags |= treeBaseDuration$62.subtreeFlags), - (subtreeFlags |= treeBaseDuration$62.flags), - (treeBaseDuration$62.return = completedWork), - (treeBaseDuration$62 = treeBaseDuration$62.sibling); + treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes), + (subtreeFlags |= treeBaseDuration$65.subtreeFlags), + (subtreeFlags |= treeBaseDuration$65.flags), + (treeBaseDuration$65.return = completedWork), + (treeBaseDuration$65 = treeBaseDuration$65.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -4853,11 +5191,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (index = newProps.alternate.memoizedState.cachePool.pool); - var cache$70 = null; + var cache$73 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$70 = newProps.memoizedState.cachePool.pool); - cache$70 !== index && (newProps.flags |= 2048); + (cache$73 = newProps.memoizedState.cachePool.pool); + cache$73 !== index && (newProps.flags |= 2048); } renderLanes !== current && renderLanes && @@ -4889,8 +5227,8 @@ function completeWork(current, workInProgress, renderLanes) { index = workInProgress.memoizedState; if (null === index) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$70 = index.rendering; - if (null === cache$70) + cache$73 = index.rendering; + if (null === cache$73) if (newProps) cutOffTailIfNeeded(index, !1); else { if ( @@ -4898,11 +5236,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$70 = findFirstSuspended(current); - if (null !== cache$70) { + cache$73 = findFirstSuspended(current); + if (null !== cache$73) { workInProgress.flags |= 128; cutOffTailIfNeeded(index, !1); - current = cache$70.updateQueue; + current = cache$73.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -4927,7 +5265,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$70)), null !== current)) { + if (((current = findFirstSuspended(cache$73)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -4937,7 +5275,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(index, !0), null === index.tail && "hidden" === index.tailMode && - !cache$70.alternate) + !cache$73.alternate) ) return bubbleProperties(workInProgress), null; } else @@ -4949,13 +5287,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(index, !1), (workInProgress.lanes = 8388608)); index.isBackwards - ? ((cache$70.sibling = workInProgress.child), - (workInProgress.child = cache$70)) + ? ((cache$73.sibling = workInProgress.child), + (workInProgress.child = cache$73)) : ((current = index.last), null !== current - ? (current.sibling = cache$70) - : (workInProgress.child = cache$70), - (index.last = cache$70)); + ? (current.sibling = cache$73) + : (workInProgress.child = cache$73), + (index.last = cache$73)); } if (null !== index.tail) return ( @@ -5209,8 +5547,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { recordLayoutEffectDuration(current); } else ref(null); - } catch (error$86) { - captureCommitPhaseError(current, nearestMountedAncestor, error$86); + } catch (error$89) { + captureCommitPhaseError(current, nearestMountedAncestor, error$89); } else ref.current = null; } @@ -5316,10 +5654,10 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$87 = effect.create, + var create$90 = effect.create, inst = effect.inst; - create$87 = create$87(); - inst.destroy = create$87; + create$90 = create$90(); + inst.destroy = create$90; } effect = effect.next; } while (effect !== finishedWork); @@ -5337,8 +5675,8 @@ function commitHookLayoutEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$89) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$89); + } catch (error$92) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$92); } } function commitClassCallbacks(finishedWork) { @@ -5418,11 +5756,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { } else try { finishedRoot.componentDidMount(); - } catch (error$90) { + } catch (error$93) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$90 + error$93 ); } else { @@ -5439,11 +5777,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$91) { + } catch (error$94) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$91 + error$94 ); } recordLayoutEffectDuration(finishedWork); @@ -5454,11 +5792,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$92) { + } catch (error$95) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$92 + error$95 ); } } @@ -5845,22 +6183,22 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { startLayoutEffectTimer(), commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$101) { + } catch (error$104) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$101 + error$104 ); } recordLayoutEffectDuration(finishedWork); } else try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$102) { + } catch (error$105) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$102 + error$105 ); } } @@ -5899,8 +6237,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { finishedWork.updateQueue = null; try { (flags.type = type), (flags.props = existingHiddenCallbacks); - } catch (error$105) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$105); + } catch (error$108) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$108); } } break; @@ -5916,8 +6254,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { existingHiddenCallbacks = finishedWork.memoizedProps; try { flags.text = existingHiddenCallbacks; - } catch (error$106) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$106); + } catch (error$109) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$109); } } break; @@ -6001,11 +6339,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { wasHidden.stateNode.isHidden = existingHiddenCallbacks ? !0 : !1; - } catch (error$95) { + } catch (error$98) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$95 + error$98 ); } } else if ( @@ -6083,12 +6421,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$96 = JSCompiler_inline_result.stateNode.containerInfo, - before$97 = getHostSibling(finishedWork); + var parent$99 = JSCompiler_inline_result.stateNode.containerInfo, + before$100 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$97, - parent$96 + before$100, + parent$99 ); break; default: @@ -6268,8 +6606,8 @@ function commitHookPassiveMountEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$110) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$110); + } catch (error$113) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$113); } } function commitOffscreenPassiveMountEffects(current, finishedWork) { @@ -6774,9 +7112,8 @@ function requestUpdateLane(fiber) { return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; if (null !== ReactCurrentBatchConfig$1.transition) return ( - 0 === currentEventTransitionLane && - (currentEventTransitionLane = claimNextTransitionLane()), - currentEventTransitionLane + (fiber = currentEntangledLane), + 0 !== fiber ? fiber : requestTransitionLane() ); fiber = currentUpdatePriority; return 0 !== fiber ? fiber : 32; @@ -7158,8 +7495,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$115) { - handleThrow(root, thrownValue$115); + } catch (thrownValue$118) { + handleThrow(root, thrownValue$118); } while (1); lanes && root.shellSuspendCounter++; @@ -7267,8 +7604,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$117) { - handleThrow(root, thrownValue$117); + } catch (thrownValue$120) { + handleThrow(root, thrownValue$120); } while (1); resetContextDependencies(); @@ -7449,10 +7786,10 @@ function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var retryQueue$29 = offscreenQueue.retryQueue; - null === retryQueue$29 + var retryQueue$32 = offscreenQueue.retryQueue; + null === retryQueue$32 ? (offscreenQueue.retryQueue = new Set([wakeable])) - : retryQueue$29.add(wakeable); + : retryQueue$32.add(wakeable); } attachPingListener(root, wakeable, thrownValue); } @@ -7740,11 +8077,11 @@ function flushPassiveEffects() { _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id, onPostCommit = _finishedWork$memoize.onPostCommit, - commitTime$88 = commitTime, + commitTime$91 = commitTime, phase = null === finishedWork.alternate ? "mount" : "update"; currentUpdateIsNested && (phase = "nested-update"); "function" === typeof onPostCommit && - onPostCommit(id, phase, passiveEffectDuration, commitTime$88); + onPostCommit(id, phase, passiveEffectDuration, commitTime$91); var parentFiber = finishedWork.return; b: for (; null !== parentFiber; ) { switch (parentFiber.tag) { @@ -8104,6 +8441,24 @@ beginWork = function (current, workInProgress, renderLanes) { return ( pushHostContext(workInProgress), (Component = workInProgress.pendingProps.children), + null !== workInProgress.memoizedState && + ((context = renderWithHooks( + current, + workInProgress, + TransitionAwareHostComponent, + null, + null, + renderLanes + )), + (HostTransitionContext._currentValue2 = context), + didReceiveUpdate && + null !== current && + current.memoizedState.memoizedState !== context && + propagateContextChange( + workInProgress, + HostTransitionContext, + renderLanes + )), markRef$1(current, workInProgress), reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child @@ -9044,19 +9399,19 @@ function wrapFiber(fiber) { fiberToWrapper.set(fiber, wrapper)); return wrapper; } -var devToolsConfig$jscomp$inline_1072 = { +var devToolsConfig$jscomp$inline_1040 = { findFiberByHostInstance: function () { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-88d56b8e8-20231004", + version: "18.3.0-canary-bfefb2284-20231004", rendererPackageName: "react-test-renderer" }; -var internals$jscomp$inline_1270 = { - bundleType: devToolsConfig$jscomp$inline_1072.bundleType, - version: devToolsConfig$jscomp$inline_1072.version, - rendererPackageName: devToolsConfig$jscomp$inline_1072.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1072.rendererConfig, +var internals$jscomp$inline_1232 = { + bundleType: devToolsConfig$jscomp$inline_1040.bundleType, + version: devToolsConfig$jscomp$inline_1040.version, + rendererPackageName: devToolsConfig$jscomp$inline_1040.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1040.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9073,26 +9428,26 @@ var internals$jscomp$inline_1270 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1072.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1040.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-88d56b8e8-20231004" + reconcilerVersion: "18.3.0-canary-bfefb2284-20231004" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1271 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1233 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1271.isDisabled && - hook$jscomp$inline_1271.supportsFiber + !hook$jscomp$inline_1233.isDisabled && + hook$jscomp$inline_1233.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1271.inject( - internals$jscomp$inline_1270 + (rendererID = hook$jscomp$inline_1233.inject( + internals$jscomp$inline_1232 )), - (injectedHook = hook$jscomp$inline_1271); + (injectedHook = hook$jscomp$inline_1233); } catch (err) {} } exports._Scheduler = Scheduler; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js index 54982ddc4a..c54a777bd6 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<3f31df2fa14ee4c981d6843f3d4d7ead>> */ 'use strict'; @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-canary-88d56b8e8-20231004"; +var ReactVersion = "18.3.0-canary-bfefb2284-20231004"; // ATTENTION // When adding new symbols to this file, @@ -3915,7 +3915,6 @@ exports.createFactory = createFactory; exports.createRef = createRef; exports.createServerContext = createServerContext; exports.experimental_useEffectEvent = useEffectEvent; -exports.experimental_useOptimistic = useOptimistic; exports.forwardRef = forwardRef; exports.isValidElement = isValidElement$1; exports.jsx = jsx; @@ -3947,6 +3946,7 @@ exports.useImperativeHandle = useImperativeHandle; exports.useInsertionEffect = useInsertionEffect; exports.useLayoutEffect = useLayoutEffect; exports.useMemo = useMemo; +exports.useOptimistic = useOptimistic; exports.useReducer = useReducer; exports.useRef = useRef; exports.useState = useState; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js index eeadc221c4..c8ba258249 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<22271ab359f8fb6e33230ec4e7180433>> + * @generated SignedSource<<436f4c30f340eebaa6d2b53cebf45483>> */ "use strict"; @@ -497,9 +497,6 @@ exports.createServerContext = function (globalName, defaultValue) { exports.experimental_useEffectEvent = function (callback) { return ReactCurrentDispatcher.current.useEffectEvent(callback); }; -exports.experimental_useOptimistic = function (passthrough, reducer) { - return ReactCurrentDispatcher.current.useOptimistic(passthrough, reducer); -}; exports.forwardRef = function (render) { return { $$typeof: REACT_FORWARD_REF_TYPE, render: render }; }; @@ -593,6 +590,9 @@ exports.useLayoutEffect = function (create, deps) { exports.useMemo = function (create, deps) { return ReactCurrentDispatcher.current.useMemo(create, deps); }; +exports.useOptimistic = function (passthrough, reducer) { + return ReactCurrentDispatcher.current.useOptimistic(passthrough, reducer); +}; exports.useReducer = function (reducer, initialArg, init) { return ReactCurrentDispatcher.current.useReducer(reducer, initialArg, init); }; @@ -616,4 +616,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-canary-88d56b8e8-20231004"; +exports.version = "18.3.0-canary-bfefb2284-20231004"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js index 5db6ab881b..a66c9faf51 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ @@ -501,9 +501,6 @@ exports.createServerContext = function (globalName, defaultValue) { exports.experimental_useEffectEvent = function (callback) { return ReactCurrentDispatcher.current.useEffectEvent(callback); }; -exports.experimental_useOptimistic = function (passthrough, reducer) { - return ReactCurrentDispatcher.current.useOptimistic(passthrough, reducer); -}; exports.forwardRef = function (render) { return { $$typeof: REACT_FORWARD_REF_TYPE, render: render }; }; @@ -596,6 +593,9 @@ exports.useLayoutEffect = function (create, deps) { exports.useMemo = function (create, deps) { return ReactCurrentDispatcher.current.useMemo(create, deps); }; +exports.useOptimistic = function (passthrough, reducer) { + return ReactCurrentDispatcher.current.useOptimistic(passthrough, reducer); +}; exports.useReducer = function (reducer, initialArg, init) { return ReactCurrentDispatcher.current.useReducer(reducer, initialArg, init); }; @@ -619,7 +619,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-canary-88d56b8e8-20231004"; +exports.version = "18.3.0-canary-bfefb2284-20231004"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index f8cf8651e8..dbde51e15f 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -88d56b8e818d0c48eb6642303169c1fadeb99d59 +bfefb228422f7264a29b3a6b98ec95e05925e80e