Hydrogen 2.0: Compatibility with graphql-code-generator
#2295
davidhousedev
started this conversation in
Ideas + Feature Requests
Replies: 1 comment 1 reply
-
@davidhousedev — I've got a side project I'm building where I leveraged this repo: https://github.com/thomasheyenbrock/remix-graphql that uses I think @frehner will have a lot of ideas here (and may have already done some stuff here). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It was super exciting to read the early look into a potential API for querying the Storefront within a Remix loader. I have some feedback to share about the following example:
The abstraction layer sits atop a graphql client for interfacing with the Storefront API. This is not ideal for our toolchain, which relies heavily on
graphql-code-generator
to create a type-safe graphql SDK.We could continue to use
graphql-code-generator
on this new API if we did something like the following:That said, there are multiple downsides to this approach:
ProductQueryVariables
type exported by'./generated-sdk.ts'
In contrast, this is how we would access the query via
useQuery
:I'm hoping that we can avoid losing any type safety or DX ergonomics when migrating from Hydrogen 1.0 to Hydrogen 2.0. I'm curious to hear more about any plans you have in this area!
Beta Was this translation helpful? Give feedback.
All reactions