lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

Offer Automatic persisted queries hash in the context

Open mostafa-rz opened this issue 1 year ago • 3 comments

I want to add the APQ hash to the context, to be accessible in all the resolvers.

What problem does this feature proposal attempt to solve?

It is useable as a unique cache key for identical requests in custom cache key implementation.

Which possible solutions should be considered?

  • The context interface should be updated to offer get/set of the new property
  • Add the APQ hash to the context after the parse operation

If the feature is ok, I can send the PR.

mostafa-rz avatar Jul 19 '24 12:07 mostafa-rz

How would this interact with the configuration lighthouse.query_cache? I presume the hash would only be available if lighthouse.query_cache.enable is true?

spawnia avatar Jul 19 '24 12:07 spawnia

yes, if the config is true then it returns the hash otherwise it is null.

mostafa-rz avatar Jul 19 '24 12:07 mostafa-rz

Alright, sounds good. I am not sure if the context interface can be extended without breaking changes, and how it interacts with features such as subscriptions - during which the context is serialized. Feel free to explore and contribute something, but perhaps think laterally.

spawnia avatar Jul 19 '24 13:07 spawnia