regressions in variable validation
See original GitHub issueHey there,
First off, thanks for making Graphiql! It’s great!
I am getting an error similar to the one described in this issue: https://github.com/graphql/graphiql/issues/1308
Here’s the query I have in the inspector:
{
sequences{
pageSize
pageNumber
results {
size
sequenceFeatures {
start
end
name
}
}
}
}
{
seq
}
And here are the errors:
I believe this is because the logic passing the highlightNode
into the getLocation
function is faulty:
const highlightNode =
node.kind !== 'Variable' && 'name' in node
? node.name
: 'variable' in node
? node.variable
: node;
As you can see in the above image, node.name
is undefined yet 'name' in node
still === true. This causes undefined
to be passed to getLocation
on line 137: const highlightLoc = getLocation(highlightNode);
In the past that code used to look like:
return error.nodes.map(node => {
const highlightNode =
node.kind !== 'Variable' && node.name
? node.name
: node.variable
? node.variable
: node;
But got converted in this PR https://github.com/graphql/graphiql/pull/957 to look like:
I am going to make a PR to fix this specific issue where the xxx in xxx
syntax is being used incorrectly. I think it someone on the graphiql team should look at all the places that got changed to use the xxx in xxx
syntax that might now break.
Thanks!
P.S. In case it wasn’t clearn, once I made the change I described above locally, the error I was seeing went away and graphiql resumed working properly again
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top GitHub Comments
every release is cut from master branch
try out the alphas? https://www.npmjs.com/package/graphiql
easiest way to get at the last pre-release is
npm install graphiql@next
oryarn add graphiql@next
@acao could you advise on what version I should use to get around this error in the meantime? I believe
v0.17.5
is the highest non-beta version but it doesn’t have the code that’s on master. I couldn’t tell which branch0.17.5
is cut from? Thanks!