Skip to content

fix(select): exception when initialized with large amount of options #12517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Aug 3, 2018

Fixes an error being thrown by mat-select when it is initialized with a large amount of pre-selected options. The issue comes from the fact that we add a change listener right before the initial values are assigned rather than afterwards.

Fixes #12504.

@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Aug 3, 2018
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Aug 3, 2018
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@josephperrott josephperrott added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Aug 3, 2018
@Neonides
Copy link

Neonides commented Sep 6, 2018

When can you expect to deploy of this fix?

@dydome
Copy link

dydome commented Sep 7, 2018

Any update?

@ngbot
Copy link

ngbot bot commented Oct 5, 2018

Hi @crisbeto! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@crisbeto crisbeto force-pushed the 12504/select-lots-of-options-error branch from 2a19d34 to 9845966 Compare October 12, 2018 13:43
@crisbeto crisbeto force-pushed the 12504/select-lots-of-options-error branch from 9845966 to 7592bf7 Compare December 13, 2018 17:42
@mmalerba mmalerba added aaa and removed aaa labels Apr 25, 2019
@osipenkom
Copy link

Any updates?

@andrewseguin andrewseguin added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label May 30, 2019
@crisbeto crisbeto force-pushed the 12504/select-lots-of-options-error branch from 7592bf7 to 8f999a0 Compare June 27, 2019 19:10
@crisbeto crisbeto force-pushed the 12504/select-lots-of-options-error branch from 8f999a0 to b75a398 Compare August 22, 2019 19:00
@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround and removed P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Aug 22, 2019
@crisbeto
Copy link
Member Author

I'm bumping this to a P2 since we keep getting reports about it.

@crisbeto crisbeto force-pushed the 12504/select-lots-of-options-error branch from b75a398 to 2597bb9 Compare August 31, 2019 07:22
@crisbeto
Copy link
Member Author

Looks like I rebased this while there were build errors in master. It should be rebased once #16928 gets in.

@crisbeto crisbeto force-pushed the 12504/select-lots-of-options-error branch from 2597bb9 to 0160de0 Compare September 3, 2019 19:20
@ogix
Copy link
Contributor

ogix commented Sep 6, 2019

Any reason not to merge it now? Thanks.
Btw in my case I have a button that selects all the options (~500) in mat-select. After I deselect one of them I get this error. Will this PR fix this case as well?

@andrewseguin
Copy link
Contributor

We are seeing internal failures that seem to be related to using a formControl with preset values. Here's a case that fails due to the trigger not showing the current selected values: https://stackblitz.com/angular/bqeaknagrjy?file=src%2Fapp%2Fselect-reactive-form-example.ts

See this PR for an associated failing test: crisbeto#12

Fixes an error being thrown by `mat-select` when it is initialized with a large amount of pre-selected options. The issue comes from the fact that we add a change listener right before the initial values are assigned rather than afterwards.

Fixes angular#12504.
@crisbeto crisbeto force-pushed the 12504/select-lots-of-options-error branch from 038525b to bf013e7 Compare July 6, 2020 18:32
@andrewseguin andrewseguin removed the action: merge The PR is ready for merge by the caretaker label Jul 6, 2020
@crisbeto
Copy link
Member Author

crisbeto commented Jul 6, 2020

I think the underlying issue was fixed in a better way by #17071 a while ago. I tried running the attached unit test against master and it passes without any of these changes. I'll close the PR for now and we can reconsider it if it shows up again.

@crisbeto crisbeto closed this Jul 6, 2020
@andrewseguin
Copy link
Contributor

Awesome!

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has agreed to Google's Contributor License Agreement P2 The issue is important to a large percentage of users, with a workaround target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[mat-select] Maximum call stack size exceeded in select with 1000+ options
10 participants