Custom Field Meta does not updated until input touched after 1.26.0

Offen
#1,980 5 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
42/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
react, typescript
Bereich
frontend

Rechercherichtung

Führe die StackBlitz-Reproduktion mit den in package.json, src/simple-form.tsx und src/App.tsx genannten Dateien aus. Vergleiche TanStack Form 1.26.0 mit 1.27.7 und verfolge dabei das onMount-meta-Update sowie das Rendering-Verhalten von firstName. Als erledigt gilt die Aufgabe, wenn firstName zunächst ausgeblendet ist und korrekt aktualisiert wird, wenn color geändert wird, ohne firstName zu berühren.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

v1
Describe the bug

I am using custom field meta's heavily, for example style={{ display: field.state.meta?.hidden ? 'none' : 'block' }}, for every field I have set of these meta's like dataSource, hidden, disabled, and others...

in example there is two field firstName and color, I have listener.onMount that hide firstName (through field.setMeta()) if color is "red", in v1.26.0 and before it works well, after this version it does not hide until I touch the field firstName

example use v1.26.0, change package version to see the problem

Your minimal, reproducible example

https://stackblitz.com/edit/vitejs-vite-kqn6fekp?file=package.json,src%2Fsimple-form.tsx,src%2FApp.tsx&terminal=dev

Steps to reproduce
  1. notice in example field firstName is hidden by default (it is hidden in onMount)
  2. change the color to "green" field firstName will appear
  3. upgrade tanstack-form version to newer version
  4. after refresh you will notice firstName now is not hidden
  5. touch the field firstName now it will hide
Expected behavior

compare by previous steps I exp expect:

  1. notice in example field firstName is hidden by default (it is hidden in onMount)
  2. change the color to "green" field firstName will appear
  3. upgrade tanstack-form version to newer version
  4. field firstName should still hidden by default
How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform
  • OS: [linux, windows]
  • Browsers: [chrome, vivaldi]
TanStack Form adapter

react-form

TanStack Form version

1.27.7

TypeScript version

5.9.3

Additional context

No response

Vorherrschende Sprache
TypeScript
Sterne
6.8k
Forks
705
Ø Merge
1 T. 12 Std.
Gemergte PRs (30 T.)
14

Entwicklungsumgebung

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 TanStack/form

Alle Issues in TanStack/form

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

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