`useForm`: support client-side validation (or at least `setError`)
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 54/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- typescript
- Domaine
- frontend
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- TypeScript
- Étoiles
- 402
- Forks
- 32
- Merge moyen
- 10 h 18 min
- PR mergées (30 j)
- 113
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de voidzero-dev/void
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
voidzero-dev/void#529 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 1/5 1-3 heures Accessibilité débutants 78/100
voidzero-dev/void#428 ·
Les mainteneurs répondent en général sous 1 jour
-
Auth config regeneration in dev can reuse a cached configPeut-être pris @Brooooooklyn l’a pris aujourd’hui. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
voidzero-dev/void#550 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 46/100
voidzero-dev/void#547 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 38/100
voidzero-dev/void#546 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de voidzero-dev/void
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
maniator/verticopolis#1303 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
components-web-app/docs#297 ·
-
listFeatures/getFeatureExamples never return Kotlin examples for Android or server Kotlin SDKsOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
appwrite/mcp-for-docs#23 · 1 commentaire ·
-
`@vanilla-extract/turbopack-plugin`: "getImageSize is not a function" with Next.js 16.4.x when a `.css.ts` file imports an imagePeut-être pris @aevarOrigo l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
vanilla-extract-css/vanilla-extract#1799 · 1 commentaire ·
-
native
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
prime-radiant-inc/evener#4839 ·
Les mainteneurs répondent en général sous 1 jour