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

Form.useWatch: a detached form keeps its last value, and the equality contract for Set/Map/class values is undefined

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

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

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

評価

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

調査の方向性

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.

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

説明

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.

主要言語
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 を短くまとめたダイジェスト。