Form.useWatch: a detached form keeps its last value, and the equality contract for Set/Map/class values is undefined
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
- Ambito
- frontend
Direzione di ricerca
Read the Form.useWatch hook and the Field.tsx equality helper, then inspect the review of #121 for context. Reproduce the detached form case and the listed value comparisons. The detached case is done when the hook returns the fresh-mount value after detachment; the equality behavior needs an explicit contract for supported value shapes and inline selectors before implementation.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Two Form.useWatch edge cases the review of #121 found and left out of that PR
1. A detached form keeps its last value
When form goes from a valid instance to undefined (<Watcher form={attached ? form : undefined} /> with attached flipping to false), the subscription effect returns early and the watcher bails on isValidForm, so the hook keeps returning the detached form's last value instead of what a fresh mount without a form returns (undefined, or selector({})). Consumers can act on data from a form they have let go of. This is the mirror of the attach case #121 fixed.
2. Change detection is JSON serialisation, so Set / Map / toJSON-less class instances are compared as {}
new Set([1]) → new Set([1, 2]), Map changes, File, NaN vs null all serialise identically and are dropped; cyclic or BigInt values hit the catch and count as changed every time. #121 tried isEqual (the helper Field.tsx uses) and reverted it: a selector returning a fresh function/URL/React element loops forever, class instances with #private state compare equal, key order and Set order stop being reported, and equalUnordered is O(n²) on large Sets. A deliberate equality contract for useWatch (which shapes are compared how, what an inline selector may return) is needed before changing it; today's behaviour matches upstream.
Found during the review of #121.
- Lingua principale
- TypeScript
- Stelle
- 2
- Fork
- 0
- Merge medio
- 1g 14h
- PR unite (30g)
- 36
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di lablup/ui-common
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
I maintainer di solito rispondono entro 1 giorno
-
Stat: add a tooltip that explains the deltaForse già presa @agatha197 l’ha presa 2 giorni fa. Aperta
lablup/ui-common#110 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di lablup/ui-common
Issue simili
-
area: triage theme: undefined
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
jhipster/generator-jhipster#35895 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
paperclipai/paperclip#18396 ·
I maintainer di solito rispondono entro 1 giorno
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
lingdojo/kana-dojo#33380 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
chore other
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
alastair-smith/card-games#342 ·
I maintainer di solito rispondono entro 1 giorno