My backend gathers all data and returns them in the one response. I have these data properly imported into store and I’m using combination of periodically downloading data and using peek functions.
Let assume that I wish to post these data to template:
model: function() {
return this.store.peekAll('book');
}
This model will send all clusters to template and is updated when data in store are updated. Attempt to obtain a single record:
return this.store.peekRecord('book', 'book-id');
If required data are in cache, we are fine. If they are not in cache, the model will not be updated - becase it does not return ‘live array’ like peekAll(). How we will obtain a record that will be updated?
return this.store.filter('book', (item) => { return item.id === 'book-id'})
Live array is returned and we are fine. But store.filter() is deprecated and will be removed (it is possible to use ember-data-filter, now). This is quite simple case, so there should be simplier solution. What is the right way, to do it without using store.filter() ?
Solution proposed on GitHub - ember-data/ember-data-filter: The store.filter API does not work with live records what I need.