Why does Ember Data sometimes have ObjectProxy or ArrayProxy?


#1

I have an Address model that is like this:

addressable: DS.belongsTo('addressable', { polymorphic: true }),
country: DS.belongsTo('country', {async: false}),
region: DS.belongsTo('region', {async: false}),

Here, addressable is accessed via an ObjectProxy. But region and country are not accessed via ObjectProxy. I am pre-loading all countries and US-regions via meta tag. Is pre-loading the reason why the two models do not have ObjectProxy generated for them?

Thank you.


#2

Ember Data lazy loading related objects and chache them through entire application even after route changed. If you already fetched your country and region models them Ember data don’t need fetch it again. Object proxy or Array proxy are a wrapper that atomatic fetch data when you first access it. You should check data cached.

https://guides.emberjs.com/v2.5.0/ember-inspector/data/

Ember do that to avoid high network traffic