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

Ember.computed.sort doesn't update when live RecordArray updates. #12516

Closed
bravo585 opened this issue Oct 23, 2015 · 3 comments
Closed

Ember.computed.sort doesn't update when live RecordArray updates. #12516

bravo585 opened this issue Oct 23, 2015 · 3 comments

Comments

@bravo585
Copy link

I just upgraded from Ember 1.13 to Ember 2.1. I noticed Ember.computed.sort no longer updates if a live RecordArray updates.

For example, if I have:

users: Ember.computed(function() {
  return this.store.filter('user', {filter: {'is-active': true}}, function(record) {
    return record.get('isActive');
  })
}),

sortLastName: ['lastName:asc', 'firstName:asc'],
usersSorted: Ember.computed.sort('users', 'sortLastName'),

And I print out:

{{#each usersSorted as |user|}}
  {{user.lastName}}, {{user.firstName}}
{{/each}}

If I add a new user, the users list will update, but the usersSorted list will not.

@g-cassie
Copy link

I think this is the same as #12475

@pixelhandler
Copy link
Contributor

@bravo585 would you be able to create an example using jsbin, jsfiddle, or ember-twiddle? Perhaps instead of store.filter return a promise with the content as a RecordArray

@workmanw
Copy link

workmanw commented Nov 6, 2015

Actually this might be related to #12212 since it happened after upgrading to 2.x. Is your Ember.computed.sort in a component or other control that has multiple active instances at the same time?

If it is related to #12212 ... you could try using my addon ember-computed-sortby.

mmun added a commit to mmun/ember.js that referenced this issue Feb 21, 2016
Resolves a regression in `Ember.computed.sort` that has existed since
2.0.0. The regression occurred when there were multiple instances of a
class using `Ember.computed.sort` and caused the sorted value to stop
updating.

Closes emberjs#12212.
Closes emberjs#12215.
Closes emberjs#12221.
Closes emberjs#12516.
rwjblue pushed a commit that referenced this issue Feb 21, 2016
Resolves a regression in `Ember.computed.sort` that has existed since
2.0.0. The regression occurred when there were multiple instances of a
class using `Ember.computed.sort` and caused the sorted value to stop
updating.

Closes #12212.
Closes #12215.
Closes #12221.
Closes #12516.

(cherry picked from commit f05bd2d)
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

4 participants