relay-tools / relay-local-schema

Use Relay without a GraphQL server
Creative Commons Zero v1.0 Universal
253 stars 11 forks source link

"You should not use this as a substitute for an actual GraphQL server for accessing a remote backend." #11

Closed zuhair-naqvi closed 8 years ago

zuhair-naqvi commented 8 years ago

This this because the client would be making N requests rather than the server?

taion commented 8 years ago

Right, you lose all the benefits of request aggregation you'd get with a GraphQL server.

zuhair-naqvi commented 8 years ago

That's true. However in case of React Native, if you use the schema with the app and back it by https://github.com/facebook/dataloader (persist cache to disk) you could potentially deliver an offline first experience.. And the aggregation trade off might be acceptable given most of the queries would be resolved locally by the dataloader (depending on the use case) and only the ones not cached will actually go over the network. I'd be keen to hear your thoughts on this

taion commented 8 years ago

It's not the same because you're still resolving waterfalled loads locally rather than remotely, and end up with multiple WAN round-trips rather than data-center-internal round-trips.

josephsavona commented 8 years ago

This seems like a reasonable warning to have to encourage most people to use a GraphQL server, but @zuhair-naqvi's approach is interesting and totally worth exploring. You're both right! ;-)

taion commented 8 years ago

It still seems less than ideal to use data loader from the client-side, though - you still end up with waterfalled requests, no?

josephsavona commented 8 years ago

@taion context is https://github.com/facebook/relay/issues/676#issuecomment-165957453