-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BUGFIX beta] Ember.computed.sort Observers #5150
Conversation
ping @hjdivad for review |
In current master, the observer being added whenever This latest commit I believe addresses the issues with both the property and each observers. Noew, when I am not sure how to write a test to ensure the |
please add tests |
@mmpestorich ping. |
This commit ensures that observers are only added once to the sortPropertyDefinitions as they change.
@wagenet @stefanpenner Added tests that fail in master with the behavior illustrated in the jsbins above; the tests pass with this commit. |
@mmpestorich awesome thank you. I am unfortunately traveling, @hjdivad could use your eyes on this one! |
See also #9462 |
Thank you for your contribution, unfortunately this PR is no longer applicable. As ember has deprecated (and removed support for) array computed/ reduce computed. Luckily, going forward glimmer handles efficient diffing for us, so the faster and naive resort/refilter the collection approach is sufficient. As a bonus it is also less complicated and without the same bugs. |
This commit ensures that observers are only added once 'sortPropertyDefinitions:change'.
Currently whenever the sortPropertyDefinitions change and the computed property is recomputed duplicate observers are being added for this property. This eventually causes performance issues if the sortPropertyDefinitions change frequently as illustrated here: http://jsbin.com/tutoni/2/edit