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

Chained Ember.computed.filterBy properties fail for updated records #2190

Closed
webmonarch opened this issue Aug 16, 2014 · 9 comments
Closed

Comments

@webmonarch
Copy link

I have a controller that has two Ember.computed.filterBy properties. One depends on the output of the other. I've noticed that when data gets pushed in the store what changes the value that there filters operate on, I get incorrect results. If I manually code a computed property that delegates to Enumerable.filterBy it works as expected.

I've created a jsbin:

http://emberjs.jsbin.com/fesofu/5/edit

TO USE: click the tasks listed....I expect the two "Completed" counts to be the same. The "manually" computed value is correct but the other is incorrect.

@igorT
Copy link
Member

igorT commented Aug 16, 2014

cc @hjdivad

@webmonarch
Copy link
Author

FWIW this issue is still in the latest beta 9.

I updated the jsbin: http://emberjs.jsbin.com/fesofu/8/edit

@sly7-7
Copy link
Contributor

sly7-7 commented Sep 3, 2014

A first weird thing is if you use toggleProperty instead of push, it seems to work. see http://emberjs.jsbin.com/qexova/1/edit
A second weird thing is, in your example, if you click a second time on a task, then it appears in the 'automatic' filter. It's like it has the inverse value of completed.

@webmonarch
Copy link
Author

@sly7-7 yeah, any changes that happen locally either through a property set or toggleProperty as mentioned works fine.

The reason my example uses Store.push is because it is what the ember-data adapter I am using (https://github.com/firebase/emberfire) does internally on remote updates to the data: https://github.com/firebase/emberfire/blob/b1fa49841642bc143e34f35fe7d38206f391faa3/src/data.js#L243

Yeah, I don't understand the behavior of Ember.computed.filterBy in this case...it's kinda the inverse AFTER an item has been toggled.

@wecc
Copy link
Contributor

wecc commented Nov 29, 2014

Probably related to emberjs/ember.js#5319 and emberjs/ember.js#5268

@RichardJohnn
Copy link

aye, I have been replacing Em.computed.filterBy uses with the hand written computed properties to work around this

@sly7-7
Copy link
Contributor

sly7-7 commented Jun 3, 2015

I'm not sure if there is something to do in ember data for that case.
@igorT maybe we can close ?

@igorT
Copy link
Member

igorT commented Jun 3, 2015

I think this will be solved by the reduce computed removal in Ember

@wecc
Copy link
Contributor

wecc commented Sep 16, 2015

This seems fixed by emberjs/ember.js#11513, closing.

@wecc wecc closed this as completed Sep 16, 2015
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

5 participants