[Bug]: fetcher.data
is define when submitting via fetcher.submit
but is undefined when submitting a fetcher.Form
#11409
Labels
What version of React Router are you using?
6.21.1
Steps to Reproduce
fetcher
Click the submit button to submit the
form
.Wait for
fetcher.state
to transition fromidle
tosubmitting
and back toidle
.Inspect
fetcher.data
and see that it isundefined
.Add a click event to the submit button:
Wait for
fetcher.state
to transition fromidle
tosubmitting
and back toidle
.Inspect
fetcher.data
and see that is contains the response from the action.Expected Behavior
A
fetcher.Form
interaction should resolve to the same state as an explicit call tofetcher.submit
.Actual Behavior
fetcher.submit
receives the action response whereasfetcher.Form
interactions do not.NOTES:
Changing the click handler to a submit handler prevents
fetcher.data
from being set as well, even though the event handler code is the same.Interestingly,
fetcher.state
will transition fromsubmitting
toidle
duringfetcher.Form
interaction before the router action actually completes (though this may just be a result of async functions doing their thing)The text was updated successfully, but these errors were encountered: