Hi All,
StackOverflow doesn’t seem to be much help and I’m looking to perhaps stir up some conversation around the best way to work around this issue. Relavant Issues and SO’s at the bottom of this post.
I have a list view and a detail view. The models being displayed are fairly large and take a while to gather from the server. Luckily, I can slim them down to only send partial information. This dramatically speeds up the retrieval of data.
The main issue I have stems from displaying a list and a detail in the same view, much like gmail’s mobile app or @tom’s youtube video…
If I reload at the detail view ember will fire off two calls:
- To
/models/:model_id
to retrieve the full details of the model - To the slimmed list view api call, say,
/models?slim_all=true
If 2
returns before 1
there are no issues, as 1
overwrites the partial model with a full model. However, if the opposite happens 2
will overwrite 1
and ember will update my handlebars to show an mostly empty model.
This problem doesn’t exist if the user starts from the list view as I call model.reload();
when the detail route is called.
Option 1: Create two sets of models. One for list and one for detail. However this isn’t ideal because you lose the performance benefits of passing the model from list view to detail view
Option 2: I’m not sure…
Unanswered SO: ember.js - Dynamically fill models with more detailed data in emberjs - Stack Overflow
Unanswered SO: ember.js - Handle partial or summary object list returned by GET /models using ember-data - Stack Overflow
Closed github issue: https://github.com/emberjs/data/issues/51