Skip to content

Commit d77a514

Browse files
committed
fix operation position calculation
1 parent d7a84ff commit d77a514

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/graphql-playground-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql-playground-react",
3-
"version": "1.5.4",
3+
"version": "1.5.5",
44
"main": "./lib/lib.js",
55
"typings": "./lib/lib.d.ts",
66
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",

packages/graphql-playground-react/src/state/sessions/sagas.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ function* runQueryAtPosition(action) {
8181
if (session.operations) {
8282
let operationName
8383
session.operations.forEach((operation: any) => {
84-
if (operation.loc.start <= position && operation.loc.end >= position) {
84+
if (
85+
operation.loc &&
86+
operation.loc.start <= position &&
87+
operation.loc.end >= position
88+
) {
8589
operationName = operation.name && operation.name.value
8690
}
8791
})

0 commit comments

Comments
 (0)