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

Using filterBy on PromiseManyArray doesn’t work as expected with Glimmer #4046

Closed
jgwhite opened this issue Jan 5, 2016 · 15 comments
Closed

Comments

@jgwhite
Copy link
Contributor

jgwhite commented Jan 5, 2016

Computed properties that filter a PromiseManyArray don’t re-render as expected when used in templates. See reproduction below:

https://ember-twiddle.com/7e5df2d56a3f78f18e25?numColumns=1&openFiles=application.controller.js%2C

Apologies for the lack of detail — still digging into exactly what’s going wrong here.

@HeroicEric
Copy link
Member

I think it has to do with your not updating the other side of the relationship.

If you check out https://ember-twiddle.com/bc20d9b69cf1229b0bc5?numColumns=3&openFiles=application.controller.js%2Capplication.template.hbs%2Capplication.route.js,
the rerender seems to work when the favourites change.

I agree though, that this behavior is confusing. Even more confusing that it seems to work on the initial render...

@sly7-7
Copy link
Contributor

sly7-7 commented Jan 6, 2016

@jgwhite
Copy link
Contributor Author

jgwhite commented Jan 6, 2016

@sly7-7 thanks, that’s a good tip. Still, it seems like this shouldn’t require any workarounds. ManyArray works just fine.

@sly7-7
Copy link
Contributor

sly7-7 commented Jan 6, 2016

Hmm, alos see, https://ember-twiddle.com/7e5df2d56a3f78f18e25?openFiles=application.controller.js%2Capplication.route.js, using ember 2.0.2, it is working well...

@jgwhite
Copy link
Contributor Author

jgwhite commented Jan 6, 2016

@sly7-7 hmm… perhaps a change in the contract for observing enumerables?

@sly7-7
Copy link
Contributor

sly7-7 commented Jan 6, 2016

Yeah, it seems like there is also some issues with ember itself (see the referenced issue), but clearly difficult to find out the root cause

@jgwhite
Copy link
Contributor Author

jgwhite commented Jan 6, 2016

This appears to be a problem in computed.filterBy. Closing this issue in favour of emberjs/ember.js#12475

@jgwhite jgwhite closed this as completed Jan 6, 2016
@runspired
Copy link
Contributor

@jgwhite I believe you have closed this prematurely, I still believe this is an ED bug, emberjs/ember.js#12475 (comment)

@jgwhite
Copy link
Contributor Author

jgwhite commented Jan 6, 2016

@runspired thanks for investigating further. Re-opening.

@jgwhite jgwhite reopened this Jan 6, 2016
@fivetanley
Copy link
Member

I don't think replace in ManyArray is following the rules for Ember.Array. It's supposed to set length.

replace(idx, amt, objects) {

https://github.com/emberjs/ember.js/blob/8d62be51ce9602ce6f3aa05682a2847af8b5dc7a/packages/ember-runtime/lib/mixins/array.js#L95

@adam-knights
Copy link
Contributor

@fivetanley would setting length and calling that method be relatively straight forward single line things that ember data should be doing? Could these things be causing emberjs/ember.js#12475 ?

@runspired
Copy link
Contributor

@adam-knights my opinion from the feedback/investigation that I've done is that emberjs/ember.js#12475 is mostly if not entirely related to ED code issues that either originated around the time of Ember 2.0 or were pre-existing issues surfaced by changes in Ember around then.

@Serabe
Copy link
Member

Serabe commented Jan 11, 2016

Investigating another issue in balinterdi/rarwe-code I see it happens with computed.sort as well.

Twiddle

@sly7-7
Copy link
Contributor

sly7-7 commented Feb 11, 2016

I'm closing, emberjs/ember.js#12908 seems to fix all the things. I just tried the twiddles with ember & ember-data canary, they are working well.

@jgwhite Could you confirm please, and reopen if it does not fix your case ?

@sly7-7 sly7-7 closed this as completed Feb 11, 2016
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

7 participants