airjp73/rvf

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

Closed this issue · 2 comments

Which packages are impacted?

  • 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

Screen.Recording.2024-03-28.at.13.52.41.mov

Platform

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

Additional context

No response

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

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.