mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[useFormState] Allow sync actions (#27571)
Updates useFormState to allow a sync function to be passed as an action. A form action is almost always async, because it needs to talk to the server. But since we support client-side actions, too, there's no reason we can't allow sync actions, too. I originally chose not to allow them to keep the implementation simpler but it's not really that much more complicated because we already support this for actions passed to startTransition. So now it's consistent: anywhere an action is accepted, a sync client function is a valid input. DiffTrain build for commit https://github.com/facebook/react/commit/77c4ac2ce88736bbdfe0b29008b5df931c2beb1e.
This commit is contained in:
+55
-41
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<cbd8ea0713685000d0b28083e1b0ef92>>
|
||||
* @generated SignedSource<<ae1a8bf6624e4c6f9e70730750430a22>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -8071,34 +8071,48 @@ function runFormStateAction(actionQueue, setState, payload) {
|
||||
}
|
||||
|
||||
try {
|
||||
var promise = action(prevState, payload);
|
||||
var returnValue = 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.
|
||||
if (
|
||||
returnValue !== null &&
|
||||
typeof returnValue === "object" && // $FlowFixMe[method-unbinding]
|
||||
typeof returnValue.then === "function"
|
||||
) {
|
||||
var thenable = returnValue; // 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.
|
||||
thenable.then(
|
||||
function (nextState) {
|
||||
actionQueue.state = nextState;
|
||||
finishRunningFormStateAction(actionQueue, setState);
|
||||
},
|
||||
function () {
|
||||
return finishRunningFormStateAction(actionQueue, setState);
|
||||
}
|
||||
);
|
||||
var entangledResult = requestAsyncActionContext(thenable, null);
|
||||
setState(entangledResult);
|
||||
} else {
|
||||
// This is either `returnValue` or a thenable that resolves to
|
||||
// `returnValue`, depending on whether we're inside an async action scope.
|
||||
var _entangledResult = requestSyncActionContext(returnValue, null);
|
||||
|
||||
var entangledThenable = requestAsyncActionContext(promise, null);
|
||||
setState(entangledThenable);
|
||||
setState(_entangledResult);
|
||||
var nextState = returnValue;
|
||||
actionQueue.state = nextState;
|
||||
finishRunningFormStateAction(actionQueue, setState);
|
||||
}
|
||||
} catch (error) {
|
||||
// This is a trick to get the `useFormState` 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 // $FlowFixMe: Not sure why this doesn't work
|
||||
};
|
||||
setState(rejectedThenable);
|
||||
finishRunningFormStateAction(actionQueue, setState);
|
||||
} finally {
|
||||
ReactCurrentBatchConfig$2.transition = prevTransition;
|
||||
|
||||
@@ -8147,22 +8161,18 @@ function formStateReducer(oldState, 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;
|
||||
stateHook.memoizedState = stateHook.baseState = initialState; // TODO: Typing this "correctly" results in recursion limit errors
|
||||
// const stateQueue: UpdateQueue<S | Awaited<S>, S | Awaited<S>> = {
|
||||
|
||||
var stateQueue = {
|
||||
pending: null,
|
||||
lanes: NoLanes,
|
||||
dispatch: null,
|
||||
lastRenderedReducer: formStateReducer,
|
||||
lastRenderedState: initialStateThenable
|
||||
lastRenderedState: initialState
|
||||
};
|
||||
stateHook.queue = stateQueue;
|
||||
var setState = dispatchSetState.bind(
|
||||
@@ -8216,9 +8226,14 @@ function updateFormStateImpl(
|
||||
currentStateHook,
|
||||
formStateReducer
|
||||
),
|
||||
thenable = _updateReducerImpl[0]; // This will suspend until the action finishes.
|
||||
actionResult = _updateReducerImpl[0]; // This will suspend until the action finishes.
|
||||
|
||||
var state = useThenable(thenable);
|
||||
var state =
|
||||
typeof actionResult === "object" &&
|
||||
actionResult !== null && // $FlowFixMe[method-unbinding]
|
||||
typeof actionResult.then === "function"
|
||||
? useThenable(actionResult)
|
||||
: actionResult;
|
||||
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.
|
||||
@@ -8258,8 +8273,7 @@ function rerenderFormState(action, initialState, permalink) {
|
||||
return updateFormStateImpl(stateHook, currentStateHook, action);
|
||||
} // This is a mount. No updates to process.
|
||||
|
||||
var thenable = stateHook.memoizedState;
|
||||
var state = useThenable(thenable);
|
||||
var state = stateHook.memoizedState;
|
||||
var actionQueueHook = updateWorkInProgressHook();
|
||||
var actionQueue = actionQueueHook.queue;
|
||||
var dispatch = actionQueue.dispatch; // This may have changed during the rerender.
|
||||
@@ -8686,12 +8700,12 @@ function startTransition(
|
||||
// This is either `finishedState` or a thenable that resolves to
|
||||
// `finishedState`, depending on whether we're inside an async
|
||||
// action scope.
|
||||
var _entangledResult = requestSyncActionContext(
|
||||
var _entangledResult2 = requestSyncActionContext(
|
||||
returnValue,
|
||||
finishedState
|
||||
);
|
||||
|
||||
dispatchSetState(fiber, queue, _entangledResult);
|
||||
dispatchSetState(fiber, queue, _entangledResult2);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -24887,7 +24901,7 @@ function createFiberRoot(
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-canary-08a39539f-20231031";
|
||||
var ReactVersion = "18.3.0-canary-77c4ac2ce-20231031";
|
||||
|
||||
// Might add PROFILE later.
|
||||
|
||||
|
||||
+118
-104
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<3c60c6d80dc890b93e2083f2bdb9724f>>
|
||||
* @generated SignedSource<<e80d420d61717bb81476a341cc714105>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -2703,18 +2703,32 @@ function runFormStateAction(actionQueue, setState, payload) {
|
||||
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);
|
||||
var returnValue = action(prevState, payload);
|
||||
if (
|
||||
null !== returnValue &&
|
||||
"object" === typeof returnValue &&
|
||||
"function" === typeof returnValue.then
|
||||
) {
|
||||
returnValue.then(
|
||||
function (nextState) {
|
||||
actionQueue.state = nextState;
|
||||
finishRunningFormStateAction(actionQueue, setState);
|
||||
},
|
||||
function () {
|
||||
return finishRunningFormStateAction(actionQueue, setState);
|
||||
}
|
||||
);
|
||||
var entangledResult = requestAsyncActionContext(returnValue, null);
|
||||
setState(entangledResult);
|
||||
} else {
|
||||
var entangledResult$29 = requestSyncActionContext(returnValue, null);
|
||||
setState(entangledResult$29);
|
||||
actionQueue.state = returnValue;
|
||||
finishRunningFormStateAction(actionQueue, setState);
|
||||
}
|
||||
} catch (error) {
|
||||
setState({ then: function () {}, status: "rejected", reason: error }),
|
||||
finishRunningFormStateAction(actionQueue, setState);
|
||||
} finally {
|
||||
ReactCurrentBatchConfig$2.transition = prevTransition;
|
||||
}
|
||||
@@ -2739,7 +2753,12 @@ function updateFormStateImpl(stateHook, currentStateHook, action) {
|
||||
currentStateHook,
|
||||
formStateReducer
|
||||
)[0];
|
||||
stateHook = useThenable(stateHook);
|
||||
stateHook =
|
||||
"object" === typeof stateHook &&
|
||||
null !== stateHook &&
|
||||
"function" === typeof stateHook.then
|
||||
? useThenable(stateHook)
|
||||
: stateHook;
|
||||
currentStateHook = updateWorkInProgressHook();
|
||||
var actionQueue = currentStateHook.queue,
|
||||
dispatch = actionQueue.dispatch;
|
||||
@@ -2891,11 +2910,11 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) {
|
||||
);
|
||||
dispatchSetState(fiber, queue, entangledResult);
|
||||
} else {
|
||||
var entangledResult$30 = requestSyncActionContext(
|
||||
var entangledResult$31 = requestSyncActionContext(
|
||||
returnValue,
|
||||
finishedState
|
||||
);
|
||||
dispatchSetState(fiber, queue, entangledResult$30);
|
||||
dispatchSetState(fiber, queue, entangledResult$31);
|
||||
}
|
||||
} catch (error) {
|
||||
dispatchSetState(fiber, queue, {
|
||||
@@ -3186,35 +3205,30 @@ var HooksDispatcherOnMount = {
|
||||
};
|
||||
HooksDispatcherOnMount.useHostTransitionStatus = useHostTransitionStatus;
|
||||
HooksDispatcherOnMount.useFormState = function (action, initialStateProp) {
|
||||
var initialStateThenable = {
|
||||
status: "fulfilled",
|
||||
value: initialStateProp,
|
||||
then: function () {}
|
||||
},
|
||||
stateHook = mountWorkInProgressHook();
|
||||
stateHook.memoizedState = stateHook.baseState = initialStateThenable;
|
||||
initialStateThenable = {
|
||||
var stateHook = mountWorkInProgressHook();
|
||||
stateHook.memoizedState = stateHook.baseState = initialStateProp;
|
||||
var stateQueue = {
|
||||
pending: null,
|
||||
lanes: 0,
|
||||
dispatch: null,
|
||||
lastRenderedReducer: formStateReducer,
|
||||
lastRenderedState: initialStateThenable
|
||||
lastRenderedState: initialStateProp
|
||||
};
|
||||
stateHook.queue = initialStateThenable;
|
||||
stateHook.queue = stateQueue;
|
||||
stateHook = dispatchSetState.bind(
|
||||
null,
|
||||
currentlyRenderingFiber$1,
|
||||
initialStateThenable
|
||||
stateQueue
|
||||
);
|
||||
initialStateThenable.dispatch = stateHook;
|
||||
initialStateThenable = mountWorkInProgressHook();
|
||||
stateQueue.dispatch = stateHook;
|
||||
stateQueue = mountWorkInProgressHook();
|
||||
var actionQueue = {
|
||||
state: initialStateProp,
|
||||
dispatch: null,
|
||||
action: action,
|
||||
pending: null
|
||||
};
|
||||
initialStateThenable.queue = actionQueue;
|
||||
stateQueue.queue = actionQueue;
|
||||
stateHook = dispatchFormState.bind(
|
||||
null,
|
||||
currentlyRenderingFiber$1,
|
||||
@@ -3222,7 +3236,7 @@ HooksDispatcherOnMount.useFormState = function (action, initialStateProp) {
|
||||
stateHook
|
||||
);
|
||||
actionQueue.dispatch = stateHook;
|
||||
initialStateThenable.memoizedState = action;
|
||||
stateQueue.memoizedState = action;
|
||||
return [initialStateProp, stateHook];
|
||||
};
|
||||
HooksDispatcherOnMount.useOptimistic = function (passthrough) {
|
||||
@@ -3330,7 +3344,7 @@ HooksDispatcherOnRerender.useFormState = function (action) {
|
||||
currentStateHook = currentHook;
|
||||
if (null !== currentStateHook)
|
||||
return updateFormStateImpl(stateHook, currentStateHook, action);
|
||||
stateHook = useThenable(stateHook.memoizedState);
|
||||
stateHook = stateHook.memoizedState;
|
||||
currentStateHook = updateWorkInProgressHook();
|
||||
var dispatch = currentStateHook.queue.dispatch;
|
||||
currentStateHook.memoizedState = action;
|
||||
@@ -4851,14 +4865,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
|
||||
break;
|
||||
case "collapsed":
|
||||
lastTailNode = renderState.tail;
|
||||
for (var lastTailNode$62 = null; null !== lastTailNode; )
|
||||
null !== lastTailNode.alternate && (lastTailNode$62 = lastTailNode),
|
||||
for (var lastTailNode$63 = null; null !== lastTailNode; )
|
||||
null !== lastTailNode.alternate && (lastTailNode$63 = lastTailNode),
|
||||
(lastTailNode = lastTailNode.sibling);
|
||||
null === lastTailNode$62
|
||||
null === lastTailNode$63
|
||||
? hasRenderedATailFallback || null === renderState.tail
|
||||
? (renderState.tail = null)
|
||||
: (renderState.tail.sibling = null)
|
||||
: (lastTailNode$62.sibling = null);
|
||||
: (lastTailNode$63.sibling = null);
|
||||
}
|
||||
}
|
||||
function bubbleProperties(completedWork) {
|
||||
@@ -4868,19 +4882,19 @@ function bubbleProperties(completedWork) {
|
||||
newChildLanes = 0,
|
||||
subtreeFlags = 0;
|
||||
if (didBailout)
|
||||
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);
|
||||
for (var child$64 = completedWork.child; null !== child$64; )
|
||||
(newChildLanes |= child$64.lanes | child$64.childLanes),
|
||||
(subtreeFlags |= child$64.subtreeFlags & 31457280),
|
||||
(subtreeFlags |= child$64.flags & 31457280),
|
||||
(child$64.return = completedWork),
|
||||
(child$64 = child$64.sibling);
|
||||
else
|
||||
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);
|
||||
for (child$64 = completedWork.child; null !== child$64; )
|
||||
(newChildLanes |= child$64.lanes | child$64.childLanes),
|
||||
(subtreeFlags |= child$64.subtreeFlags),
|
||||
(subtreeFlags |= child$64.flags),
|
||||
(child$64.return = completedWork),
|
||||
(child$64 = child$64.sibling);
|
||||
completedWork.subtreeFlags |= subtreeFlags;
|
||||
completedWork.childLanes = newChildLanes;
|
||||
return didBailout;
|
||||
@@ -5041,11 +5055,11 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
null !== newProps.alternate.memoizedState &&
|
||||
null !== newProps.alternate.memoizedState.cachePool &&
|
||||
(index = newProps.alternate.memoizedState.cachePool.pool);
|
||||
var cache$67 = null;
|
||||
var cache$68 = null;
|
||||
null !== newProps.memoizedState &&
|
||||
null !== newProps.memoizedState.cachePool &&
|
||||
(cache$67 = newProps.memoizedState.cachePool.pool);
|
||||
cache$67 !== index && (newProps.flags |= 2048);
|
||||
(cache$68 = newProps.memoizedState.cachePool.pool);
|
||||
cache$68 !== index && (newProps.flags |= 2048);
|
||||
}
|
||||
renderLanes !== current &&
|
||||
renderLanes &&
|
||||
@@ -5072,8 +5086,8 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
index = workInProgress.memoizedState;
|
||||
if (null === index) return bubbleProperties(workInProgress), null;
|
||||
newProps = 0 !== (workInProgress.flags & 128);
|
||||
cache$67 = index.rendering;
|
||||
if (null === cache$67)
|
||||
cache$68 = index.rendering;
|
||||
if (null === cache$68)
|
||||
if (newProps) cutOffTailIfNeeded(index, !1);
|
||||
else {
|
||||
if (
|
||||
@@ -5081,11 +5095,11 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
(null !== current && 0 !== (current.flags & 128))
|
||||
)
|
||||
for (current = workInProgress.child; null !== current; ) {
|
||||
cache$67 = findFirstSuspended(current);
|
||||
if (null !== cache$67) {
|
||||
cache$68 = findFirstSuspended(current);
|
||||
if (null !== cache$68) {
|
||||
workInProgress.flags |= 128;
|
||||
cutOffTailIfNeeded(index, !1);
|
||||
current = cache$67.updateQueue;
|
||||
current = cache$68.updateQueue;
|
||||
workInProgress.updateQueue = current;
|
||||
scheduleRetryEffect(workInProgress, current);
|
||||
workInProgress.subtreeFlags = 0;
|
||||
@@ -5110,7 +5124,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
}
|
||||
else {
|
||||
if (!newProps)
|
||||
if (((current = findFirstSuspended(cache$67)), null !== current)) {
|
||||
if (((current = findFirstSuspended(cache$68)), null !== current)) {
|
||||
if (
|
||||
((workInProgress.flags |= 128),
|
||||
(newProps = !0),
|
||||
@@ -5120,7 +5134,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
cutOffTailIfNeeded(index, !0),
|
||||
null === index.tail &&
|
||||
"hidden" === index.tailMode &&
|
||||
!cache$67.alternate)
|
||||
!cache$68.alternate)
|
||||
)
|
||||
return bubbleProperties(workInProgress), null;
|
||||
} else
|
||||
@@ -5132,13 +5146,13 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
cutOffTailIfNeeded(index, !1),
|
||||
(workInProgress.lanes = 4194304));
|
||||
index.isBackwards
|
||||
? ((cache$67.sibling = workInProgress.child),
|
||||
(workInProgress.child = cache$67))
|
||||
? ((cache$68.sibling = workInProgress.child),
|
||||
(workInProgress.child = cache$68))
|
||||
: ((current = index.last),
|
||||
null !== current
|
||||
? (current.sibling = cache$67)
|
||||
: (workInProgress.child = cache$67),
|
||||
(index.last = cache$67));
|
||||
? (current.sibling = cache$68)
|
||||
: (workInProgress.child = cache$68),
|
||||
(index.last = cache$68));
|
||||
}
|
||||
if (null !== index.tail)
|
||||
return (
|
||||
@@ -5351,8 +5365,8 @@ function safelyDetachRef(current, nearestMountedAncestor) {
|
||||
else if ("function" === typeof ref)
|
||||
try {
|
||||
ref(null);
|
||||
} catch (error$83) {
|
||||
captureCommitPhaseError(current, nearestMountedAncestor, error$83);
|
||||
} catch (error$84) {
|
||||
captureCommitPhaseError(current, nearestMountedAncestor, error$84);
|
||||
}
|
||||
else ref.current = null;
|
||||
}
|
||||
@@ -5458,10 +5472,10 @@ function commitHookEffectListMount(flags, finishedWork) {
|
||||
var effect = (finishedWork = finishedWork.next);
|
||||
do {
|
||||
if ((effect.tag & flags) === flags) {
|
||||
var create$84 = effect.create,
|
||||
var create$85 = effect.create,
|
||||
inst = effect.inst;
|
||||
create$84 = create$84();
|
||||
inst.destroy = create$84;
|
||||
create$85 = create$85();
|
||||
inst.destroy = create$85;
|
||||
}
|
||||
effect = effect.next;
|
||||
} while (effect !== finishedWork);
|
||||
@@ -5515,11 +5529,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) {
|
||||
current,
|
||||
finishedRoot.__reactInternalSnapshotBeforeUpdate
|
||||
);
|
||||
} catch (error$85) {
|
||||
} catch (error$86) {
|
||||
captureCommitPhaseError(
|
||||
finishedWork,
|
||||
finishedWork.return,
|
||||
error$85
|
||||
error$86
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5896,8 +5910,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
|
||||
}
|
||||
try {
|
||||
commitHookEffectListUnmount(5, finishedWork, finishedWork.return);
|
||||
} catch (error$93) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$93);
|
||||
} catch (error$94) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$94);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -5935,8 +5949,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
|
||||
finishedWork.updateQueue = null;
|
||||
try {
|
||||
(flags.type = type), (flags.props = existingHiddenCallbacks);
|
||||
} catch (error$96) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$96);
|
||||
} catch (error$97) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$97);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -5952,8 +5966,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
|
||||
existingHiddenCallbacks = finishedWork.memoizedProps;
|
||||
try {
|
||||
flags.text = existingHiddenCallbacks;
|
||||
} catch (error$97) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$97);
|
||||
} catch (error$98) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$98);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -6037,11 +6051,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
|
||||
wasHidden.stateNode.isHidden = existingHiddenCallbacks
|
||||
? !0
|
||||
: !1;
|
||||
} catch (error$87) {
|
||||
} catch (error$88) {
|
||||
captureCommitPhaseError(
|
||||
finishedWork,
|
||||
finishedWork.return,
|
||||
error$87
|
||||
error$88
|
||||
);
|
||||
}
|
||||
} else if (
|
||||
@@ -6119,12 +6133,12 @@ function commitReconciliationEffects(finishedWork) {
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
var parent$88 = JSCompiler_inline_result.stateNode.containerInfo,
|
||||
before$89 = getHostSibling(finishedWork);
|
||||
var parent$89 = JSCompiler_inline_result.stateNode.containerInfo,
|
||||
before$90 = getHostSibling(finishedWork);
|
||||
insertOrAppendPlacementNodeIntoContainer(
|
||||
finishedWork,
|
||||
before$89,
|
||||
parent$88
|
||||
before$90,
|
||||
parent$89
|
||||
);
|
||||
break;
|
||||
default:
|
||||
@@ -7198,8 +7212,8 @@ function renderRootSync(root, lanes) {
|
||||
}
|
||||
workLoopSync();
|
||||
break;
|
||||
} catch (thrownValue$105) {
|
||||
handleThrow(root, thrownValue$105);
|
||||
} catch (thrownValue$106) {
|
||||
handleThrow(root, thrownValue$106);
|
||||
}
|
||||
while (1);
|
||||
lanes && root.shellSuspendCounter++;
|
||||
@@ -7307,8 +7321,8 @@ function renderRootConcurrent(root, lanes) {
|
||||
}
|
||||
workLoopConcurrent();
|
||||
break;
|
||||
} catch (thrownValue$107) {
|
||||
handleThrow(root, thrownValue$107);
|
||||
} catch (thrownValue$108) {
|
||||
handleThrow(root, thrownValue$108);
|
||||
}
|
||||
while (1);
|
||||
resetContextDependencies();
|
||||
@@ -7479,10 +7493,10 @@ function throwAndUnwindWorkLoop(unitOfWork, thrownValue) {
|
||||
};
|
||||
suspenseBoundary.updateQueue = newOffscreenQueue;
|
||||
} else {
|
||||
var retryQueue$32 = offscreenQueue.retryQueue;
|
||||
null === retryQueue$32
|
||||
var retryQueue$33 = offscreenQueue.retryQueue;
|
||||
null === retryQueue$33
|
||||
? (offscreenQueue.retryQueue = new Set([wakeable]))
|
||||
: retryQueue$32.add(wakeable);
|
||||
: retryQueue$33.add(wakeable);
|
||||
}
|
||||
attachPingListener(root, wakeable, thrownValue);
|
||||
}
|
||||
@@ -9020,19 +9034,19 @@ function wrapFiber(fiber) {
|
||||
fiberToWrapper.set(fiber, wrapper));
|
||||
return wrapper;
|
||||
}
|
||||
var devToolsConfig$jscomp$inline_1032 = {
|
||||
var devToolsConfig$jscomp$inline_1033 = {
|
||||
findFiberByHostInstance: function () {
|
||||
throw Error("TestRenderer does not support findFiberByHostInstance()");
|
||||
},
|
||||
bundleType: 0,
|
||||
version: "18.3.0-canary-08a39539f-20231031",
|
||||
version: "18.3.0-canary-77c4ac2ce-20231031",
|
||||
rendererPackageName: "react-test-renderer"
|
||||
};
|
||||
var internals$jscomp$inline_1225 = {
|
||||
bundleType: devToolsConfig$jscomp$inline_1032.bundleType,
|
||||
version: devToolsConfig$jscomp$inline_1032.version,
|
||||
rendererPackageName: devToolsConfig$jscomp$inline_1032.rendererPackageName,
|
||||
rendererConfig: devToolsConfig$jscomp$inline_1032.rendererConfig,
|
||||
var internals$jscomp$inline_1226 = {
|
||||
bundleType: devToolsConfig$jscomp$inline_1033.bundleType,
|
||||
version: devToolsConfig$jscomp$inline_1033.version,
|
||||
rendererPackageName: devToolsConfig$jscomp$inline_1033.rendererPackageName,
|
||||
rendererConfig: devToolsConfig$jscomp$inline_1033.rendererConfig,
|
||||
overrideHookState: null,
|
||||
overrideHookStateDeletePath: null,
|
||||
overrideHookStateRenamePath: null,
|
||||
@@ -9049,26 +9063,26 @@ var internals$jscomp$inline_1225 = {
|
||||
return null === fiber ? null : fiber.stateNode;
|
||||
},
|
||||
findFiberByHostInstance:
|
||||
devToolsConfig$jscomp$inline_1032.findFiberByHostInstance ||
|
||||
devToolsConfig$jscomp$inline_1033.findFiberByHostInstance ||
|
||||
emptyFindFiberByHostInstance,
|
||||
findHostInstancesForRefresh: null,
|
||||
scheduleRefresh: null,
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-canary-08a39539f-20231031"
|
||||
reconcilerVersion: "18.3.0-canary-77c4ac2ce-20231031"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1226 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
var hook$jscomp$inline_1227 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
if (
|
||||
!hook$jscomp$inline_1226.isDisabled &&
|
||||
hook$jscomp$inline_1226.supportsFiber
|
||||
!hook$jscomp$inline_1227.isDisabled &&
|
||||
hook$jscomp$inline_1227.supportsFiber
|
||||
)
|
||||
try {
|
||||
(rendererID = hook$jscomp$inline_1226.inject(
|
||||
internals$jscomp$inline_1225
|
||||
(rendererID = hook$jscomp$inline_1227.inject(
|
||||
internals$jscomp$inline_1226
|
||||
)),
|
||||
(injectedHook = hook$jscomp$inline_1226);
|
||||
(injectedHook = hook$jscomp$inline_1227);
|
||||
} catch (err) {}
|
||||
}
|
||||
exports._Scheduler = Scheduler;
|
||||
|
||||
+147
-133
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<a02b9b5dea9f5b94464f6051b23b425e>>
|
||||
* @generated SignedSource<<3b2931c4a6be5fc40dc35fdcdc7bee4d>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -2723,18 +2723,32 @@ function runFormStateAction(actionQueue, setState, payload) {
|
||||
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);
|
||||
var returnValue = action(prevState, payload);
|
||||
if (
|
||||
null !== returnValue &&
|
||||
"object" === typeof returnValue &&
|
||||
"function" === typeof returnValue.then
|
||||
) {
|
||||
returnValue.then(
|
||||
function (nextState) {
|
||||
actionQueue.state = nextState;
|
||||
finishRunningFormStateAction(actionQueue, setState);
|
||||
},
|
||||
function () {
|
||||
return finishRunningFormStateAction(actionQueue, setState);
|
||||
}
|
||||
);
|
||||
var entangledResult = requestAsyncActionContext(returnValue, null);
|
||||
setState(entangledResult);
|
||||
} else {
|
||||
var entangledResult$29 = requestSyncActionContext(returnValue, null);
|
||||
setState(entangledResult$29);
|
||||
actionQueue.state = returnValue;
|
||||
finishRunningFormStateAction(actionQueue, setState);
|
||||
}
|
||||
} catch (error) {
|
||||
setState({ then: function () {}, status: "rejected", reason: error }),
|
||||
finishRunningFormStateAction(actionQueue, setState);
|
||||
} finally {
|
||||
ReactCurrentBatchConfig$2.transition = prevTransition;
|
||||
}
|
||||
@@ -2759,7 +2773,12 @@ function updateFormStateImpl(stateHook, currentStateHook, action) {
|
||||
currentStateHook,
|
||||
formStateReducer
|
||||
)[0];
|
||||
stateHook = useThenable(stateHook);
|
||||
stateHook =
|
||||
"object" === typeof stateHook &&
|
||||
null !== stateHook &&
|
||||
"function" === typeof stateHook.then
|
||||
? useThenable(stateHook)
|
||||
: stateHook;
|
||||
currentStateHook = updateWorkInProgressHook();
|
||||
var actionQueue = currentStateHook.queue,
|
||||
dispatch = actionQueue.dispatch;
|
||||
@@ -2911,11 +2930,11 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) {
|
||||
);
|
||||
dispatchSetState(fiber, queue, entangledResult);
|
||||
} else {
|
||||
var entangledResult$30 = requestSyncActionContext(
|
||||
var entangledResult$31 = requestSyncActionContext(
|
||||
returnValue,
|
||||
finishedState
|
||||
);
|
||||
dispatchSetState(fiber, queue, entangledResult$30);
|
||||
dispatchSetState(fiber, queue, entangledResult$31);
|
||||
}
|
||||
} catch (error) {
|
||||
dispatchSetState(fiber, queue, {
|
||||
@@ -3206,35 +3225,30 @@ var HooksDispatcherOnMount = {
|
||||
};
|
||||
HooksDispatcherOnMount.useHostTransitionStatus = useHostTransitionStatus;
|
||||
HooksDispatcherOnMount.useFormState = function (action, initialStateProp) {
|
||||
var initialStateThenable = {
|
||||
status: "fulfilled",
|
||||
value: initialStateProp,
|
||||
then: function () {}
|
||||
},
|
||||
stateHook = mountWorkInProgressHook();
|
||||
stateHook.memoizedState = stateHook.baseState = initialStateThenable;
|
||||
initialStateThenable = {
|
||||
var stateHook = mountWorkInProgressHook();
|
||||
stateHook.memoizedState = stateHook.baseState = initialStateProp;
|
||||
var stateQueue = {
|
||||
pending: null,
|
||||
lanes: 0,
|
||||
dispatch: null,
|
||||
lastRenderedReducer: formStateReducer,
|
||||
lastRenderedState: initialStateThenable
|
||||
lastRenderedState: initialStateProp
|
||||
};
|
||||
stateHook.queue = initialStateThenable;
|
||||
stateHook.queue = stateQueue;
|
||||
stateHook = dispatchSetState.bind(
|
||||
null,
|
||||
currentlyRenderingFiber$1,
|
||||
initialStateThenable
|
||||
stateQueue
|
||||
);
|
||||
initialStateThenable.dispatch = stateHook;
|
||||
initialStateThenable = mountWorkInProgressHook();
|
||||
stateQueue.dispatch = stateHook;
|
||||
stateQueue = mountWorkInProgressHook();
|
||||
var actionQueue = {
|
||||
state: initialStateProp,
|
||||
dispatch: null,
|
||||
action: action,
|
||||
pending: null
|
||||
};
|
||||
initialStateThenable.queue = actionQueue;
|
||||
stateQueue.queue = actionQueue;
|
||||
stateHook = dispatchFormState.bind(
|
||||
null,
|
||||
currentlyRenderingFiber$1,
|
||||
@@ -3242,7 +3256,7 @@ HooksDispatcherOnMount.useFormState = function (action, initialStateProp) {
|
||||
stateHook
|
||||
);
|
||||
actionQueue.dispatch = stateHook;
|
||||
initialStateThenable.memoizedState = action;
|
||||
stateQueue.memoizedState = action;
|
||||
return [initialStateProp, stateHook];
|
||||
};
|
||||
HooksDispatcherOnMount.useOptimistic = function (passthrough) {
|
||||
@@ -3350,7 +3364,7 @@ HooksDispatcherOnRerender.useFormState = function (action) {
|
||||
currentStateHook = currentHook;
|
||||
if (null !== currentStateHook)
|
||||
return updateFormStateImpl(stateHook, currentStateHook, action);
|
||||
stateHook = useThenable(stateHook.memoizedState);
|
||||
stateHook = stateHook.memoizedState;
|
||||
currentStateHook = updateWorkInProgressHook();
|
||||
var dispatch = currentStateHook.queue.dispatch;
|
||||
currentStateHook.memoizedState = action;
|
||||
@@ -4955,14 +4969,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
|
||||
break;
|
||||
case "collapsed":
|
||||
lastTailNode = renderState.tail;
|
||||
for (var lastTailNode$63 = null; null !== lastTailNode; )
|
||||
null !== lastTailNode.alternate && (lastTailNode$63 = lastTailNode),
|
||||
for (var lastTailNode$64 = null; null !== lastTailNode; )
|
||||
null !== lastTailNode.alternate && (lastTailNode$64 = lastTailNode),
|
||||
(lastTailNode = lastTailNode.sibling);
|
||||
null === lastTailNode$63
|
||||
null === lastTailNode$64
|
||||
? hasRenderedATailFallback || null === renderState.tail
|
||||
? (renderState.tail = null)
|
||||
: (renderState.tail.sibling = null)
|
||||
: (lastTailNode$63.sibling = null);
|
||||
: (lastTailNode$64.sibling = null);
|
||||
}
|
||||
}
|
||||
function bubbleProperties(completedWork) {
|
||||
@@ -4974,53 +4988,53 @@ function bubbleProperties(completedWork) {
|
||||
if (didBailout)
|
||||
if (0 !== (completedWork.mode & 2)) {
|
||||
for (
|
||||
var treeBaseDuration$65 = completedWork.selfBaseDuration,
|
||||
child$66 = completedWork.child;
|
||||
null !== child$66;
|
||||
var treeBaseDuration$66 = completedWork.selfBaseDuration,
|
||||
child$67 = completedWork.child;
|
||||
null !== child$67;
|
||||
|
||||
)
|
||||
(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;
|
||||
(newChildLanes |= child$67.lanes | child$67.childLanes),
|
||||
(subtreeFlags |= child$67.subtreeFlags & 31457280),
|
||||
(subtreeFlags |= child$67.flags & 31457280),
|
||||
(treeBaseDuration$66 += child$67.treeBaseDuration),
|
||||
(child$67 = child$67.sibling);
|
||||
completedWork.treeBaseDuration = treeBaseDuration$66;
|
||||
} else
|
||||
for (
|
||||
treeBaseDuration$65 = completedWork.child;
|
||||
null !== treeBaseDuration$65;
|
||||
treeBaseDuration$66 = completedWork.child;
|
||||
null !== treeBaseDuration$66;
|
||||
|
||||
)
|
||||
(newChildLanes |=
|
||||
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);
|
||||
treeBaseDuration$66.lanes | treeBaseDuration$66.childLanes),
|
||||
(subtreeFlags |= treeBaseDuration$66.subtreeFlags & 31457280),
|
||||
(subtreeFlags |= treeBaseDuration$66.flags & 31457280),
|
||||
(treeBaseDuration$66.return = completedWork),
|
||||
(treeBaseDuration$66 = treeBaseDuration$66.sibling);
|
||||
else if (0 !== (completedWork.mode & 2)) {
|
||||
treeBaseDuration$65 = completedWork.actualDuration;
|
||||
child$66 = completedWork.selfBaseDuration;
|
||||
treeBaseDuration$66 = completedWork.actualDuration;
|
||||
child$67 = completedWork.selfBaseDuration;
|
||||
for (var child = completedWork.child; null !== child; )
|
||||
(newChildLanes |= child.lanes | child.childLanes),
|
||||
(subtreeFlags |= child.subtreeFlags),
|
||||
(subtreeFlags |= child.flags),
|
||||
(treeBaseDuration$65 += child.actualDuration),
|
||||
(child$66 += child.treeBaseDuration),
|
||||
(treeBaseDuration$66 += child.actualDuration),
|
||||
(child$67 += child.treeBaseDuration),
|
||||
(child = child.sibling);
|
||||
completedWork.actualDuration = treeBaseDuration$65;
|
||||
completedWork.treeBaseDuration = child$66;
|
||||
completedWork.actualDuration = treeBaseDuration$66;
|
||||
completedWork.treeBaseDuration = child$67;
|
||||
} else
|
||||
for (
|
||||
treeBaseDuration$65 = completedWork.child;
|
||||
null !== treeBaseDuration$65;
|
||||
treeBaseDuration$66 = completedWork.child;
|
||||
null !== treeBaseDuration$66;
|
||||
|
||||
)
|
||||
(newChildLanes |=
|
||||
treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes),
|
||||
(subtreeFlags |= treeBaseDuration$65.subtreeFlags),
|
||||
(subtreeFlags |= treeBaseDuration$65.flags),
|
||||
(treeBaseDuration$65.return = completedWork),
|
||||
(treeBaseDuration$65 = treeBaseDuration$65.sibling);
|
||||
treeBaseDuration$66.lanes | treeBaseDuration$66.childLanes),
|
||||
(subtreeFlags |= treeBaseDuration$66.subtreeFlags),
|
||||
(subtreeFlags |= treeBaseDuration$66.flags),
|
||||
(treeBaseDuration$66.return = completedWork),
|
||||
(treeBaseDuration$66 = treeBaseDuration$66.sibling);
|
||||
completedWork.subtreeFlags |= subtreeFlags;
|
||||
completedWork.childLanes = newChildLanes;
|
||||
return didBailout;
|
||||
@@ -5191,11 +5205,11 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
null !== newProps.alternate.memoizedState &&
|
||||
null !== newProps.alternate.memoizedState.cachePool &&
|
||||
(index = newProps.alternate.memoizedState.cachePool.pool);
|
||||
var cache$73 = null;
|
||||
var cache$74 = null;
|
||||
null !== newProps.memoizedState &&
|
||||
null !== newProps.memoizedState.cachePool &&
|
||||
(cache$73 = newProps.memoizedState.cachePool.pool);
|
||||
cache$73 !== index && (newProps.flags |= 2048);
|
||||
(cache$74 = newProps.memoizedState.cachePool.pool);
|
||||
cache$74 !== index && (newProps.flags |= 2048);
|
||||
}
|
||||
renderLanes !== current &&
|
||||
renderLanes &&
|
||||
@@ -5227,8 +5241,8 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
index = workInProgress.memoizedState;
|
||||
if (null === index) return bubbleProperties(workInProgress), null;
|
||||
newProps = 0 !== (workInProgress.flags & 128);
|
||||
cache$73 = index.rendering;
|
||||
if (null === cache$73)
|
||||
cache$74 = index.rendering;
|
||||
if (null === cache$74)
|
||||
if (newProps) cutOffTailIfNeeded(index, !1);
|
||||
else {
|
||||
if (
|
||||
@@ -5236,11 +5250,11 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
(null !== current && 0 !== (current.flags & 128))
|
||||
)
|
||||
for (current = workInProgress.child; null !== current; ) {
|
||||
cache$73 = findFirstSuspended(current);
|
||||
if (null !== cache$73) {
|
||||
cache$74 = findFirstSuspended(current);
|
||||
if (null !== cache$74) {
|
||||
workInProgress.flags |= 128;
|
||||
cutOffTailIfNeeded(index, !1);
|
||||
current = cache$73.updateQueue;
|
||||
current = cache$74.updateQueue;
|
||||
workInProgress.updateQueue = current;
|
||||
scheduleRetryEffect(workInProgress, current);
|
||||
workInProgress.subtreeFlags = 0;
|
||||
@@ -5265,7 +5279,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
}
|
||||
else {
|
||||
if (!newProps)
|
||||
if (((current = findFirstSuspended(cache$73)), null !== current)) {
|
||||
if (((current = findFirstSuspended(cache$74)), null !== current)) {
|
||||
if (
|
||||
((workInProgress.flags |= 128),
|
||||
(newProps = !0),
|
||||
@@ -5275,7 +5289,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
cutOffTailIfNeeded(index, !0),
|
||||
null === index.tail &&
|
||||
"hidden" === index.tailMode &&
|
||||
!cache$73.alternate)
|
||||
!cache$74.alternate)
|
||||
)
|
||||
return bubbleProperties(workInProgress), null;
|
||||
} else
|
||||
@@ -5287,13 +5301,13 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
cutOffTailIfNeeded(index, !1),
|
||||
(workInProgress.lanes = 4194304));
|
||||
index.isBackwards
|
||||
? ((cache$73.sibling = workInProgress.child),
|
||||
(workInProgress.child = cache$73))
|
||||
? ((cache$74.sibling = workInProgress.child),
|
||||
(workInProgress.child = cache$74))
|
||||
: ((current = index.last),
|
||||
null !== current
|
||||
? (current.sibling = cache$73)
|
||||
: (workInProgress.child = cache$73),
|
||||
(index.last = cache$73));
|
||||
? (current.sibling = cache$74)
|
||||
: (workInProgress.child = cache$74),
|
||||
(index.last = cache$74));
|
||||
}
|
||||
if (null !== index.tail)
|
||||
return (
|
||||
@@ -5547,8 +5561,8 @@ function safelyDetachRef(current, nearestMountedAncestor) {
|
||||
recordLayoutEffectDuration(current);
|
||||
}
|
||||
else ref(null);
|
||||
} catch (error$89) {
|
||||
captureCommitPhaseError(current, nearestMountedAncestor, error$89);
|
||||
} catch (error$90) {
|
||||
captureCommitPhaseError(current, nearestMountedAncestor, error$90);
|
||||
}
|
||||
else ref.current = null;
|
||||
}
|
||||
@@ -5654,10 +5668,10 @@ function commitHookEffectListMount(flags, finishedWork) {
|
||||
var effect = (finishedWork = finishedWork.next);
|
||||
do {
|
||||
if ((effect.tag & flags) === flags) {
|
||||
var create$90 = effect.create,
|
||||
var create$91 = effect.create,
|
||||
inst = effect.inst;
|
||||
create$90 = create$90();
|
||||
inst.destroy = create$90;
|
||||
create$91 = create$91();
|
||||
inst.destroy = create$91;
|
||||
}
|
||||
effect = effect.next;
|
||||
} while (effect !== finishedWork);
|
||||
@@ -5675,8 +5689,8 @@ function commitHookLayoutEffects(finishedWork, hookFlags) {
|
||||
} else
|
||||
try {
|
||||
commitHookEffectListMount(hookFlags, finishedWork);
|
||||
} catch (error$92) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$92);
|
||||
} catch (error$93) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$93);
|
||||
}
|
||||
}
|
||||
function commitClassCallbacks(finishedWork) {
|
||||
@@ -5756,11 +5770,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) {
|
||||
} else
|
||||
try {
|
||||
finishedRoot.componentDidMount();
|
||||
} catch (error$93) {
|
||||
} catch (error$94) {
|
||||
captureCommitPhaseError(
|
||||
finishedWork,
|
||||
finishedWork.return,
|
||||
error$93
|
||||
error$94
|
||||
);
|
||||
}
|
||||
else {
|
||||
@@ -5777,11 +5791,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) {
|
||||
current,
|
||||
finishedRoot.__reactInternalSnapshotBeforeUpdate
|
||||
);
|
||||
} catch (error$94) {
|
||||
} catch (error$95) {
|
||||
captureCommitPhaseError(
|
||||
finishedWork,
|
||||
finishedWork.return,
|
||||
error$94
|
||||
error$95
|
||||
);
|
||||
}
|
||||
recordLayoutEffectDuration(finishedWork);
|
||||
@@ -5792,11 +5806,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) {
|
||||
current,
|
||||
finishedRoot.__reactInternalSnapshotBeforeUpdate
|
||||
);
|
||||
} catch (error$95) {
|
||||
} catch (error$96) {
|
||||
captureCommitPhaseError(
|
||||
finishedWork,
|
||||
finishedWork.return,
|
||||
error$95
|
||||
error$96
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6183,22 +6197,22 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
|
||||
try {
|
||||
startLayoutEffectTimer(),
|
||||
commitHookEffectListUnmount(5, finishedWork, finishedWork.return);
|
||||
} catch (error$104) {
|
||||
} catch (error$105) {
|
||||
captureCommitPhaseError(
|
||||
finishedWork,
|
||||
finishedWork.return,
|
||||
error$104
|
||||
error$105
|
||||
);
|
||||
}
|
||||
recordLayoutEffectDuration(finishedWork);
|
||||
} else
|
||||
try {
|
||||
commitHookEffectListUnmount(5, finishedWork, finishedWork.return);
|
||||
} catch (error$105) {
|
||||
} catch (error$106) {
|
||||
captureCommitPhaseError(
|
||||
finishedWork,
|
||||
finishedWork.return,
|
||||
error$105
|
||||
error$106
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6237,8 +6251,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
|
||||
finishedWork.updateQueue = null;
|
||||
try {
|
||||
(flags.type = type), (flags.props = existingHiddenCallbacks);
|
||||
} catch (error$108) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$108);
|
||||
} catch (error$109) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$109);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -6254,8 +6268,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
|
||||
existingHiddenCallbacks = finishedWork.memoizedProps;
|
||||
try {
|
||||
flags.text = existingHiddenCallbacks;
|
||||
} catch (error$109) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$109);
|
||||
} catch (error$110) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$110);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -6339,11 +6353,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
|
||||
wasHidden.stateNode.isHidden = existingHiddenCallbacks
|
||||
? !0
|
||||
: !1;
|
||||
} catch (error$98) {
|
||||
} catch (error$99) {
|
||||
captureCommitPhaseError(
|
||||
finishedWork,
|
||||
finishedWork.return,
|
||||
error$98
|
||||
error$99
|
||||
);
|
||||
}
|
||||
} else if (
|
||||
@@ -6421,12 +6435,12 @@ function commitReconciliationEffects(finishedWork) {
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
var parent$99 = JSCompiler_inline_result.stateNode.containerInfo,
|
||||
before$100 = getHostSibling(finishedWork);
|
||||
var parent$100 = JSCompiler_inline_result.stateNode.containerInfo,
|
||||
before$101 = getHostSibling(finishedWork);
|
||||
insertOrAppendPlacementNodeIntoContainer(
|
||||
finishedWork,
|
||||
before$100,
|
||||
parent$99
|
||||
before$101,
|
||||
parent$100
|
||||
);
|
||||
break;
|
||||
default:
|
||||
@@ -6606,8 +6620,8 @@ function commitHookPassiveMountEffects(finishedWork, hookFlags) {
|
||||
} else
|
||||
try {
|
||||
commitHookEffectListMount(hookFlags, finishedWork);
|
||||
} catch (error$113) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$113);
|
||||
} catch (error$114) {
|
||||
captureCommitPhaseError(finishedWork, finishedWork.return, error$114);
|
||||
}
|
||||
}
|
||||
function commitOffscreenPassiveMountEffects(current, finishedWork) {
|
||||
@@ -7540,8 +7554,8 @@ function renderRootSync(root, lanes) {
|
||||
}
|
||||
workLoopSync();
|
||||
break;
|
||||
} catch (thrownValue$118) {
|
||||
handleThrow(root, thrownValue$118);
|
||||
} catch (thrownValue$119) {
|
||||
handleThrow(root, thrownValue$119);
|
||||
}
|
||||
while (1);
|
||||
lanes && root.shellSuspendCounter++;
|
||||
@@ -7649,8 +7663,8 @@ function renderRootConcurrent(root, lanes) {
|
||||
}
|
||||
workLoopConcurrent();
|
||||
break;
|
||||
} catch (thrownValue$120) {
|
||||
handleThrow(root, thrownValue$120);
|
||||
} catch (thrownValue$121) {
|
||||
handleThrow(root, thrownValue$121);
|
||||
}
|
||||
while (1);
|
||||
resetContextDependencies();
|
||||
@@ -7831,10 +7845,10 @@ function throwAndUnwindWorkLoop(unitOfWork, thrownValue) {
|
||||
};
|
||||
suspenseBoundary.updateQueue = newOffscreenQueue;
|
||||
} else {
|
||||
var retryQueue$32 = offscreenQueue.retryQueue;
|
||||
null === retryQueue$32
|
||||
var retryQueue$33 = offscreenQueue.retryQueue;
|
||||
null === retryQueue$33
|
||||
? (offscreenQueue.retryQueue = new Set([wakeable]))
|
||||
: retryQueue$32.add(wakeable);
|
||||
: retryQueue$33.add(wakeable);
|
||||
}
|
||||
attachPingListener(root, wakeable, thrownValue);
|
||||
}
|
||||
@@ -8124,11 +8138,11 @@ function flushPassiveEffects() {
|
||||
_finishedWork$memoize = finishedWork.memoizedProps,
|
||||
id = _finishedWork$memoize.id,
|
||||
onPostCommit = _finishedWork$memoize.onPostCommit,
|
||||
commitTime$91 = commitTime,
|
||||
commitTime$92 = commitTime,
|
||||
phase = null === finishedWork.alternate ? "mount" : "update";
|
||||
currentUpdateIsNested && (phase = "nested-update");
|
||||
"function" === typeof onPostCommit &&
|
||||
onPostCommit(id, phase, passiveEffectDuration, commitTime$91);
|
||||
onPostCommit(id, phase, passiveEffectDuration, commitTime$92);
|
||||
var parentFiber = finishedWork.return;
|
||||
b: for (; null !== parentFiber; ) {
|
||||
switch (parentFiber.tag) {
|
||||
@@ -9446,19 +9460,19 @@ function wrapFiber(fiber) {
|
||||
fiberToWrapper.set(fiber, wrapper));
|
||||
return wrapper;
|
||||
}
|
||||
var devToolsConfig$jscomp$inline_1074 = {
|
||||
var devToolsConfig$jscomp$inline_1075 = {
|
||||
findFiberByHostInstance: function () {
|
||||
throw Error("TestRenderer does not support findFiberByHostInstance()");
|
||||
},
|
||||
bundleType: 0,
|
||||
version: "18.3.0-canary-08a39539f-20231031",
|
||||
version: "18.3.0-canary-77c4ac2ce-20231031",
|
||||
rendererPackageName: "react-test-renderer"
|
||||
};
|
||||
var internals$jscomp$inline_1266 = {
|
||||
bundleType: devToolsConfig$jscomp$inline_1074.bundleType,
|
||||
version: devToolsConfig$jscomp$inline_1074.version,
|
||||
rendererPackageName: devToolsConfig$jscomp$inline_1074.rendererPackageName,
|
||||
rendererConfig: devToolsConfig$jscomp$inline_1074.rendererConfig,
|
||||
var internals$jscomp$inline_1267 = {
|
||||
bundleType: devToolsConfig$jscomp$inline_1075.bundleType,
|
||||
version: devToolsConfig$jscomp$inline_1075.version,
|
||||
rendererPackageName: devToolsConfig$jscomp$inline_1075.rendererPackageName,
|
||||
rendererConfig: devToolsConfig$jscomp$inline_1075.rendererConfig,
|
||||
overrideHookState: null,
|
||||
overrideHookStateDeletePath: null,
|
||||
overrideHookStateRenamePath: null,
|
||||
@@ -9475,26 +9489,26 @@ var internals$jscomp$inline_1266 = {
|
||||
return null === fiber ? null : fiber.stateNode;
|
||||
},
|
||||
findFiberByHostInstance:
|
||||
devToolsConfig$jscomp$inline_1074.findFiberByHostInstance ||
|
||||
devToolsConfig$jscomp$inline_1075.findFiberByHostInstance ||
|
||||
emptyFindFiberByHostInstance,
|
||||
findHostInstancesForRefresh: null,
|
||||
scheduleRefresh: null,
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-canary-08a39539f-20231031"
|
||||
reconcilerVersion: "18.3.0-canary-77c4ac2ce-20231031"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1267 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
var hook$jscomp$inline_1268 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
if (
|
||||
!hook$jscomp$inline_1267.isDisabled &&
|
||||
hook$jscomp$inline_1267.supportsFiber
|
||||
!hook$jscomp$inline_1268.isDisabled &&
|
||||
hook$jscomp$inline_1268.supportsFiber
|
||||
)
|
||||
try {
|
||||
(rendererID = hook$jscomp$inline_1267.inject(
|
||||
internals$jscomp$inline_1266
|
||||
(rendererID = hook$jscomp$inline_1268.inject(
|
||||
internals$jscomp$inline_1267
|
||||
)),
|
||||
(injectedHook = hook$jscomp$inline_1267);
|
||||
(injectedHook = hook$jscomp$inline_1268);
|
||||
} catch (err) {}
|
||||
}
|
||||
exports._Scheduler = Scheduler;
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ if (
|
||||
}
|
||||
"use strict";
|
||||
|
||||
var ReactVersion = "18.3.0-canary-08a39539f-20231031";
|
||||
var ReactVersion = "18.3.0-canary-77c4ac2ce-20231031";
|
||||
|
||||
// ATTENTION
|
||||
// When adding new symbols to this file,
|
||||
|
||||
+1
-1
@@ -580,4 +580,4 @@ exports.useSyncExternalStore = function (
|
||||
exports.useTransition = function () {
|
||||
return ReactCurrentDispatcher.current.useTransition();
|
||||
};
|
||||
exports.version = "18.3.0-canary-08a39539f-20231031";
|
||||
exports.version = "18.3.0-canary-77c4ac2ce-20231031";
|
||||
|
||||
+1
-1
@@ -583,7 +583,7 @@ exports.useSyncExternalStore = function (
|
||||
exports.useTransition = function () {
|
||||
return ReactCurrentDispatcher.current.useTransition();
|
||||
};
|
||||
exports.version = "18.3.0-canary-08a39539f-20231031";
|
||||
exports.version = "18.3.0-canary-77c4ac2ce-20231031";
|
||||
|
||||
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
||||
if (
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
08a39539fc6922cdb9e2405029127a1911b1b809
|
||||
77c4ac2ce88736bbdfe0b29008b5df931c2beb1e
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<2852b7818fac619ab3ec01b1e52fa49a>>
|
||||
* @generated SignedSource<<88cce6608a8eb5d16fdbf38a6a841ea7>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -12183,7 +12183,7 @@ function startTransition(
|
||||
}
|
||||
|
||||
try {
|
||||
var returnValue, thenable, entangledResult, _entangledResult;
|
||||
var returnValue, thenable, entangledResult, _entangledResult2;
|
||||
if (enableAsyncActions);
|
||||
else {
|
||||
// Async actions are not enabled.
|
||||
@@ -27260,7 +27260,7 @@ function createFiberRoot(
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-canary-fa7a00a2";
|
||||
var ReactVersion = "18.3.0-canary-724e820d";
|
||||
|
||||
function createPortal$1(
|
||||
children,
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<3f8b7e5d6e0a296d53dbbc1071571ee7>>
|
||||
* @generated SignedSource<<f9ab7c386bd17d387feda64b21b6d980>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -12455,7 +12455,7 @@ function startTransition(
|
||||
}
|
||||
|
||||
try {
|
||||
var returnValue, thenable, entangledResult, _entangledResult;
|
||||
var returnValue, thenable, entangledResult, _entangledResult2;
|
||||
if (enableAsyncActions);
|
||||
else {
|
||||
// Async actions are not enabled.
|
||||
@@ -27690,7 +27690,7 @@ function createFiberRoot(
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-canary-a9bf5e61";
|
||||
var ReactVersion = "18.3.0-canary-338768c1";
|
||||
|
||||
function createPortal$1(
|
||||
children,
|
||||
|
||||
Reference in New Issue
Block a user