GraphiQL Query Variables are reset whenever query is updated
See original GitHub issueDescription
I’ve noticed that the Query Variable field is reset every time I update a GraphQL query in the GraphiQL IDE.
Steps to reproduce
This can be reproduced on gatsby-starter-blog
:
gatsby new graphiql-test https://github.com/gatsbyjs/gatsby-starter-blog
cd graphiql-test
gatsby develop
Open up GraphiQL: http://localhost:8000/___graphql
and enter the following query:
query NewBeginningsPost($title: String!) {
markdownRemark(frontmatter: {title: {eq: $title}}) {
frontmatter {
title
}
}
}
In the Query Variable section, add the following:
{
"title": "New Beginnings"
}
Now update the query either directly in the query field, or using the Explorer menu on the left-hand side.
Expected result
The query variable field should not change unless we update it ourselves.
Actual result
Environment
System:
OS: macOS 10.15.4
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Shell: 3.1.0 - /usr/local/bin/fish
Binaries:
Node: 12.16.3 - ~/.config/nvm/12.16.3/bin/node
Yarn: 1.22.4 - ~/.config/nvm/12.16.3/bin/yarn
npm: 6.14.4 - ~/.config/nvm/12.16.3/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 81.0.4044.138
Edge: 81.0.416.77
Safari: 13.1
npmPackages:
gatsby: ^2.21.37 => 2.21.37
gatsby-image: ^2.4.4 => 2.4.4
gatsby-plugin-feed: ^2.5.1 => 2.5.1
gatsby-plugin-google-analytics: ^2.3.1 => 2.3.1
gatsby-plugin-manifest: ^2.4.5 => 2.4.5
gatsby-plugin-offline: ^3.2.3 => 3.2.3
gatsby-plugin-react-helmet: ^3.3.1 => 3.3.1
gatsby-plugin-sharp: ^2.6.4 => 2.6.4
gatsby-plugin-typography: ^2.5.1 => 2.5.1
gatsby-remark-copy-linked-files: ^2.3.2 => 2.3.2
gatsby-remark-images: ^3.3.4 => 3.3.4
gatsby-remark-prismjs: ^3.5.1 => 3.5.1
gatsby-remark-responsive-iframe: ^2.4.2 => 2.4.2
gatsby-remark-smartypants: ^2.3.1 => 2.3.1
gatsby-source-filesystem: ^2.3.4 => 2.3.4
gatsby-transformer-remark: ^2.8.9 => 2.8.9
gatsby-transformer-sharp: ^2.5.2 => 2.5.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Queries - Apollo GraphQL Docs
This article assumes you're familiar with building basic GraphQL queries. ... You can optionally provide a new variables object to the refetch function....
Read more >Queries and Mutations - GraphQL
On this page, you'll learn in detail about how to query a GraphQL server. Fields#. At its simplest, GraphQL is about asking for...
Read more >Updating GraphQL Query With New Variables - Stack Overflow
I have a GraphQL query from Apollo + React that I am using on a map component where the parameters are "latitude" and...
Read more >Five Common Problems in GraphQL Apps (And How to Fix ...
There is a solution though, which is to cache the entire GraphQL query response. Unlike Dataloader, whose scope is limited to the current...
Read more >Refreshing Queries - Relay
When referring to "refreshing a query", we mean fetching the exact same data that was originally rendered by the query, in order to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
found the bugfix!
it seems to have been introduced in #21158
i will create a PR, but the solution is as simple as changing
to
Can confirm this with your repro. I also see this behavior when I open/close the “Explorer” pane. @acao who works on GraphiQL will look into this. Thanks for the issue!