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) {
33553355 ) ;
33563356 }
33573357
3358- const stateHook = ensureFormComponentIsStateful(formFiber);
3358+ let stateHook: Hook = ensureFormComponentIsStateful(formFiber);
33593359 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+ }
33603368 const resetStateHook: Hook = (stateHook.next: any);
33613369 const resetStateQueue = resetStateHook.queue;
33623370 dispatchSetStateInternal(
You can’t perform that action at this time.
0 commit comments