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

Selecting mat-option which has no value set fires valueChange and selectionChange events twice. #12267

Closed
danfan1 opened this issue Jul 18, 2018 · 4 comments

Comments

@danfan1
Copy link

danfan1 commented Jul 18, 2018

Bug, feature request, or proposal: Bug

What is the expected behavior?

When a mat-option with no value set, the event valueChange and selectionChange events are fired once.

What is the current behavior?

Those two events are fired twice.

What are the steps to reproduce?

https://angular-e2cc3n.stackblitz.io
Select the first option, which has no value set, and look at the console log, you will see the two events are fired twice.

What is the use-case or motivation for changing an existing behavior?

In some use cases, some XHRs are triggered by responding to these events. When the event is fired twice, the XHRs is triggered twice, which may have unexpected effect.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Material 6.3.3

Is there anything else we should know?

@crisbeto
Copy link
Member

Duplicate of #10675.

@danfan1
Copy link
Author

danfan1 commented Jul 18, 2018

This is not exactly the same as #10675.
#10675 is about when the option is selected the second time, change event is fired, but shouldn't.
This bug is about when the option is selected the first time, change event is fired twice, but should be fired only once.

@crisbeto
Copy link
Member

I think the fix should cover both cases, otherwise we can reopen this one.

@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants