storefront-remix-starter
storefront-remix-starter copied to clipboard
Update codegen to use "client" preset
Graphql codegen has a client preset plugin which has the following advantage over the current generic SDK plugin:
- It "automatically" types the graphql operation, so it is explicit in where a particular gql document is actually being used in the app. Makes things more maintainable.
- Less indirection in the API layer. You just pass the operation constant to a fetch function.
This task would involve:
- Installing the client preset per the docs
- Updating the codegen config
- In all the "providers" files, replace the
gql
template function with agraphql
function call. - Remove calls to the "sdk" object, and instead pass the query/mutation constants directly to the fetch wrapper.