Skip to content

fix(form-field): run change detection when prefix or suffix changes #10670

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

Merged
merged 3 commits into from
Apr 5, 2018

Conversation

mmalerba
Copy link
Contributor

@mmalerba mmalerba commented Apr 2, 2018

fixes #8988

@mmalerba mmalerba requested a review from crisbeto April 2, 2018 22:54
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 2, 2018
@mmalerba mmalerba added the target: patch This PR is targeted for the next patch release label Apr 2, 2018
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

Is it possible to unit test this one?

@@ -266,6 +266,11 @@ export class MatFormField extends _MatFormFieldMixinBase
this._changeDetectorRef.markForCheck();
});

// Run change detection if the prefix or suffix changes.
merge(this._prefixChildren.changes, this._suffixChildren.changes).subscribe(() => {
Copy link
Member

Choose a reason for hiding this comment

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

You should be able to combine these with the ngControl.valueChanges subscription from above.

@mmalerba
Copy link
Contributor Author

mmalerba commented Apr 3, 2018

I tried to make a test for it, but I had trouble getting the test to fail for the existing code. It seemed like calling fixture.detectChanges() was updating it correctly while real change detection was not

Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

LGTM

@crisbeto crisbeto added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Apr 3, 2018
@googlebot googlebot added cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla and removed cla: yes PR author has agreed to Google's Contributor License Agreement labels Apr 5, 2018
@jelbourn jelbourn added cla: yes PR author has agreed to Google's Contributor License Agreement and removed cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla labels Apr 5, 2018
@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

@angular angular deleted a comment from googlebot Apr 5, 2018
@jelbourn jelbourn merged commit 515cc06 into angular:master Apr 5, 2018
Longfld pushed a commit to Longfld/material2 that referenced this pull request Apr 6, 2018
@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 8, 2019
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 target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Input] Suffix wrapper not removed with ngIf
4 participants