Skip to content

ContentPicker SortableList logs a useSelect unstable value warning #421

Open

Description

@s3rgiosan

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:

  1. The selector builds a new item object for each picked item on each call (posts.reduce(...)).
  2. The selector passes a new { _fields, context } query object to getEntityRecord on each call. With _fields in the query, getEntityRecord returns 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

  1. Set globalThis.SCRIPT_DEBUG to true. useSelect checks for unstable return values only in this mode.
  2. Put two records in the core store, for example two users.
  3. Render SortableList with mode="user" and the two users as posts.
  4. The useSelect warning shows in the console. The non-equal value keys are the uuid values of the picked items.

Expected behavior

The selector returns stable values, and ContentPicker logs no useSelect warning.

Environment information

  • @10up/block-components 1.23.0 and develop

Activity

  1. s3rgiosan commented on Nov 14, 2026

    @s3rgiosan
    MemberAuthor

    @fabiankaegy for visibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions