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
879 stars 97 forks source link

Unable to change runtime variable after first time #691

Open lorthirk opened 9 months ago

lorthirk commented 9 months ago

Before you create the issue

Describe the bug I have a TOKEN variable defined in my graphql.config.yml file so that I can pass a JWT Token when I make some calls. After I enter it the first time (by pressing Cmd+Enter on a query defined in a .graphql file), I cannot change it anymore because clicking the "Edit Environment Variables" shows the variable with an empty value, and changing it doesn't have any effect.

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

  1. Create a variable in config.graphql.yml
  2. Perform a GraphQL query/mutation
  3. Set a value for that variable and run the operation
  4. Open the "Edit Environment Variables" button to change the value

Expected behavior The "Edit Environment Variables" window opens with the variable with the old value, allowing to change its value

Version and Environment Details Operation system: macOS Ventura 13.5.1 IDE name and version: IntelliJ Ultimate 2023.2.2 Plugin version: 4.0.2

kajmaj87 commented 8 months ago

I have the exact same issue.

Version and Environment Details Operation system: Linux fedora 6.5.5-100.fc37.x86_64 IDE name and version: IntelliJ Ultimate 2023.2.3 Plugin version: 4.0.2

vepanimas commented 8 months ago

I'll fix it in the upcoming 2023.3 release.

lorthirk commented 8 months ago

If you want I can open a different issue for a different feature, but IMHO it would be great to have the variable saved somehow with the .graphql file, so that I don't have to populate them every time I restart IntelliJ.

vepanimas commented 8 months ago

@lorthirk if you want to persist the variables, why don't just create an .env file? Here is the docs.

lorthirk commented 8 months ago

@lorthirk if you want to persist the variables, why don't just create an .env file? Here is the docs.

Uhm... I was still thinking about input variables rather than envs. Sounds impractical to pollute the envs with objects to be used as inputs in queries, especially when I have many queries.

vepanimas commented 8 months ago

@lorthirk I created an issue for that 👍

lorthirk commented 8 months ago

I'm sorry, I realize now I was not clear.

In my second comment I was referring to input variables, the ones with the yellow "V" button, not environment variables.

vepanimas commented 8 months ago

Ah, my bad. For that one, we already have an issue with a long history https://github.com/JetBrains/js-graphql-intellij-plugin/issues/83.