question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicate named .graphql files intermittently don't generate

See original GitHub issue

Hey, thanks for this project!

I’m just starting to integrate this into my project, and I’ve found that my previous naming convention doesn’t work properly when rerunning generation.

I split my queries and mutations into different folders, but it seems that doing this causes only the types for 1 or the other to be generated, and it seems the behaviour is intermittent.

./mutations/Device.graphql and ./queries/Device.graphql only generates a single Device.graphql{hash}.d.ts file some of the time.

Is this something you know about? I was expecting the hash to stop this from happening and to write both files and let typescript do the merging.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fresholliecommented, Apr 16, 2020

These all make sense to me. I actually like the generated directory, because it stays consistent with codegen for me.

Because I am using codegen, it doesn’t let me name any queries/mutations the same, so the first option works fine.

Is there any reason why deleting the __generated__ directory before generating the types makes it consistently generate all the files? This is what I have been doing without any issues.


Just a little feedback btw. I don’t use this library for the webpack loader, as I found it was much simpler to use the library to generate the ability to “import” from graphql files, and then when compiling point back towards the main __generated__/index.tsx file:

https://github.com/freshollie/fresh-configurator/blob/0bed3a0dae2ea0c86d10c786ea972576f980e1e1/packages/configurator/webpack.config.js#L62

This way also meant I just pointing my *.graphql imports to my __generated__/index.tsx for tests too:

https://github.com/freshollie/fresh-configurator/blob/0bed3a0dae2ea0c86d10c786ea972576f980e1e1/packages/configurator/jest.config.js#L16

I think documenting this usage would be pretty useful for other people using this library, because I couldn’t find anything about using this in a testing workflow.

Also, are there any plans to make this into a graphql-codegen plugin too? Is that possible? This way the config could sit within my already existing codegen chain and generate the definitions instead of having to do them after codegen runs.

0reactions
piglovesyoucommented, Apr 28, 2020

Thank you, you’re so fast! I think I’m going to release it after fixing a few bugs left.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generation of Duplicated Fragments in nested fragments #3063
Hi , i get several errors of "There can be only one fragment named ..." on the Client Side(Apollo). On this example below...
Read more >
Five Common Problems in GraphQL Apps (And How to Fix ...
Schema duplication; Server/client data mismatch; Superfluous database calls; Poor performance; Boilerplate overdose. I'm willing to bet your app ...
Read more >
GraphQL schema basics - Apollo GraphQL Docs
This article describes the fundamental building blocks of a schema and how to create one for your GraphQL server. The schema definition language....
Read more >
GraphQL query returning duplicate results - Stack Overflow
Problem. Your query is likely returning duplicate results. It's sometimes not enough to just call .distinct() . Solution.
Read more >
GraphQL-Error: Found Duplicate Type Names: Cat - Sanity.io
It appears there's a generated GraphQL union type that ends up having the same name as another type. I've reconstructred the issue in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found