jeudi 14 janvier 2016

query ember-data store not cached when using query

In the /photos route of my ember-app I can see that if I use the query function, the records does not come from local indexedDB:

the route has a loading template with a spinner;

if in the route I do:

model: function() {
    return this.store.findAll('photo');
}

the record are loaded only the first time; I see the spinner for a while and then the photo are shown; if I go on another route and then back to the photos route, the spinner is not shown, the data are taken from local indexedDB and a new request to the REST api is done in background;

but if I do

model: function() {
    return this.store.query('photo', {}});
}

I see the spinner not only the first time but every time I open the route; so I guess the data is fetched again




Aucun commentaire:

Enregistrer un commentaire