Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 52 changed files with 9,354 additions and 4,540 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,16 @@
"random-seed": "0.3.0",
"react": "18.2.0",
"react-17": "npm:[email protected]",
"react-builtin": "npm:[email protected]08a39539f-20231031",
"react-builtin": "npm:[email protected]2983249dd-20231107",
"react-dom": "18.2.0",
"react-dom-17": "npm:[email protected]",
"react-dom-builtin": "npm:[email protected]08a39539f-20231031",
"react-dom-experimental-builtin": "npm:[email protected]08a39539f-20231031",
"react-experimental-builtin": "npm:[email protected]08a39539f-20231031",
"react-server-dom-turbopack": "18.3.0-canary-08a39539f-20231031",
"react-server-dom-turbopack-experimental": "npm:[email protected]08a39539f-20231031",
"react-server-dom-webpack": "18.3.0-canary-08a39539f-20231031",
"react-server-dom-webpack-experimental": "npm:[email protected]08a39539f-20231031",
"react-dom-builtin": "npm:[email protected]2983249dd-20231107",
"react-dom-experimental-builtin": "npm:[email protected]2983249dd-20231107",
"react-experimental-builtin": "npm:[email protected]2983249dd-20231107",
"react-server-dom-turbopack": "18.3.0-canary-2983249dd-20231107",
"react-server-dom-turbopack-experimental": "npm:[email protected]2983249dd-20231107",
"react-server-dom-webpack": "18.3.0-canary-2983249dd-20231107",
"react-server-dom-webpack-experimental": "npm:[email protected]2983249dd-20231107",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
Expand All @@ -212,8 +212,8 @@
"resolve-from": "5.0.0",
"sass": "1.54.0",
"satori": "0.10.6",
"scheduler-builtin": "npm:[email protected]08a39539f-20231031",
"scheduler-experimental-builtin": "npm:[email protected]08a39539f-20231031",
"scheduler-builtin": "npm:[email protected]2983249dd-20231107",
"scheduler-experimental-builtin": "npm:[email protected]2983249dd-20231107",
"seedrandom": "3.0.5",
"selenium-webdriver": "4.0.0-beta.4",
"semver": "7.3.7",
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function printWarning(level, format, args) {
}
}

var ReactVersion = '18.3.0-experimental-08a39539f-20231031';
var ReactVersion = '18.3.0-experimental-2983249dd-20231107';

var Internals = {
usingClientEntryPoint: false,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12201,28 +12201,43 @@ function runFormStateAction(actionQueue, setState, payload) {
}

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.

var returnValue = action(prevState, payload);

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.

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);

promise.then(function (nextState) {
setState(_entangledResult);
var nextState = returnValue;
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);
}
} 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$3.transition = prevTransition;

Expand Down Expand Up @@ -12281,23 +12296,20 @@ function mountFormState(action, initialStateProp, permalink) {
initialState = ssrFormState[0];
}
}
}

var initialStateThenable = {
status: 'fulfilled',
value: initialState,
then: function () {}
}; // State hook. The state is stored in a thenable which is then unwrapped by
} // 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(null, currentlyRenderingFiber$1, stateQueue);
Expand Down Expand Up @@ -12332,10 +12344,11 @@ function updateFormState(action, initialState, permalink) {

function updateFormStateImpl(stateHook, currentStateHook, action, initialState, permalink) {
var _updateReducerImpl = updateReducerImpl(stateHook, 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.
Expand Down Expand Up @@ -12371,8 +12384,7 @@ function rerenderFormState(action, initialState, permalink) {
} // 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.
Expand Down Expand Up @@ -12804,9 +12816,9 @@ function startTransition(fiber, queue, pendingState, finishedState, callback, op
// 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);
var _entangledResult2 = requestSyncActionContext(returnValue, finishedState);

dispatchSetState(fiber, queue, _entangledResult);
dispatchSetState(fiber, queue, _entangledResult2);
}
}
} catch (error) {
Expand Down Expand Up @@ -28828,7 +28840,7 @@ identifierPrefix, onRecoverableError, transitionCallbacks, formState) {
return root;
}

var ReactVersion = '18.3.0-experimental-08a39539f-20231031';
var ReactVersion = '18.3.0-experimental-2983249dd-20231107';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
Loading

0 comments on commit 7b3e586

Please sign in to comment.