findAll() strange behavior

Hi all! I have the following computed property in a controller:

ingredients: function() {
    var self = this;
    this.store.findAll('ingredient').then(function() {
        var ingredients = self.get('model').get('ingredientsWithQuantities').map(function(item) {
            return {
                name: self.store.peekRecord('ingredient', item.ingredientId).get('name'), 
                quantity: item.quantity
            };
        });

        self.set('ingredients', ingredients);
    });
}.property('model.ingredientsWithQuantities')

It works fine if ingredients data was loaded earlier or if shouldReloadAll() { return true; } was added to RESTAdapter. But in second case findAll() always make new request to back-end even if data exists in store.

I want to achieve next behavior:

  • when data doesn’t exist in the store - then load data and call ‘then’ function after it
  • when data exists in the store - then take data from cache and just call ‘then’ function

What the best way to implement this?

P.S. I’m using EmberJS 1.13.