`withFieldGroup` array handling with nested

Aperta
#1,648 4 commenti 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Inizia con la riproduzione collegata di CodeSandbox, concentrandoti su withFieldGroup e sul componente SingleFieldWithReorder mentre sposti i valori degli array annidati verso l’alto e verso il basso. Traccia il motivo per cui i valori annidati renderizzati divergono dal mapping dell’array padre e verifica se fields e form debbano essere esposti alla funzione di rendering. Il lavoro è completato quando il gruppo annidato rimane sincronizzato e il comportamento delle render props è risolto o documentato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

v1 v2: needs investigation
Describe the bug

When combining the withFieldGroup for a complex array handling, the nested array element seems out of sync with the actual value of the group.

I've just tested while passing the root form to the SingleFieldWithReorder and the nested elements keep being out of sync (regarding the json value displayed)


Also, this is unrelated but when looking at the extra props of the render function, it seems to pass the fields and the form. Idk if this is expected or if the props must be sanitized when rendering to remove theses values before passing the props to the render method. (They are undocumented and not typed)

Your minimal, reproducible example

https://codesandbox.io/p/devbox/misty-monad-8t29lx?workspaceId=ws_PkVpfRWHUp5vMscgD59gVj

Steps to reproduce
  1. Try to move the value with the move down|move up buttons.
  2. See that the values from the base array mapping are correct, but the values rendered in the element aren't.
Expected behavior

I think the nested group value should remain sync with the array mapping from the parent group

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform
  • Browser: Tested on chrome 138.0.7204.183 (Official Build) (64-bit)
TanStack Form adapter

react-form

TanStack Form version

v1.15.1

TypeScript version

No response

Additional context

No response

Lingua principale
TypeScript
Stelle
6.8k
Fork
711
Merge medio
1g 6h
PR unite (30g)
12

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/form

Tutte le issue di TanStack/form

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.