`useForm`: support client-side validation (or at least `setError`)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 54/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- frontend
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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
- Vorherrschende Sprache
- TypeScript
- Sterne
- 402
- Forks
- 32
- Ø Merge
- 10 Std. 18 Min.
- Gemergte PRs (30 T.)
- 113
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus voidzero-dev/void
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
voidzero-dev/void#529 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 78/100
voidzero-dev/void#428 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Auth config regeneration in dev can reuse a cached configEvtl. vergeben @Brooooooklyn hat das heute übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
voidzero-dev/void#550 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 46/100
voidzero-dev/void#547 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 38/100
voidzero-dev/void#546 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in voidzero-dev/void
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
cloudscape-design/components#5184 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
JarX-Concepts/react-native-platform-components#130 ·
Maintainer antworten meist innerhalb von 1 Tag
-
fix(api): optimize-for-web /preview outer catches miss asDecoderOutOfMemory on V8 OOM and SIGKILLOffenarea: backend bug priority: low
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
snapotter-hq/SnapOtter#3773 ·
Maintainer antworten meist innerhalb von 1 Tag
-
ai-driven-qa ux-audit
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
linagora/twake-contacts-frontend#386 ·
Maintainer antworten meist innerhalb von 1 Tag
-
git: README should state plainly that without --repository every reachable repository is in scopeOffendocumentation server-git v2
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 84/100
modelcontextprotocol/servers#5225 ·
Maintainer antworten meist innerhalb von 1 Tag