Skip to content

fix(material-experimental/chips): fix empty check when no chips #20025

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
Jul 17, 2020

Conversation

andrewseguin
Copy link
Contributor

Similar check that was necessitated from PR #10466 - due to changes in the change detection cycle from input, its possible that empty is called earlier and should account for when there are no chips picked up yet

@andrewseguin andrewseguin requested a review from mmalerba as a code owner July 17, 2020 13:51
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 17, 2020
@andrewseguin andrewseguin added P2 The issue is important to a large percentage of users, with a workaround and removed cla: yes PR author has agreed to Google's Contributor License Agreement labels Jul 17, 2020
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 17, 2020
@andrewseguin andrewseguin requested a review from crisbeto July 17, 2020 13:51
@andrewseguin andrewseguin added the target: patch This PR is targeted for the next patch release label Jul 17, 2020
@@ -154,7 +154,7 @@ export class MatChipGrid extends _MatChipGridMixinBase implements AfterContentIn
* Implemented as part of MatFormFieldControl.
* @docs-private
*/
get empty(): boolean { return this._chipInput.empty && this._chips.length === 0; }
get empty(): boolean { return this._chipInput.empty && (!this._chips || this._chips.length === 0); }
Copy link
Member

Choose a reason for hiding this comment

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

Should we null check for the _chipInput too? AFAIK it's not guaranteed to be defined either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably should - just wasn't an issue internally. I added a change to include that too

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 lgtm action: merge The PR is ready for merge by the caretaker labels Jul 17, 2020
@andrewseguin andrewseguin merged commit ebda4de into angular:master Jul 17, 2020
andrewseguin added a commit that referenced this pull request Jul 17, 2020
* fix(material-experimental/chips): fix empty check when no chips

* same for chipset

* check for input too

(cherry picked from commit ebda4de)
ngwattcos pushed a commit to ngwattcos/components that referenced this pull request Jul 20, 2020
…lar#20025)

* fix(material-experimental/chips): fix empty check when no chips

* same for chipset

* check for input too
@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 17, 2020
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 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.

3 participants