-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON-API adapter not grouping together relationship-gets for coalescing #3899
Comments
This sounds like a bug. @igorT can you confirm that |
@bmac in my project, coalesceFindRequests can coalesce async relationship requests, but in ?filter[id]=180,181,260,262,263,282,290 format, not like id[]=1&id[]=2&id[]=3 |
@nouh: That's just the JSON-API-compliant behavior I'm looking for! Did you have to do anything to get it working (besides setting |
@runspired suggests that this might be because these are |
@mwpastore Were you ever able to resolve this? I am running into the same issue now |
It looks like in my case it is because my back end is sending links and data and ember-data prioritizes the links. |
@mukk85 we can't easily group link requests, however you probably can if you implement findBelongsTo / findHasMany. |
@runspired I know we cant group link requests, but can we have it so it prioritizes IDs if the data is provided? |
With the RequestManager RFC emberjs/rfcs#860 coalescing and request-management become fully customizable to handle fulfillment and could coalesce on ids even when links are present. |
I have an API endpoint
/api/foos
that returns a collection ofFoo
s. EachFoo
belongsTo
a (has one)Bar
, and the related link comes over in the JSON-API payload as/api/bars/N
whereN
is the ID of theBar
. When I iterate over the collection ofFoo
s in my template and callfoo.get('bar')
, Ember Data dispatches many requests to the backend, one for eachBar
. This is undesirable.I have
namespace
set to/api
andcoalesceFindRequests
set totrue
in my ApplicationAdapter. Digging into the JSON-API and REST adapters' code a bit, I would expectgroupRecordsForFindMany
to map this sequence of similar requests to a single request with a list ofBar
IDs. Either this function isn't being called or it isn't working correctly. Or it's possible I'm not using Ember Data correctly!Any suggestions on where to go from here? Is this an actual bug or missing feature or PEBKAC? Thanks in advance.
The text was updated successfully, but these errors were encountered: