Comments (4)
PS I'm using this in concert with https://github.com/eyston/relay-composite-network-layer
The exported RelayNetworkLayer is passed to relay-composite-network-layer - this shouldn't have any effect on RelayNetworkLayer as it is simply a wrapper for merging schemas, thought i'd mention it regardless..
from react-relay-network-layer.
I think that compositeNetworkLayer
spreads one sendQueries
call obtained from Relay to multiple: https://github.com/eyston/relay-composite-network-layer/blob/master/src/execute/network.js#L14,L16
- So you need to combine somehow this requests into one back, before touching
react-relay-network-layer
[better solution]. - Or write some bufferMiddleware for
react-relay-network-layer
, which will gather requests some period of time and then combine it to batch query send to the server and resolve it back [very hard and tricky solution]. - Or maybe fork
relay-composite-network-layer
and write your own custom network layer [may be the simplest solution in your case].
from react-relay-network-layer.
@nodkz Thanks for the quick response!
The buffer middleware sounds like the most robust as different schemas in composite network layer may be using different network layers.
What's the best way of approaching this? Could I simply return next([requestPool])? or do I need to create a RelayQueryRequest with query type 'batch-query'?
I'll contribute the bufferMiddleware back to this repo once done as it's pretty handy utility.
from react-relay-network-layer.
You should get back relayRequestObject from req.relayReqObj
, create array of them and pass to
queriesBatch(relayRequestList, fetchWithMiddleware)
.
It too hacky, but should work.
PS. Ideally, I should rewrite all network layer from scratch. Some internal parts are too ugly and not clear for me already 😳.
from react-relay-network-layer.
Related Issues (20)
- Throwing errors from middleware HOT 5
- batchUrl property of URL middleware is not passed req HOT 4
- Support max batch size HOT 2
- authMiddleware stop working as of 2.0.0! HOT 2
- __dataID__ unknown field HOT 2
- Rendering partial response with error messages HOT 1
- error: Processing of node_modules/react-relay-network-layer/lib/middleware/gqErrors.js failed. SyntaxError: Unexpected token (80:376) HOT 3
- Syntax Error GraphQL request (1:1) Unexpected EOF HOT 1
- Chinese Characters Issue HOT 3
- When will subscriptions be supported? HOT 2
- How to pass data from express req object to the req received by middleware HOT 3
- Relay Modern equivalent? HOT 6
- Redirect to login page and network layer HOT 1
- Token not refreshing after user logs out and login again with different user. HOT 4
- regeneratorRuntime not defined in lib/fetchWithMiddleware.js HOT 2
- Batching: make query id optional HOT 1
- Cannot access response header from middleware HOT 1
- Retry middleware not retrying HOT 8
- One of the sources for assign has an enumerable key on the prototype chain HOT 4
- Flowtype failing on my repo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-relay-network-layer.