ContentPicker SortableList logs a useSelect unstable value warning
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 42/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript, wordpress
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 330
- Forks
- 54
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de 10up/block-components
-
Repeater with allowReordering logs React key and isDragging warningsPosiblemente ocupada @s3rgiosan la tomó hace 5 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
10up/block-components#419 · 1 comentario ·
-
Subpath bundles duplicate PostContext, and the root import can't be tree-shakenPosiblemente ocupada @fabiankaegy la tomó hace 19 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
10up/block-components#417 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
10up/block-components#413 ·
-
Upgrading to React 19Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
10up/block-components#412 ·
-
ContentPicker: invalid htmlPosiblemente ocupada @s3rgiosan la tomó hace 5 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
10up/block-components#400 ·
Todos los issues de 10up/block-components
Issues similares
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keysPosiblemente ocupada @pcbeingused333 la tomó hoy. AbiertoBug db: d1-sqlite Payload OSS
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
payloadcms/payload#19766 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
device-management-toolkit/sample-web-ui#3711 ·
Los mantenedores suelen responder en 1 día
-
bug impact:low Team: SecuritySolution Team:Defend Workflows v9.6.0
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
elastic/kibana#306401 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
agentes-chat/agentes-chat#927 ·
Los mantenedores suelen responder en 1 día
-
Closing a pinned tab jumps to the Tabs section instead of the next open pinned tabPosiblemente ocupada @seenimohamed la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
ardia-browser/ardia#2769 ·
Los mantenedores suelen responder en 1 día