File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
packages/react-reconciler/src Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -3355,8 +3355,16 @@ export function requestFormReset(formFiber: Fiber) {
3355
3355
) ;
3356
3356
}
3357
3357
3358
- const stateHook = ensureFormComponentIsStateful(formFiber);
3358
+ let stateHook: Hook = ensureFormComponentIsStateful(formFiber);
3359
3359
const newResetState = { } ;
3360
+ if (stateHook.next === null) {
3361
+ // Hack alert. If formFiber is the workInProgress Fiber then
3362
+ // we might get a broken intermediate state. Try the alternate
3363
+ // instead.
3364
+ // TODO: We should really stash the Queue somewhere stateful
3365
+ // just like how setState binds the Queue.
3366
+ stateHook = ( formFiber . alternate : any ) . memoizedState ;
3367
+ }
3360
3368
const resetStateHook: Hook = (stateHook.next: any);
3361
3369
const resetStateQueue = resetStateHook.queue;
3362
3370
dispatchSetStateInternal(
You can’t perform that action at this time.
0 commit comments