Async loading. Relations' initialization


#1

Hi everybody,

I have a général question about async feature. Let’s say I have a model like (just relationships are shown):

model A

hasMany B, async

hasMany C, async

model B

hasMany C, async

model C

The relationship A -> C is as follows: it includes all the C of each B related but can have some extra C that are not in any B related.

And let’s say wa have loaded an A with all the B related. Now the user wants to view C related to a B or to the A. So to load C asynchronousely I have two choices:

  1. iterate throuh B and load all the C of each B and then to load all the C related to A. This is not very performant but is a possible scenario of extreme asynchronosity: perhaps the user would like to see just C of some B.
  2. load all the C related to A which will ensure that all the C related to all the B will be loaded as well.

My question is about the 2d scenario. What happens with B -> C if I load A -> C in afterModel (emberjs):

  1. In the identity map (or session or I do not know how to call it) of ember-data.
  2. With the snapshots of B -> C that are actually in the route’s model.

Hope it is clear enough and thank you for your time