lundi 14 mars 2016

In Ember Data force a route to always reload the children of a model

Since Ember data 1.13 it has been easy to force a route to reload its model, you use the reload: true option:

model(params) {
  return this.store.findRecord('order', params.order_id, { reload: true });
},

This is fine, and now I know my order is up to date. But what about children of the order. Say an order has order items. How do I force those to reload from the server too? I'm looking for code that will hit the api once per order item - whether hitting this route cleanly, without having seen those order items before, or when getting to the route, having seen those order items before.

I'm thinking after model hook but didn't know best practice here..

Aucun commentaire:

Enregistrer un commentaire