unionPendingRequests
Group pending requests by the request that they are a subset of.
connection.unionPendingRequests( pendingRequests )
This is called by getListData to determine which pending requests can be unified into a broader request. This produces a grouping of 'parent' sets to 'child' requests whose data will be derived from the data retrieved by the parent.
After this grouping is returned, getListData executes requests for the parent sets. After a parent request succeeds, the child requests will have their data calculated from the parent data.
Parameters
- pendingRequests
{Array<PendingRequest>}
:an array of objects, each containing:
set
- the requested setdeferred
- a wrapper around aPromise
that will be resolved with this sets data
Returns
{Array<Object>}
:
an array of each of the unified requests to be made. Each unified request should have:
set
- the set to requestpendingRequests
- the array of pending requests theset
satisfies
Example
This function converts something like:
[
{set: {completed: false}, deferred: def1},
{set: {completed: true}, deferred: def2}
]
to:
[
{
set: {},
pendingRequests: [
{set: {completed: false}, deferred: def1},
{set: {completed: true}, deferred: def2}
]
}
]