-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array fields do not update when adding fields and errors are not available when validating form #874
Comments
Do you mean it works clicking the button first time or you are calling insert multiple times and the first time works? I don't have much ideas right now by looking at your description. But i can take a look of the codebase if you want. Let me know. |
@edmundhung Here's the issue on video and explanation. It's a bit long but hard to explain, sorry video PS: I think i forgot to mention what fixed it.. The fix was to take out the content of |
I got new information regarding the errors not propagating down to the In the form shown in the video, when i:
This conform/packages/conform-dom/form.ts Line 721 in 9157707
in development build (local
|
I am wondering if you have cache the JSX in some way so that you are not accessing the metedata after the initial render. Conform will reset the subject on every render and resubscribe to what being accessed during that particular render. 🤔 Maybe ping me on discord and we can have a call tonight or tomorrow to go through it together. |
Description
I've identified two significant issues when i rewrote all of our forms to Conform V1 when working with complex nested forms. Importantly, these bugs only manifest in production builds and not during development.
Issue 1: Form Insertion Not Working
When using complex forms with multiple nested arrays of objects,
formMeta.insert()
sometimes fails to add new items to the form.It successfully inserts the first item, but not any other.
The UI doesn't update to reflect any changes
Components using
useField()
don't receive updated valuesIssue 2: Validation Errors Not Propagating Correctly
When validating forms with nested structures:
parseWithZod
correctly identifies and returns validation errorsHowever, these errors don't appear in
meta.errors
The form correctly focuses the fields with errors
But the actual error messages/states are missing from
meta.errors
Conform version
v1.1.5
Steps to Reproduce the Bug or Issue
Only occurs in production builds (not in development mode)
Happens with forms containing nested arrays of objects
Complex nesting structure (arrays within objects within arrays).
I have tried to make a minimal reproduction but failed to do so. It seems like a deeper issue.
Bizarre fix
Take out the logic of rendering nested array from a component one level higher up in the tree.
What browsers are you seeing the problem on?
Chrome
Screenshots or Videos
I will post a video here
Additional context
No response
The text was updated successfully, but these errors were encountered: