ContentPicker SortableList logs a useSelect unstable value warning
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 42/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- react, typescript, wordpress
調査の方向性
Start in components/content-picker/SortableList.tsx, where the useSelect selector builds a new object per picked item and passes a new { _fields, context } query to getEntityRecord. Reproduce with globalThis.SCRIPT_DEBUG set to true, two core-store users, and mode="user", then check the console for the unstable-value warning. Done when the selector returns stable values and the warning no longer appears.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
When the editor runs with SCRIPT_DEBUG set to true, ContentPicker logs this warning after the picked items load:
The `useSelect` hook returns different values when called with the same state and parameters.
This can lead to unnecessary re-renders and performance issues if not fixed.
The useSelect selector in components/content-picker/SortableList.tsx causes the warning:
- The selector builds a new item object for each picked item on each call (
posts.reduce(...)). - The selector passes a new
{ _fields, context }query object togetEntityRecordon each call. With_fieldsin the query,getEntityRecordreturns a filtered copy of the record. The selector cache uses the query object as a key, so a new query object gives a new copy.
Steps to Reproduce
- Set
globalThis.SCRIPT_DEBUGtotrue.useSelectchecks for unstable return values only in this mode. - Put two records in the
corestore, for example two users. - Render
SortableListwithmode="user"and the two users asposts. - The
useSelectwarning shows in the console. The non-equal value keys are theuuidvalues of the picked items.
Expected behavior
The selector returns stable values, and ContentPicker logs no useSelect warning.
Environment information
@10up/block-components1.23.0 anddevelop
- 主要言語
- TypeScript
- スター
- 330
- フォーク
- 54
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
10up/block-components のほかの issue
-
Repeater with allowReordering logs React key and isDragging warnings対応中かも @s3rgiosan が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
10up/block-components#419 · コメント 1 件 ·
-
Subpath bundles duplicate PostContext, and the root import can't be tree-shaken対応中かも @fabiankaegy が 19 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
10up/block-components#417 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
10up/block-components#413 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
10up/block-components#412 ·
-
ContentPicker: invalid html対応中かも @s3rgiosan が 5 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
10up/block-components#400 ·
10up/block-components の issue をすべて見る
似ている issue
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keys対応中かも @pcbeingused333 が今日担当しました。 オープンBug db: d1-sqlite Payload OSS
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
payloadcms/payload#19766 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
device-management-toolkit/sample-web-ui#3711 ·
メンテナーはふだん 1 日以内に返信
-
bug impact:low Team: SecuritySolution Team:Defend Workflows v9.6.0
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
elastic/kibana#306401 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
agentes-chat/agentes-chat#927 ·
メンテナーはふだん 1 日以内に返信
-
Closing a pinned tab jumps to the Tabs section instead of the next open pinned tab対応中かも @seenimohamed が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ardia-browser/ardia#2769 ·
メンテナーはふだん 1 日以内に返信