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 1.13.10 get('content') vs toArrray() #111

Closed
kielni opened this issue Dec 9, 2015 · 3 comments
Closed

Ember 1.13.10 get('content') vs toArrray() #111

kielni opened this issue Dec 9, 2015 · 3 comments

Comments

@kielni
Copy link

kielni commented Dec 9, 2015

https://github.com/hhff/ember-infinity/blob/master/addon/mixins/route.js#L315 calls newObjects.get('content') to add new objects. But in Ember 1.13.10, this returns an array of InternalModel objects, not model classes.

From emberjs/data#3604, it looks like this should be newObjects.toArray() instead. I don't know the history, so it's hard to tell what that might break. Suggestions?

@kellyselden
Copy link
Collaborator

Good find. It could be updated to do a ember data version check, then do the appropriate action.

@kielni
Copy link
Author

kielni commented Dec 10, 2015

I tried returning newObjects.toArray() and it broke the tests all over:

not ok 3 PhantomJS 1.9 - Acceptance: Infinity Route: it works when embedded route is refreshed
TypeError: 'undefined' is not a function (evaluating 'internalModel.getRecord()')

I saw emberjs/data#3530, and tried return infinityModel.get('content').pushObjects(content); but that broke tests too:

not ok 48 PhantomJS 1.9 - RouteMixin - reaching the end: it uses extra params when loading more data
'undefined' is not an object (evaluating 'infinityModel.get('content').pushObjects')

I don't understand Ember Data internals well enough to tell what should be happening. http://emberjs.com/api/data/classes/DS.RecordArray.html says "The record array materializes records as needed when they are retrieved for the first time.", but that doesn't seem to be happening. Am I missing something obvious for getting this working with 1.13.10?

kielni added a commit to kielni/ember-infinity that referenced this issue Dec 14, 2015
@kielni
Copy link
Author

kielni commented Jan 6, 2016

I upgraded to the 0.2.1 release and now it's working fine (with Ember 1.13.10 and Ember Data 1.13.15)

@kielni kielni closed this as completed Jan 6, 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

2 participants