mirror of
https://github.com/facebook/react.git
synced 2026-02-26 05:35:21 +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.
This commit is contained in:
@@ -33,20 +33,20 @@ export default class ProfilingCache {
|
||||
this._profilerStore = profilerStore;
|
||||
}
|
||||
|
||||
getCommitTree: ({
|
||||
commitIndex: number,
|
||||
rootID: number,
|
||||
}) => CommitTree = ({commitIndex, rootID}) =>
|
||||
getCommitTree: ({commitIndex: number, rootID: number}) => CommitTree = ({
|
||||
commitIndex,
|
||||
rootID,
|
||||
}) =>
|
||||
getCommitTree({
|
||||
commitIndex,
|
||||
profilerStore: this._profilerStore,
|
||||
rootID,
|
||||
});
|
||||
|
||||
getFiberCommits: ({
|
||||
fiberID: number,
|
||||
rootID: number,
|
||||
}) => Array<number> = ({fiberID, rootID}) => {
|
||||
getFiberCommits: ({fiberID: number, rootID: number}) => Array<number> = ({
|
||||
fiberID,
|
||||
rootID,
|
||||
}) => {
|
||||
const cachedFiberCommits = this._fiberCommits.get(fiberID);
|
||||
if (cachedFiberCommits != null) {
|
||||
return cachedFiberCommits;
|
||||
|
||||
Reference in New Issue
Block a user