clintjhill/ember-parse-adapter

Data from belongsTo which is 'included' in the ParseQuery is still loading asynchronously.

omairvaiyani opened this issue · 2 comments

I am trying to get an array of a Parse Class called Test which has a property called category: a pointer to the Category Class. I get this array of Test using the following code:

this.store.findQuery('test', {
            where: JSON.stringify(query),
            include: "category",
            order: "title"});

It returns everything perfectly fine with the category object loaded into each Test object.

However, looking at my developer's console, I can see that Ember makes a network call to Parse every time I do:

test.get('category');

In my Test Model class, I have set the category attribute as this:

export default DS.Model.extend(ParseMixin, {
           category: DS.belongsTo('category', {async: false})
});

This is causing me problems with my logic as I need the test.get('category') call to be synchronous. Any ideas where I might be going wrong? I've only started learning Ember a few weeks ago and starting learning how to code just over a year ago so bare with me please.

Did you make any progress on this? I am seeing the same behavior and I can't find anywhere in the code that is set up to properly handle detecting included items (I of course could have missed it)...

Included items are sometimes stored in record._data but it's definitely not reliable enough for widespread use. I'd say we'll have to stick with async loading until Ember 2.0 and a stable Ember-Data library is released before putting time into fixing the adapter.