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

Field Array errors result is exclude null entries after invaild value submitted #284

Open
mu-hun opened this issue Dec 15, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@mu-hun
Copy link

mu-hun commented Dec 15, 2023

Describe the bug

I used a Field Array for multiple URL inputs. When sending the form, I wanted to display an error message inside the input field UI if any of the addresses entered were not in the correct URL format, but I am experiencing the following bug.

The array field error data is initially [null, null, null] by three empty inputs, but when error occurs it is ['URL not available', 'URL not available'].

Which package/s are you using?

felte (Svelte), @felte/validator-zod

Environment

  • OS: MacOS
  • Browser: FireFox, Chrome
  • Version
    • "@felte/core": "^1.4.1"
    • "@felte/validator-zod": "^1.0.17"
    • "felte": "^1.2.12"

To reproduce

  1. add 2 or more variable fields.
  2. n number of null items as an error result.
  3. input a non-URL string in one of the fields.
  4. submit. The nulls are omitted and there is only one string item as an error message.

Small reproduction example

No response

Screenshots

스크린샷 2023-12-15 오후 1 48 56

Additional context

I am using zod as validator. here is schema:

const UpdateSpaceSchema = z.object({
  externalLinks: z.array(z.string().url('URL not available')).optional(),
});
@mu-hun mu-hun added the bug Something isn't working label Dec 15, 2023
mu-hun added a commit to withglyph/glyph that referenced this issue Dec 15, 2023
felt array field 사용 시 오류 데이터 순서가 부정확한 버그로 FormValidationMessage 컴포넌트를 통해 오류가 제대로 표시되지 않은 문제가 있습니다. 해당 버그의 대안으로 토스트로 피드백을 주는 장치를 추가했습니다.

버그를 제보하고 답변이 오길 기다리고 있습니다. pablo-abc/felte#284
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