Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#124 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
react, typescript
領域
frontend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
2
フォーク
0
平均マージ
1日 14時間
マージ済み PR(30日)
36

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

lablup/ui-common のほかの issue

lablup/ui-common の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。