Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Fails on save when fragment is in separate .graphql file #22

Open
ntziolis opened this issue Sep 6, 2022 · 1 comment
Open

Bug: Fails on save when fragment is in separate .graphql file #22

ntziolis opened this issue Sep 6, 2022 · 1 comment

Comments

@ntziolis
Copy link

ntziolis commented Sep 6, 2022

Setup:

  • .graphql A contains fragment B
  • .graphql file C contains a an operation that references the fragment B

Result:

  • The extension works without issues when saving A
  • The extension reports a failure when saving B
    • "Codegen threw 3 errors, first one: GraphQL Document Validation failed with 1 errors; Error 0: GraphQLDocumentError: Unknown fragment"

Note:
When running the codegen manually the generation succeeds without issues.

Plugins used:

  • typescript
  • typescript-operations
  • typed-document-node
  • typescript-apollo-angular

This extension is immensely helpful, we are happy to assist in any way we can to resolve this issue. In the meanwhile any workaround to get this working would be highly appreciated.

@ntziolis ntziolis changed the title Bug: Fails on save when fragment is in different .graphql file Bug: Fails on save when fragment is in separate .graphql file Sep 6, 2022
@capaj
Copy link
Owner

capaj commented Oct 3, 2022

I would be open to merging a PR which would resolve this.
I think an easy workaround would be to enable loading of all files when usage of fragment from another file is detected.
Even easier would be a config switch that would force all files to load for each generation.

I don't have capacity right now, but I may get to it at the end of the year if no one beats me to it.

@capaj capaj added this to the 1.1.0 milestone Oct 3, 2022
@capaj capaj removed this from the 1.1.0 milestone Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants