Relay: [modern] Persisted GraphQL Queries in Modern?

Created on 2 Aug 2017  路  4Comments  路  Source: facebook/relay

Since all GraphQL queries are known at build time, I am wondering if I could use the information given by the files generated by relay-compiler to:

  1. Create ID's
  2. Send those ID's to the GraphQL server as a GET/POST: ex GET /graphql?query_id=eyBuaWNl123 or POST /graphql?mutation_id=abcdefgh321
  3. Get a response back equal to what you would normally get from sending in a GraphQL query string.

What would the pseudo code look like for this?

Related:
RFC: GraphQL Persisted Documents
https://github.com/graphql/express-graphql/pull/109
persistgraphql
https://github.com/apollographql/persistgraphql

Most helpful comment

All 4 comments

There is an open PR about it already

@sibelius

Ah I see, this one right?
https://github.com/facebook/relay/pull/1846

For a compile time solution, see relay-compiler-plus. The hard work is done for you by this custom compiler at compile time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brad-decker picture brad-decker  路  3Comments

scotmatson picture scotmatson  路  3Comments

janicduplessis picture janicduplessis  路  3Comments

fedbalves picture fedbalves  路  3Comments

staylor picture staylor  路  3Comments