airjp73 / rvf

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

[Bug]: Maximum update depth exceeded for ValidatedForm #269

Closed carlos-gn closed 1 year ago

carlos-gn commented 1 year ago

Which packages are impacted?

What version of these packages are you using?

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

Can't provide an example.

Steps to Reproduce the Bug or Issue

No idea. I was changing a form a started to have this error: Screenshot 2023-03-26 at 14 29 19

It get fixed when i change the id of the form:

image image

Expected behavior

I expected it to work, does not make sense that it get fixed when i change the id form, seems like the form gets cached or something and the store fails.

Screenshots or Videos

No response

Platform

Additional context

No response

carlos-gn commented 1 year ago

Also get fixed when i change the id in the useFormContext image

carlos-gn commented 1 year ago

Ok, the error starts when i use defaultValues.

    defaultValues={{
              providers: [],
              medicalHistoryNumber: "",
              division: "",
              doctor: "",
              date: new Date(),
              comments: "",
              surgeryPartFile: "",
            }}
carlos-gn commented 1 year ago

Solved. Cannot pass new Date() as default value.