Which packages are impacted by your issue?
@graphql-codegen/typescript-react-apollo
Describe the bug
When using @graphql-codegen with the typescript-react-apollo plugin and @apollo/client v4 the generated code is invalid. Generated hooks (e.g. useQuery / useMutation) must be imported from @apollo/client/react, but are imported through @apollo/client. This causes a generated file to compile.
A workaround is to manually specify the following in the codegen.ts file:
config: {
apolloReactCommonImportFrom: "@apollo/client/react",
apolloReactHooksImportFrom: "@apollo/client/react",
}
Your Example Website or App
N/A
Steps to Reproduce the Bug or Issue
- Bump
@apollo/client from v3 to v4
- Run
codegen
- Build the generated code.
Expected behavior
The file does not compile and it is expected to compile.
Screenshots or Videos
No response
Platform
Codegen Config File
No response
Additional context
No response
Which packages are impacted by your issue?
@graphql-codegen/typescript-react-apollo
Describe the bug
When using
@graphql-codegenwith thetypescript-react-apolloplugin and@apollo/clientv4 the generated code is invalid. Generated hooks (e.g.useQuery/useMutation) must be imported from@apollo/client/react, but are imported through@apollo/client. This causes a generated file to compile.A workaround is to manually specify the following in the
codegen.tsfile:Your Example Website or App
N/A
Steps to Reproduce the Bug or Issue
@apollo/clientfrom v3 to v4codegenExpected behavior
The file does not compile and it is expected to compile.
Screenshots or Videos
No response
Platform
Codegen Config File
No response
Additional context
No response