Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Stale useEffectEvent closures under memo()/forwardRef() on React 19.2 in UnitGrid, Modal, NotificationStack and modalStack

Aperta
#124 0 commenti 0 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
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Start in the hooks layer and inspect the four callers named in the issue: UnitGrid, Modal, NotificationStack, and modalStack. Reproduce the stale closure behavior under memo() and forwardRef() using the installed React version, then evaluate a shared latest-closure hook against the existing Form.useWatch fix in #121. Done means all four callers use the fix or have a documented reason their frozen closure is harmless, with a regression test; changing the React floor also requires a team decision and a CHANGELOG entry.

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

Descrizione

Why

React 19.2.x republishes a useEffectEvent implementation only for plain function-component fibers; inside a memo() (without a compare function) or forwardRef() component the callback keeps its first render's closure for the component's whole life (facebook/react#34818, fixed in React 19.3 by facebook/react#34831). ui-common's peerDependencies still allow react ^19.2.0, so any consumer that wraps one of our components in memo() / forwardRef() on 19.2 gets frozen callbacks.

#121 fixed Form.useWatch by reading its latest path, selector, form and last value through a ref updated in useLayoutEffect instead of relying on useEffectEvent. The review of that PR found the same pattern in four other places, left unchanged there:

  • UnitGrid — refreshResolved keeps the first render's distinctColors
  • Modal — notifyOpenChange keeps the first afterOpenChange callback
  • NotificationStack — fireClose
  • modalStack — readZIndex

Scope

  • One shared useEvent-style hook (stable identity, latest closure through a ref assigned in useLayoutEffect) in the hooks layer, with a test that exercises it under memo() and forwardRef() on the installed React.
  • Replace the four useEffectEvent callers with it (or document per site why the frozen closure is harmless there).
  • Alternatively, or in addition, raise the peer and dev React floor to ^19.3.0 and record that in CHANGELOG — a team decision, since it drops 19.2 consumers.

Found during the review of #121; consumer context in lablup/backend.ai-webui#10705.

Lingua principale
TypeScript
Stelle
2
Fork
0
Merge medio
1g 13h
PR unite (30g)
35

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 lablup/ui-common

Tutte le issue di lablup/ui-common

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.