Meta-data for hasMany async relationships?


#1

I’m running into a frustrating issue with ED. Let’s say we have two models; Event and Participant. Participant is nothing special, Event looks something like this:

export default DS.Model.extend({
  participants: DS.hasMany('participant', {async: true})
});

The Event is populated with Participants via an API sub-collection like events/:event_id/participants, which is provided via "links". Like many API collections, this one is paginated and defaults to 10 resources per page rather than trying to roll up possibly hundreds or thousands of resources in a single response (for the sake of payload size and response time).

Is there a way I can access the "meta" property of a request for an async hasMany relationship? And is this data cached anywhere specific to each Event record?

I can use metadataFor('participant') one time, but viewing another Event record will overwrite that; so, it’s not the right tool here.


#2

One thought I’m having is to write some kind of custom code to cache meta-data for hasMany requests, but this seems difficult-to-impossible because the adapter layer is completely bypassed by findHasMany.

An alternative solution is to completely abandon the hasMany relationship in this case and manually fetch the data needed in the route.