reduceComputed dependent keys may refer to @self.#3365
reduceComputed dependent keys may refer to @self.#3365wagenet merged 2 commits intoemberjs:masterfrom
Conversation
|
This feature does not directly resolve #2717 but it seems reasonable to close that issue after this PR is merged if we plan to deprecate @wagenet @joefiorini @drogus @sly7-7 thoughts? |
|
👍 ❤️ |
|
I agree concerning #2717, looking at the tests, it seems like it's a good workaround for now. And I'm 👍 if we could remove the SortableMixin :) |
|
@hjdivad I am wondering if at some point we could build a mixins system based on your work? For ArrayControllers Mixins approach is more elegant I think. |
|
My main concern is that everywhere I was using |
|
Maybe the current SortableMixin could be refactored to be sugar for reduce CPs? Sent from Mailbox for iPhone On Mon, Sep 9, 2013 at 8:58 AM, Paul Chavard notifications@github.com
|
|
I think we'd do what @lukemelia is suggesting. We can't drop the existing functionality, but we can change the internals. |
|
@wagenet I think it is not only about can we drop but also about should we drop |
|
It seems like it may be feasible to have |
SortableMixin = Em.Mixin.create({
arrangedContent: Em.computed.sort('content', 'sortProperties')
})I am not certain either way. I don't have time to look into it right now, but you could try the above and it might actually work. |
|
I'd love for someone to investigate this. It would be great to make |
SortableMixin = Em.Mixin.create({
arrangedContent: Em.computed.sort('@self', 'sortProperties')
})
|
@self. This is mostly useful for array proxies, and in particular array controllers that use item controllers. This allows users to, for instance, sort items according to properties specified on array controllers. @self is implemented only in reduceComputed because it doesn't really make sense for non-reduceComputed CPs. Thanks to @tchak for pointing out the need for this.
|
This looks good to me. Need to double check the flagging setup before I merge. |
reduceComputed dependent keys may refer to @self.
|
I suppose I would be +1 on The idea of just omitting first argument to refer to |
|
@tchak we could separately have Having no dependent args be equivalent to |
|
I've tried to use this to exclude newly created models from a list, but it seems like this computed property fires before What are your thoughts on this? |
|
@sandstrom jsfiddle? |
|
(Here is a partially working fiddle, perhaps someone can spot the mistake I did when porting my code into a fiddle, because the existing cat should show in both lists, but new cats only in the non-filtered one). |
|
@sandstrom I'm not sure if I understand well this PR after all, but i think in your case you must use 'content', not @self (because there are no itemController. see http://jsfiddle.net/C2zTh/2/ |
This is mostly useful for array proxies, and in particular array
controllers that use item controllers. This allows users to, for
instance, sort items according to properties specified on array
controllers.
@self is implemented only in reduceComputed because it doesn't really make
sense for non-reduceComputed CPs.
@tchak does this PR resolve your use case?