Skip to content
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

fix(selection-list): remove selected option from model value on destroy #9106

Merged
merged 1 commit into from
Jan 4, 2018

Conversation

crisbeto
Copy link
Member

Fixes selected options that are removed from the DOM not being removed from the model.

Relates to #9104.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 22, 2017
@crisbeto crisbeto changed the title fix(selection-list): remove selection list from model value on destroy fix(selection-list): remove selected option from model value on destroy Dec 22, 2017
@crisbeto crisbeto force-pushed the selection-list-selected-destroy branch from bbb11a6 to 473890b Compare December 22, 2017 20:45
// to avoid changed after checked errors.
Promise.resolve().then(() => {
this._setSelected(false);
this.selectionList._reportValueChange();
Copy link
Member

Choose a reason for hiding this comment

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

How about moving that into a single line and just doing this.selected = false?

Copy link
Member Author

Choose a reason for hiding this comment

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

That feels a little side-effect-ey since we're basically using a property as a method.

Copy link
Member

@devversion devversion Dec 22, 2017

Choose a reason for hiding this comment

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

Why is that? I think the setter's main intention is to update the internal state and reflect it within in the model. Otherwise the setter wouldn't be needed at all.

Promise.resolve().then(() => this.selected = false);

Copy link
Member Author

Choose a reason for hiding this comment

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

True, although I think of it mostly if you're setting it from the outside. That being said it does avoid having to duplicate some of the logic. I've switched it.

Fixes selected options that are removed from the DOM not being removed from the model.

Relates to angular#9104.
@crisbeto crisbeto force-pushed the selection-list-selected-destroy branch from 473890b to 4fdb546 Compare December 23, 2017 14:43
@devversion devversion added pr: lgtm action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release and removed pr: needs review labels Dec 24, 2017
@jelbourn jelbourn merged commit f8cd8eb into angular:master Jan 4, 2018
jelbourn pushed a commit to jelbourn/components that referenced this pull request Jan 8, 2018
…oy (angular#9106)

Fixes selected options that are removed from the DOM not being removed from the model.

Relates to angular#9104.
jelbourn pushed a commit to jelbourn/components that referenced this pull request Jan 9, 2018
…oy (angular#9106)

Fixes selected options that are removed from the DOM not being removed from the model.

Relates to angular#9104.
jelbourn pushed a commit that referenced this pull request Jan 9, 2018
…oy (#9106)

Fixes selected options that are removed from the DOM not being removed from the model.

Relates to #9104.
tinayuangao pushed a commit that referenced this pull request Jan 10, 2018
…oy (#9106)

Fixes selected options that are removed from the DOM not being removed from the model.

Relates to #9104.
@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.

4 participants