Comments (6)
We are also running into this (dotansimha/graphql-code-generator#6199).
The bug
label was removed a few days ago. Is there a solution for how this can be fixed through config or why is this not considered a bug?
from graphql-code-generator-community.
I'm continuing to run into errors due to this issue and I'd love to see a fix for it 🙂
I'm in the process of incrementally migrating from Apollo code-generated typedefs to graphql-code-generator typedefs and this is the last issue that prevents full interoperability between the two.
To get this solved, we need to apply the optimizeDocuments method on the level of the loaders in graphql-tools, and allow to pass the flag there - this way it will allow us to optimize operations before codegen preset gets it.
I tried digging into the graphql-tools code to accomplish this, but I couldn't get it to work. It was a while ago and I was just hacking around in the built lib within my node_modules
so I don't remember exactly what I tried 😅 I remember getting some errors about unknown or unrecognized fragments, I think 🤔
@dotansimha, @ardatan, are there any additional details or files you could point me to where the change should be made? I'd be happy to give it another try in a more rigorous way.
Thanks 🙏🏻
from graphql-code-generator-community.
The actual issue here is the fact that we are applying the flattenGeneratedTypes
on the level of the plugin, after the preset has been executed and all operations has been splitted to separate output files.
That means, that we get a file for the fragment, and a file for the operation, but the operation needs to flatten the selection set and remove the fragment completely. Some kind of a race condition.
To get this solved, we need to apply the optimizeDocuments
method on the level of the loaders in graphql-tools
, and allow to pass the flag there - this way it will allow us to optimize operations before codegen preset gets it.
@ardatan fyi :)
from graphql-code-generator-community.
Up, have the same issue
from graphql-code-generator-community.
Yes, this is not solved yet
from graphql-code-generator-community.
Still having this issue.
from graphql-code-generator-community.
Related Issues (20)
- typescript-react-query Generated queries should reference a type that has common query keys/method (getKey, fetcher, callable)
- [typescript react-query] vue-query not compatible since 6.0.0 and tanstack v5 HOT 1
- Typescript React Query v5 wrong type infinite query HOT 2
- Incorrect description generation for mutation arguments
- Add NestJS plugin
- Generated defaultWrapper includes an unused parameter not prefixed with `_`
- msw plugin does not allow to pass `RequestHandlerOptions` on generated mocks HOT 2
- [react-apollo]: `documentMode: external` does not apply naming parameters
- typescript-react-query: expose `useQuery` `queryClient` parameter with v5 HOT 1
- typescript-urql-graphcache: Property '__typename' is missing in type 'DataFields' HOT 2
- Generated useInfiniteQuery hook code has typescript error with spread operator being applied on `metadata.pageParams` (`unknown` type) HOT 2
- Feature Request: expose queryOptions of react-query v5
- Feature request: [java & kotlin] Generate types as interfaces
- Dotnet code gen does not work on the website HOT 1
- defaultBaseOptions value is not exported in generated file
- Allow toggling useSuspenseQuery generation HOT 2
- [java] generated enum arguments lack validation HOT 2
- [react-apollo] Add support for `useLoadableQuery`
- skipToken support for typescript-react-apollo HOT 3
- [Java] Reserved keyword "case" used in generated code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-code-generator-community.