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

Errors not clearing properly when adding/removing fields array items and validating with zod #267

Open
marleau opened this issue Sep 8, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@marleau
Copy link

marleau commented Sep 8, 2023

Describe the bug

If an invalid array item exists, the error messages keep accumulating for each invalid array item when adding/removing an array item and validating with zod.

Which package/s are you using?

felte (Svelte), @felte/validator-zod

Environment

To reproduce

  1. Open the reproduction
  2. Click button add invalid item
  3. See one error message for the invalid item
  4. Click button add invalid item
  5. See two duplicate error messages for the first invalid item and one error for the second invalid item.
  6. Click remove button
  7. See three duplicate error messages for the first invalid item

Small reproduction example

https://svelte.dev/repl/024824e323544a8fa08b6abc4b09f33c?version=4.2.0

Screenshots

felte-zod-field-array-item-error-issue

Additional context

No response

@marleau marleau added the bug Something isn't working label Sep 8, 2023
@marleau
Copy link
Author

marleau commented Sep 8, 2023

I did a little more testing. I see this issue for any invalid field. It doesn't have to be a field array.

Here is a an updated reproduction: https://svelte.dev/repl/d63036e3a4a345748909a6c082cd809f?version=4.2.0

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