Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rburgst/vite-svelte-felte
error repro sample for felte with svelte
https://github.com/rburgst/vite-svelte-felte
Last synced: 2 days ago
JSON representation
error repro sample for felte with svelte
- Host: GitHub
- URL: https://github.com/rburgst/vite-svelte-felte
- Owner: rburgst
- Created: 2022-11-11T07:20:23.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-11T07:20:51.000Z (about 2 years ago)
- Last Synced: 2024-11-08T17:53:07.022Z (about 2 months ago)
- Language: Svelte
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Felte setData error repo
This project shows a problem in felte validation when using `setData` on array fields where the errors are not properly updated.
## Reproduction
1. `yarn install`
2. `yarn dev`
3. Click "add Interest"
4. type in `a` into the new input field## Expected
`errors` should show an error in `items[0].title`
## Actual
`errors` is still `items: [{title: null}]
## More context
The problem is that we dont use a native `input` field to set the form data but instead use `setData` to update the form.
The validator is called and does indeed set
```json
{
"email": [
"Must not be empty",
"Must be a valid email"
],
"items": [
{
"title": [
"title 0 must have length >= 2"
]
}
]
}
```but the new validation error object never shows up in the `$errors` store from felte.