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

[BUG] arrayComputed does not recalculate after dependant array is set #5319

Closed
wongpeiyi opened this issue Aug 4, 2014 · 6 comments
Closed

Comments

@wongpeiyi
Copy link

Here is a failing test case: http://jsbin.com/dohavimi/1/edit?html,js,console

Basically, computed.filterBy or computed.filter fails to recompute synchronously after its dependant array is set. An explicitly defined computed property works, so it looks like an arrayComputed issue. It works if their values are not cached (if you remove the prior gets). It also works if I use pushObjects instead of set.

Am I wrong to assume the computed properties should recalculate synchronously before the final gets?

@mmun
Copy link
Member

mmun commented Aug 4, 2014

The recalculation of ArrayComputed doesn't have the same semantics as ComputedProperty. computed.filter and computed.sort schedule their recalculation on the run loop. Your example will work if you put the gets in another Ember.run.next.

@wagenet
Copy link
Member

wagenet commented Aug 6, 2014

@mmun do you think we can fix this? or should we just close?

@drogus
Copy link
Contributor

drogus commented Sep 21, 2014

The recalculation that @mmun mentions happens here. It seems that it could be removed once compound dependent keys, which are mentioned in #5268, are implemented.

@wagenet
Copy link
Member

wagenet commented Nov 1, 2014

@mmun ping.

@wagenet wagenet added the Bug label Nov 1, 2014
@mmun
Copy link
Member

mmun commented Nov 1, 2014

@ef4 do you have any thoughts on this matter?

@ef4
Copy link
Contributor

ef4 commented Nov 3, 2014

This behavior is definitely undesirable. Ideally we would separate the invalidation step from the recomputation step. That's how scalar computed properties work.

stefanpenner added a commit that referenced this issue Jun 23, 2015
#9492, #5319, #5268, #4831] Move away from AC/RC instead use the simpler naive enumerable methods, and rely on glimmers stable rendering for efficiency.

For more complex scenarios, custom solutions should be used.

@wagenet & @stefanpenner
stefanpenner added a commit to stefanpenner/ember.js that referenced this issue Jun 26, 2015
…rjs#9462, emberjs#4919, emberjs#4231, emberjs#3706, emberjs#5596, emberjs#9485, emberjs#9492, emberjs#5319, emberjs#5268, emberjs#4831, emberjs#5558] Move away from AC/RC instead use the simpler naive enumerable methods, and rely on glimmers stable rendering for efficiency.

For more complex scenarios, custom solutions should be used.

@wagenet & @stefanpenner
stefanpenner added a commit that referenced this issue Jun 28, 2015
#5596, #9485, #9492, #5319, #5268, #4831, #5558] Move away from AC/RC instead use the simpler naive enumerable methods, and rely on glimmers stable rendering for efficiency.

For more complex scenarios, custom solutions should be used.

@wagenet & @stefanpenner

(cherry picked from commit 0dc1a6c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants