Skip to content

[kumo] stabilize Select object-map items - #764

Open
ftzi wants to merge 1 commit into
cloudflare:mainfrom
ftzi:fix/select-object-items-stability
Open

[kumo] stabilize Select object-map items#764
ftzi wants to merge 1 commit into
cloudflare:mainfrom
ftzi:fix/select-object-items-stability

Conversation

@ftzi

@ftzi ftzi commented Aug 31, 2026

Copy link
Copy Markdown

Issue

Select's documented object-map items form normalizes to a new array on every render, so equivalent parent rerenders can trigger redundant Base UI item-store updates and SelectValue renders.

A focused regression on current main rerendered the documented inline object-map pattern with unchanged entries. React Profiler recorded two commits before the fix—the parent rerender and a Base UI subscriber update—and one afterward. A consumer reproduction also surfaced the redundant updates as React act warnings during async parent rerenders; using a stable array avoided them.

Base UI compares items by identity, while Kumo's Object.entries(...).map(...) normalization changes that identity each render.

Solution

  • Reuse the previous normalized object-map array when an ordered, shallow comparison of selection values, labels, and disabled metadata matches.
  • Preserve caller-provided array identity and propagate selection value, label, order, and disabled changes.
  • Add focused regression tests and a patch changeset for @cloudflare/kumo.

Validation

  • pnpm test (52 files, 1,281 tests) and pnpm test:ci (9 tests)
  • pnpm format:check, pnpm lint, pnpm typecheck, and pnpm ci:typecheck
  • Kumo build and package validation, pnpm lockfile-check, and changeset validation

Limit

Normalization intentionally compares labels with Object.is; a newly created React element used as a label is treated as changed.

AI disclosure

This change and pull request description were prepared by an AI coding agent at the contributor's direction.


  • Reviews
    • bonk has reviewed the change
    • automated review not possible because: bonk review requires invocation by a repository collaborator
  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant