fix(GraphiQL) fallback to defaultQuery if there's no stored query #130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there, is GraphiQL correctly falling back to
props.defaultQuery
?I find that if I open http://graphql-swapi.parseapp.com/ with an incognito window, the query window is blank. But, I think it should include
defaultQuery
defined at the bottom ofGraphiQL.js
.I think the problem is that
this._storageGet("query")
returnsnull
(https://developer.mozilla.org/en-US/docs/Web/API/Storage/getItem) if it is unset -- but the we treat that as useful value since it's!== undefined
.So, can we test it against
null
instead?I tried to write tests for this but I couldn't quite get it:
node.textContent
didn't contain the query string andcomponent.state
hadquery: null
, so I think it may not have been initialized. Should I add a test for this? Happy to do it, but I'll need a little guidance :)