Chandler/goflesh

Sideload Users/Players when either them are requested as a single resource or a list

Closed this issue · 1 comments

We basically always want these together, their separation doesn't have much use on the client.

I think player-user is the only situation in our app where sideloading is a just-below-essential need and not just an optimization. Running hundreds of http requests to fetch all the users definitely could be problematic and it's happening right on the game page, which is our main page.

Also, you never know with ember-data so we should verify that this method works as advertised before we really need it.

In the case of requesting players, place a users list right below the root players list in the json and vice versa.

{
"players": [
{
"id": 7,
"user": 254,
"game": 2,
"created": "2013-08-19T02:33:18.358179Z",
"updated": "2013-08-19T02:33:18.358179Z",
"is_human": false
},
. . .
],
"users":[
{
. . .
},
{
. . .
}
]
}

It looks like it might be possible to override/rewrite ember-data's findMany() logic to combine these requests into a single request. I'm still leaning towards sideloading though