Giter Site home page Giter Site logo

Comments (4)

zuhair-naqvi avatar zuhair-naqvi commented on May 20, 2024

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.

nodkz avatar nodkz commented on May 20, 2024

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.

zuhair-naqvi avatar zuhair-naqvi commented on May 20, 2024

@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.

nodkz avatar nodkz commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.