persistgraphql icon indicating copy to clipboard operation
persistgraphql copied to clipboard

Add hash_ids flag to override default integer values

Open jasonmorita opened this issue 8 years ago • 11 comments
trafficstars

When experimenting with using persisted queries, I found that trying have multiple clients caused potential query ID collisions due to the use of incremental integers as IDs.

This adds the option to use a hash of the query as the ID to allow multiple query maps to be combined and used on the server.

jasonmorita avatar Jul 07 '17 20:07 jasonmorita

@jasonmorita: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

apollo-cla avatar Jul 07 '17 20:07 apollo-cla

@stubailo Hi, just a bump :)

jasonmorita avatar Jul 17 '17 05:07 jasonmorita

Hi @jasonmorita - sorry for the delay. I'll look at this shortly.

Poincare avatar Aug 19 '17 20:08 Poincare

@Poincare After thinking about this some more in the last few weeks, we have started to realize that it might be helpful to also use the operation name in the key. Like { "query getUsersQuery() {...": "getUsersQuery-<hash>" }

What are your thoughts on that?

The use-case we have is that we have more than one client, but we want to use persisted queries and have them reference the same queries on the GQL server by some sort of human readable name.

I think the short-term goal would be to generate the query map on the client based on the queries a React app is using and then store that map on the server.

jasonmorita avatar Aug 19 '17 20:08 jasonmorita

@jasonmorita I think the relevant issue here is #34. There will likely be an effort to change the structure that persistgraphql uses to align with the one with apollo-codegen. I haven't had a chance to look into the proposal very deeply yet but once I do, I think we'll have a clear path forward both here and in #34.

Poincare avatar Aug 19 '17 20:08 Poincare

Any update on this? <3

mergebandit avatar Oct 26 '17 16:10 mergebandit

@mergebandit Basically, we have to move to using apollo-codegen's hashing scheme rather than doing something ad-hoc in here so I don't think these particular changes will be merged.

Poincare avatar Oct 27 '17 04:10 Poincare

@Poincare Is this being actively worked on? What's the path forward for PQs?

jasonmorita avatar Oct 30 '17 23:10 jasonmorita

@Poincare Looks like apollo-codegen uses sha256 instead of sha512. Is that the main concern?

hybrist avatar Dec 20 '17 01:12 hybrist

@austinmcorso Hey, is this gonna be merged?

jasonmorita avatar Jul 18 '18 03:07 jasonmorita

@jasonmorita I'm not a maintainer, do require similar functionality so hoping it does

austinmcorso avatar Jul 18 '18 03:07 austinmcorso