Skip to content
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

[Bug]: Inconsistency when updating a nested value with useField vs useFieldArray #360

Open
2 of 4 tasks
weslleyaraujo opened this issue Apr 5, 2024 · 1 comment
Open
2 of 4 tasks
Labels
bug Something isn't working

Comments

@weslleyaraujo
Copy link

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/with-zod": "*"
  • "remix-validated-form": "*"

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

https://codesandbox.io/p/devbox/958zwp?file=%2Fapp%2Froutes%2Findex.tsx%3A1%2C1-90%2C1

Steps to Reproduce the Bug or Issue

  1. Open the page. Observe that the input field is populated with the correct initial value ("example").
  2. Click on the input field to focus on it.
  3. Change the value in the input field.
  4. Notice that the rendered value of options.[0].values[0].name on the screen does not update to reflect the changes made in the input field.
  5. Click on the "Call .replace() with Date.now()" button.
  6. Observe that both the input field value and the corresponding rendered field options.[0].values[0].name on the screen update correctly with Date.now(), indicating they are connected.

Expected behavior

I would expect that useField or even useControlField would be able to change a deep nested value and changes to it be reactive on any consumer of the form state (useFieldArray in this case)

Screenshots or Videos

Screen.Recording.2024-04-05.at.17.11.16.mov

Platform

  • OS: [e.g. macOS, Windows, Linux]

Additional context

No response

@weslleyaraujo weslleyaraujo added the bug Something isn't working label Apr 5, 2024
@airjp73
Copy link
Owner

airjp73 commented Apr 29, 2024

This kind of inconsistency is something I'm hoping to fix with v6 (#364)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants