Form.useWatch: a detached form keeps its last value, and the equality contract for Set/Map/class values is undefined
メンテナーはふだん 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
lablup/ui-common のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
メンテナーはふだん 1 日以内に返信
-
Stat: add a tooltip that explains the delta対応中かも @agatha197 が 2 日前に担当しました。 オープン
lablup/ui-common#110 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
lablup/ui-common の issue をすべて見る
似ている issue
-
Replace discontinued crypto-js in the theme対応中かも @aelmanaa が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
PaloAltoNetworks/docusaurus-openapi-docs#1689 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
solana-foundation/solana-web3.js#4015 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100
ivopogace/opencode-courier#422 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chapel-lang/chapel-vscode#158 ·
メンテナーはふだん 1 日以内に返信