Skip to content

Commit f792c17

Browse files
committed
Ensure dispatch in useFormState works in StrictMode
1 parent c2f1a2c commit f792c17

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/react-reconciler/src/ReactFiberHooks.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,6 +2259,9 @@ function rerenderFormState<S, P>(
22592259
);
22602260
}
22612261

2262+
// For mount, pending is always false.
2263+
const [isPending] = updateState(false);
2264+
22622265
// This is a mount. No updates to process.
22632266
const state: Awaited<S> = stateHook.memoizedState;
22642267

@@ -2269,8 +2272,7 @@ function rerenderFormState<S, P>(
22692272
// This may have changed during the rerender.
22702273
actionQueueHook.memoizedState = action;
22712274

2272-
// For mount, pending is always false.
2273-
return [state, dispatch, false];
2275+
return [state, dispatch, isPending];
22742276
}
22752277

22762278
function pushEffect(

0 commit comments

Comments
 (0)