Skip to content

fix(select): changed after checked error if selected option label changes #14797

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

Fixes a "changed after checked" error being thrown by mat-select, if the label of the selected mat-option changes.

Also fixes that the trigger value doesn't get updated until the next change detection.

Fixes #14793.

@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Jan 11, 2019
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 11, 2019
@@ -1374,10 +1374,26 @@ describe('MatSelect', () => {

fixture.componentInstance.foods[1].viewValue = 'Calzone';
fixture.detectChanges();
tick();
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: this is only necessary for our assertions to pass, it won't be necessary for people to change their existing tests.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Jan 11, 2019
@alexw10
Copy link

alexw10 commented Feb 12, 2019

Is this going to be checked in soon @crisbeto ? seems to have been ready for awhile.

@HWHofstee
Copy link

@crisberto The process seems to be hanging. What can we do to get it in progress again and get the fix implemented?

@mmalerba mmalerba added aaa and removed aaa labels Apr 25, 2019
@andrewseguin andrewseguin added the P4 A relatively minor issue that is not relevant to core functions label May 30, 2019
@crisbeto crisbeto force-pushed the 14793/select-changed-after-checked branch from 136e963 to bd4c26d Compare July 3, 2019 21:44
@crisbeto crisbeto force-pushed the 14793/select-changed-after-checked branch from bd4c26d to 0db2c92 Compare July 27, 2019 11:29
@crisbeto crisbeto force-pushed the 14793/select-changed-after-checked branch from 0db2c92 to 583237d Compare August 6, 2019 13:34
…nges

Fixes a "changed after checked" error being thrown by `mat-select`, if the label of the selected `mat-option` changes.

Also fixes that the trigger value doesn't get updated until the next change detection.

Fixes angular#14793.
@crisbeto crisbeto force-pushed the 14793/select-changed-after-checked branch from 583237d to ad1618c Compare April 17, 2020 18:52
@mmalerba mmalerba removed the lgtm label Jul 31, 2020
crisbeto added a commit to crisbeto/material2 that referenced this pull request Aug 5, 2021
…nges

Fixes a "changed after checked" error that is thrown if the label of a selected option changes dynamically.

This is alternate approach to angular#14797 which was tricky to land, because it introduced an extra timeout.

Fixes angular#14793.
@crisbeto
Copy link
Member Author

crisbeto commented Aug 5, 2021

Closing in favor of #23315.

@crisbeto crisbeto closed this Aug 5, 2021
crisbeto added a commit to crisbeto/material2 that referenced this pull request Aug 5, 2021
…nges

Fixes a "changed after checked" error that is thrown if the label of a selected option changes dynamically.

This is alternate approach to angular#14797 which was tricky to land, because it introduced an extra timeout.

Fixes angular#14793.
@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 Sep 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P4 A relatively minor issue that is not relevant to core functions target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dynamic change in label of mat-option gives ExpressionChangedAfterItHasBeenCheckedError
7 participants