JetBrains / js-graphql-intellij-plugin

GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
https://jimkyndemeyer.github.io/js-graphql-intellij-plugin/
MIT License
880 stars 97 forks source link

Schema changes detected with significant delay if schema is generated and not opened #589

Open villesau opened 2 years ago

villesau commented 2 years ago

Describe the bug

When using GraphQL Nexus, types are generated from the code. So you don't work on the schema file manually. When Nexus generates the schema, it takes significant amount of time to detect changes, up to 1 minute or so. You need to open the generated schema file in order to make the changes to propagate faster.

To Reproduce Link to Repo with Reproduction or Steps to Reproduce:

  1. Open some examples here: https://github.com/graphql-nexus/nexus/tree/main/examples
  2. have a query file somewhere in the project
  3. change the nexus schema and generate graphql schema
  4. Error: It takes up to 1 minute to see the changes to propagate to query file. If you visit the schema file, the changes propagates immediately.

Expected behavior The changes should be reflected throughout the project immediately after the schema is created, without the need to open the actual schema file.

Screenshots If applicable, add screenshots to help explain your problem.

Version and Environment Details Operation system: macOS 12.0.1 IDE name and version: Build #IU-213.6461.48 Plugin version: 3.1.2

Additional context Description of how nexus works: https://nexusjs.org/docs/getting-started/tutorial/chapter-writing-your-first-schema#reflection

I think there should be file watchers watching the schema files when they are not open. It' not feasible to expect the schema to only change if the file is open. Especially with modern code generation tools graphql files might change anytime. I believe that this would be fixable by improving the plugins file watcher logic.