rvf icon indicating copy to clipboard operation
rvf copied to clipboard

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

Open haines opened this issue 1 year ago • 0 comments

Which packages are impacted?

  • [X] remix-validated-form
  • [ ] @remix-validated-form/with-zod
  • [ ] @remix-validated-form/with-yup
  • [ ] zod-form-data

What version of these packages are you using?

  • remix-validated-form: 5.1.5

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

  • OS: macOS, Linux
  • Browser: Chrome
  • Version: 118, 122

Additional context

No response

haines avatar Mar 28 '24 13:03 haines