File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -1296,7 +1296,6 @@ describe('ReactDOMForm', () => {
12961296 expect ( container . textContent ) . toBe ( 'B' ) ;
12971297 } ) ;
12981298
1299-
13001299 // @gate enableFormActions
13011300 // @gate enableAsyncActions
13021301 test ( 'useFormState works in StrictMode' , async ( ) => {
@@ -1326,15 +1325,20 @@ describe('ReactDOMForm', () => {
13261325 }
13271326
13281327 const root = ReactDOMClient . createRoot ( container ) ;
1329- await act ( ( ) => root . render ( < React . StrictMode > < App /> </ React . StrictMode > ) ) ;
1328+ await act ( ( ) =>
1329+ root . render (
1330+ < React . StrictMode >
1331+ < App />
1332+ </ React . StrictMode > ,
1333+ ) ,
1334+ ) ;
13301335 assertLog ( [ '0' ] ) ;
13311336 expect ( container . textContent ) . toBe ( '0' ) ;
13321337
13331338 await act ( ( ) => dispatch ( 'increment' ) ) ;
13341339 assertLog ( [ 'Async action started [1]' , 'Pending 0' ] ) ;
13351340 expect ( container . textContent ) . toBe ( 'Pending 0' ) ;
13361341
1337-
13381342 await act ( ( ) => resolveText ( 'Wait [1]' ) ) ;
13391343 assertLog ( [ '1' ] ) ;
13401344 expect ( container . textContent ) . toBe ( '1' ) ;
Original file line number Diff line number Diff line change @@ -2259,6 +2259,9 @@ function rerenderFormState<S, P>(
22592259 ) ;
22602260 }
22612261
2262+ // For mount, pending is always false.
2263+ const [isPending] = rerenderState(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
22762278function pushEffect (
You can’t perform that action at this time.
0 commit comments