Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

`useForm`: support client-side validation (or at least `setError`)

Offen
#525 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

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, only clearErrors,
  • the Zod schema already used in withValidator() can be run on the client by hand, but its results can't be wired into form.errors,
  • errors don't clear when a field changes, so each onChange needs its own clearErrors(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:

  1. setError(field, message): lets apps run their own validation and show the result through form.errors.
  2. An option to clear a field's error on change, e.g. clearErrorsOnChange: true, so setData(field, …) also clears errors[field].
  3. 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

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus voidzero-dev/void

Alle Issues in voidzero-dev/void

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.