ember-batch-request
ember-batch-request copied to clipboard
Allow to get records in batch
Hi,
I think it can be super useful to do batch get requests. Specially for has many relationships loading.
What you think?
@GCorbel we tend to use coalesce requests for that usually.
// app/adapters/application.js
import JSONAPIAdapter;
export default JSONAPIAdapter.extend({
coalesceFindRequests: true
});
@shishirmk That's very cool. I didn't know that option. It's very useful.
It can still be useful. I sometimes do this kind of code :
model() {
return Ember.RSVP.hash({
allCourses: this.store.findAll('course'),
allSessions: this.store.query('session', { include_archives: true }),
taxes: this.store.findAll('tax'),
fees: this.store.findAll('fee'),
affiliations: this.store.findAll('affiliation'),
discountsByNumber: this.store.findAll('discountByNumber')
});
}
It do 6 requests and it can be useful to do the same in one. Even with coalesce requests, it do many request to load associations.