Skip to content

fix(cdk/collections): add ability to bulk select/deselect values#33469

Open
crisbeto wants to merge 1 commit into
angular:mainfrom
crisbeto:33466/bulk-select
Open

fix(cdk/collections): add ability to bulk select/deselect values#33469
crisbeto wants to merge 1 commit into
angular:mainfrom
crisbeto:33466/bulk-select

Conversation

@crisbeto

@crisbeto crisbeto commented Jul 1, 2026

Copy link
Copy Markdown
Member

Currently the selection model expects values to be spread into the select, deselect and setSelection methods. This works fine for single values, but can cause an error if the user tries to spread a huge array, because it can hit browser limitations.

These changes expose a .bulk member on the list that accepts arrays instead of spreads. We need to do it this way, rather than add an array signature to the existing methods, because the selection model might be working with arrays already and we'd have no way of distinguishing them.

Fixes #33466.

Currently the selection model expects values to be spread into the `select`, `deselect` and `setSelection` methods. This works fine for single values, but can cause an error if the user tries to spread a huge array, because it can hit browser limitations.

These changes expose a `.bulk` member on the list that accepts arrays instead of spreads. We need to do it this way, rather than add an array signature to the existing methods, because the selection model might be working with arrays already and we'd have no way of distinguishing them.

Fixes angular#33466.
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Jul 1, 2026
@pullapprove pullapprove Bot requested review from andrewseguin and tjshiu July 1, 2026 07:42
@crisbeto crisbeto requested a review from ok7sai July 1, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: cdk/collections target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(selection-model): SelectionModel.setSelection() throws RangeError on large arrays (spreads values as call args)

2 participants