In my app, I want to show a list of all items fetched via store.findAll('record')
. This works nicely, and it shows local records immediately, and then does a background reload and populates the list with the new items.
I would now like to show a loading spinner while the fetching is not complete. However, isPending
is set to true when the promise resolves, which is way before findAll has actually completed. Is there a way to check if a findAll
call is complete? I tried to find something in the docs, but couldn’t find anything.
Simplified, this is what I want to do:
// my-component.js
allRecords: Ember.computed(function() {
return this.get('store').findAll('record');
})
{{#if allRecords.isPending}}
Still fetching data...
{{/if}}
{{#each allRecords as |record|}}
{{record.name}}
{{/each}}