`useForm`: support client-side validation (or at least `setError`)
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 54/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
- Domínio
- frontend
Direção de pesquisa
Start by locating the useForm implementation and its tests in the @void/react package; the issue does not name specific files. Trace how errors, clearErrors, and setData are handled, then check how server validation maps errors into the form. Done means the chosen proposal works through form.errors and has tests for setting errors and, if implemented, clearing them on change.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Version
void / @void/react 1.1.12
Problem
useForm only fills errors from the server's withValidator() response. There's no way to validate in the browser and show errors through the same errors object:
- there's no
setError/setErrors, onlyclearErrors, - the Zod schema already used in
withValidator()can be run on the client by hand, but its results can't be wired intoform.errors, - errors don't clear when a field changes, so each
onChangeneeds its ownclearErrors(field)call.
As a result, apps that want inline validation as the user types either keep a second error state next to form.errors, or switch to another form library and lose useForm's typed action URL, pending and server error mapping.
Proposal
Any of these, from smallest to largest:
setError(field, message): lets apps run their own validation and show the result throughform.errors.- An option to clear a field's error on change, e.g.
clearErrorsOnChange: true, sosetData(field, …)also clearserrors[field]. - Optional client-side validation with the action's schema, e.g.
useForm(url, defaults, { validate: createNoteSchema, validateOn: 'blur' | 'change' }). That would give the same messages in the browser and on the server, from one schema.
(1) and (2) are small and unblock building (3) in userland.
Related: #523, #524
- Linguagem predominante
- TypeScript
- Estrelas
- 402
- Forks
- 32
- Merge médio
- 8h 32min
- PRs com merge (30d)
- 111
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de voidzero-dev/void
-
Dev: `better-auth/client/plugins` fails to resolve when auth is enabled (the `better-auth/client` alias matches it as a prefix)Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
voidzero-dev/void#565 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
voidzero-dev/void#529 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 78/100
voidzero-dev/void#428 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 53/100
voidzero-dev/void#567 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
voidzero-dev/void#564 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de voidzero-dev/void
Issues semelhantes
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 73/100
openclaw/openclaw#182077 · 1 comentário · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
aikido high security
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
dequelabs/axe-linter-action#161 ·
-
[Feature Request] Update the DimCode agent icon to the 45:32 brand markTalvez já em andamento @eric8810 assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
[Feature]: 建议导入源后,自动切换到新导入的源Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
lyswhut/lx-music-desktop#3026 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
abhigyanpatwari/GitNexus#3704 ·
Mantenedores costumam responder em até 1 dia