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

gql.tada not updating types on schema.graphql changes #339

Closed
3 tasks done
pmooney-socraticworks opened this issue Jul 9, 2024 · 3 comments · Fixed by #340
Closed
3 tasks done

gql.tada not updating types on schema.graphql changes #339

pmooney-socraticworks opened this issue Jul 9, 2024 · 3 comments · Fixed by #340

Comments

@pmooney-socraticworks
Copy link

Describe the bug

I found this discussion mentioning that graphql-env.d.ts wasn't regenerating on schema change, but that the OP redacted their discussion.

However, I seemed to have found that when the return type of a query is changed in the schema.graphql, then the .d.ts file isn't updated. However it seems to update fine when new properties are added or removed from the schema.graphql.

In order for me to see changes reflected in VScode, I have to CMD+P > Restart TS Server when query return types change. I have linked a sample repo.

Example of property being added/removed and LSP correctly catching it:

Screen.Recording.2024-07-08.at.4.57.54.PM.mov

Example of changing the return type of a Query NOT updating the type until manual TS Server refresh:

Screen.Recording.2024-07-08.at.5.01.53.PM.mov

Reproduction

https://github.com/pmooney-socraticworks/gql-tada-issue

gql.tada version

1.8.1

Validations

  • I can confirm that this is a bug report, and not a feature request, RFC, question, or discussion, for which GitHub Discussions should be used
  • Read the docs.
  • Follow our Code of Conduct
@pmooney-socraticworks
Copy link
Author

Edit: In the first "working" video, recreating my steps, I discovered that todo on line 25 is actually typed as { ..., hi: unknown }, not string. A hard refresh of TS Server in VSCode correctly updates it to String

@pmooney-socraticworks pmooney-socraticworks changed the title gql.tada not rebuilding on schema.graphql query return type changes gql.tada not updating types on schema.graphql changes Jul 9, 2024
@kitten
Copy link
Member

kitten commented Jul 9, 2024

I can confirm that this is happening. We didn't really consider manual editing of the SDL file (and this is still not recommended/expected, as it's not a great or the "definitive" GraphQL experience), however, there's an easy workaround. We'll have to test this on multiple platforms though.

@pmooney-socraticworks
Copy link
Author

Thanks @kitten for looking at it. I was manually editing the SDL file to show the issue, but in reality, the same thing happens when my graphql server outputs its schema (using type-graphql)

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

Successfully merging a pull request may close this issue.

2 participants