airjp73 / rvf

Easy form validation and state management for React and Remix
https://rvf-js.io
MIT License
826 stars 66 forks source link

[Bug]: Unhandled error setting `isSubmitting` after form unmounts #355

Closed haines closed 1 month ago

haines commented 5 months ago

Which packages are impacted?

What version of these packages are you using?

Please provide a link to a minimal reproduction of the issue.

https://codesandbox.io/p/devbox/vigilant-banach-dy5vkk

Steps to Reproduce the Bug or Issue

We have a validated form in a modal with an onSubmit callback that calls event.preventDefault() and unmounts the modal component.

This causes an unhandled error "Cannot set properties of undefined (setting 'isSubmitting')".

  1. Load the repro sandbox
  2. Open the console
  3. Submit the form by clicking "Done"
  4. See the error in the console

Expected behavior

Unmounting the form on submission doesn't cause an error.

Screenshots or Videos

https://github.com/airjp73/remix-validated-form/assets/785641/b8ee3e3d-a991-4e2c-b232-69360be6b5b3

Platform

Additional context

No response

RobertGemmaJr commented 1 month ago

+1 on this, we've run into the same issue

airjp73 commented 1 month ago

RVF v6 has been released 🎉

This issue no longer exists in v6. If it's still a problem in that version, please feel free to open a new issue.

You can find the documentation here and the migration guide here.