`useForm`: support client-side validation (or at least `setError`)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 54/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- frontend
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 402
- Forks
- 32
- Merge medio
- 10 h 18 min
- PR fusionados (30 d)
- 113
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de voidzero-dev/void
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
voidzero-dev/void#529 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
voidzero-dev/void#428 ·
Los mantenedores suelen responder en 1 día
-
Auth config regeneration in dev can reuse a cached configPosiblemente ocupada @Brooooooklyn la tomó hoy. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
voidzero-dev/void#550 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 46/100
voidzero-dev/void#547 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
voidzero-dev/void#546 ·
Los mantenedores suelen responder en 1 día
Todos los issues de voidzero-dev/void
Issues similares
-
bug skills
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
equinor/fusion-framework#5846 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Eyevinn/open-videocore#1256 ·
Los mantenedores suelen responder en 1 día
-
Frontend build fails with Frappe version-16: DataImport is no longer exported by @framework/uiAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[Bug]: Theme preset geist points at undefined --font-geistPosiblemente ocupada @claude la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 1 día