Closed zuhair-naqvi closed 7 years ago
// example of the custom inline middleware
next => req => {
return next(req);
}
If you don't want pass request to internal fetch function, do not call next
function. But you should return some promise.
next => req => {
const resultWithPayloadOrError = promiseThatProceedReqViaBuffer(req);
return resultWithPayloadOrError;
}
In promiseThatProceedReqViaBuffer
:
requestList = [];
requestList.push(req.relayReqObj);
// after some tiny period of time, when you collect requests
queriesBatch(relayRequestList, fetchWithMiddleware)
Internally queriesBatch
resolves/rejects all relay queries. But ideally somehow needs to pass resulting promise back to middleware (resultWithPayloadOrError).
I'm implementing a query buffer to solve https://github.com/nodkz/react-relay-network-layer/issues/16
I'm able to construct a batch query object after all individual queries have been added to the queue and I only want to execute the final, batch-query and cancel all other requests.
Does react-relay-network-layer support this?