Open fdiogo opened 1 year ago
I will do more research on this
Any news on this?
I'm building a large shopify app and I require to handle throttling according to a shopify extension.
Would love to handle this directly on genql.
Adding the extensions field would require a breaking change because Genql currently only returns the data, i will keep in mind for the next breaking release, but for now i have no plans for it
@remorses have you considered supporting both paths? To circumvent this we actually created a wrapper around the existing client that overrides the fetcher and returns this instead on query/mutation:
const { data, errors, extensions } = client.query...
Something that's specific to our use case is that errors are also returned as is, instead of thrown. Makes it a bit more ergonomic for us, no type narrowing needed or try/catches.
This change would be additive, and it would be a choice to the consumer to use the raw client or this new theorical wrapper
The latest spec states that the response might have three fields:
data
,errors
andextensions
. Extensions here work in the same way as inerrors[number].extensions
, it's open for implementers to add whatever they might want.https://spec.graphql.org/October2021/#sel-DAPHDJAACLAnxP
Examples of potentially useful extensions at this level would be:
correlation_id
,status
, etc..We're loving our experience with
genql
, it's a game changer. We'd love to have this if the team thinks it's a good idea, we might able to open a PR with a working example