ContentPicker SortableList logs a useSelect unstable value warning
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript, wordpress
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- TypeScript
- Stelle
- 330
- Fork
- 54
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di 10up/block-components
-
Repeater with allowReordering logs React key and isDragging warningsForse già presa @s3rgiosan l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
10up/block-components#419 · 1 commento ·
-
Subpath bundles duplicate PostContext, and the root import can't be tree-shakenForse già presa @fabiankaegy l’ha presa 19 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
10up/block-components#417 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
10up/block-components#413 ·
-
Upgrading to React 19Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
10up/block-components#412 ·
-
ContentPicker: invalid htmlForse già presa @s3rgiosan l’ha presa 5 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
10up/block-components#400 ·
Tutte le issue di 10up/block-components
Issue simili
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keysForse già presa @pcbeingused333 l’ha presa oggi. ApertaBug db: d1-sqlite Payload OSS
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
payloadcms/payload#19766 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
device-management-toolkit/sample-web-ui#3711 ·
I maintainer di solito rispondono entro 1 giorno
-
bug impact:low Team: SecuritySolution Team:Defend Workflows v9.6.0
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
elastic/kibana#306401 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
agentes-chat/agentes-chat#927 ·
I maintainer di solito rispondono entro 1 giorno
-
Closing a pinned tab jumps to the Tabs section instead of the next open pinned tabForse già presa @seenimohamed l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ardia-browser/ardia#2769 ·
I maintainer di solito rispondono entro 1 giorno