findAll always sends a request to the server


I am running into a weird situation where my model’s findAll store queries are always sending a request to the server even though the data for the specific model should already be cached. This is what I was trying:'devices/lock')

However, I always saw a network request to the server whenever I would navigate to the route that loads this model.

I then found information that findAll will try to do a background refresh of data after initially resolving it if it is already in store. This is not the behavior that I would like to achieve, so I changed my code to the following:'devices/lock', {backgroundReload: false, reload: false})

Unfortunately, this does not seem to work either, the requests are still always sent to the server when I navigate to this route. I have even try to add the following to my RESTAdapter:

shouldReloadRecord: function (store, ticketSnapshot) {
    return false;
shouldBackgroundReloadRecord: function (store, snapshot) {
    return false;

Does anybody know what the issue could be? Any help is greatly appreciated!


Forgot to mention, I am working with Ember 2.0.1 and Ember-Data 2.0.1


Use store.peek and store.peekAll

The conceptual difference between peek and find is that peek will filter records that are already in the store while find will always hit the server.


This sounds like a bug, and I vaguely recall running across this myself. I would open an issue if one already isn’t. For now, you can use the peek methods that @christophermilne mentioned.

Step through this method to see where the problem is:


To change the loading behavior of store.findAll() you can use the shouldReloadAll() and shouldBackgroundReloadAll() hooks.

shouldReloadRecord() and shouldBackgroundReloadRecord() is for the store.findRecord() call.


@christophermilne unfortunately those two methods do not work for me, because I need to get the records once from the server. I could do a findAll and then if exists do a peekAll most likely, but it seems like there should be a better option.

@wecc that worked, thanks! Seems like a hacky solution for just wanting to do this for certain models.

@jasonmit I stepped through that method. It seems like the code should be a little different than it is.

Line 939:

if (adapter.shouldBackgroundReloadAll(this, snapshotArray)) {
  promiseArray(_findAll(adapter, this, typeClass, sinceToken, options));

I feel like there should be a return in there and also the if statement should check if we are disabling background reload from the options. Is this inconsistent with what we expect (I feel like it is) and if so, where should I report this?


Create an issue in ember-data repository to gather feedback.