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

Observing select.selected in custom option components #1382

Open
ghost opened this issue Jul 20, 2020 · 2 comments
Open

Observing select.selected in custom option components #1382

ghost opened this issue Jul 20, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Jul 20, 2020

Great add-on!

I'm currently trying to extend the behavior of the grouping mechanism for ember-power-select. In my custom group component, I want to add an observer which watches select.selected for values being added or removed from the array. However, when I add an observer to select.selected (or select.selected.@each or select.selected.[]), it fires on every mouse hover and selection. It's almost as if the selected array is literally recreated over and over again whenever anything happens? Is this the case? How would you suggest I have my group component be aware of when the user selects a new option.

Cheers!

@ghost
Copy link
Author

ghost commented Jul 21, 2020

Update: I noticed that whenever I mouse over any option in the select, didReceiveAttrs fires for the group components. What attributes are changing when I mouse over an option?

@ganapathyHf
Copy link

@justinzelinsky I guess, whenever an option is hovered, it is highlighted. On highlight, updateState method is called which sets the select again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant