graphql-let icon indicating copy to clipboard operation
graphql-let copied to clipboard

using generated types and document without importing hook breaks HMR codegen

Open martaver opened this issue 4 years ago • 0 comments

Hey man!

Great work on this plugin, smooths over so much codegen pain.

I'm having an issue where I'm using a with-typescript-graphql setup on nextjs. I'm using getStaticProps and so can't call useFooQuery hooks from there.

Instead, I import the FooQuery and FooQueryVariables types and FooDocument and pass them to my apollo client:

import { FooQuery, FooQueryVariables } from '../graphql/foo.graphql';
import { FooDocument } from '../__generated__/graphql/foo.graphql';

// and in getStaticProps
await prismicClient.query<FooQuery, FooQueryVariables>({
    query: FooDocument,    
  })

All good, but now since useFooQuery isn't referenced, when I edit foo.graphql, webpack doesn't pick up the changes.

HMR only seems to trigger when I import the hook.

martaver avatar Jan 11 '21 22:01 martaver