Skip to content

Accept ReadonlyArray<T> for items and more in Select#8108

Open
braeden wants to merge 1 commit into
developfrom
braedens/select-readonly-array-props
Open

Accept ReadonlyArray<T> for items and more in Select#8108
braeden wants to merge 1 commit into
developfrom
braedens/select-readonly-array-props

Conversation

@braeden
Copy link
Copy Markdown
Contributor

@braeden braeden commented May 4, 2026

This is extremely common to have to cast asMutableArray before the Select or MultiSelect boundary.

The proposal here is to widen the types of items, selectedItems, filteredItems, and related callback parameters in @blueprintjs/select to accept `ReadonlyArray.

Although the direct items, props are not a breaking change (since it's more widely assignable), it's possible to create a mutating callback that will be a break when encountering ReadonlyArray<T> instead of T[]. See how navigator.tsx got changed.

I think this is still desirable change & aligns closely with semantics of new reference equality -> render that React sticks too.

Widen `items`, `selectedItems`, `filteredItems`, and related callback
parameters in `@blueprintjs/select` to accept `ReadonlyArray<T>` so
consumers can pass readonly arrays without copying.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@changelog-app
Copy link
Copy Markdown

changelog-app Bot commented May 4, 2026

Generate changelog in packages/docs-theme/changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Accept ReadonlyArray<T> for items and more in Select


Generate changelog in packages/select/changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Accept ReadonlyArray<T> for items and more in Select


Check the box to generate changelog(s)

  • Generate changelog entry

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