Skip to content

Commit 1202476

Browse files
olimsaidovhuv1k
authored andcommitted
Use query definition name as firstOperationName if any (#855)
1 parent 841bd26 commit 1202476

File tree

1 file changed

+4
-0
lines changed
  • packages/graphql-playground-react/src/components/Playground/util

1 file changed

+4
-0
lines changed

packages/graphql-playground-react/src/components/Playground/util/getQueryTypes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export const getQueryTypes = (ast): QueryTypes => {
99

1010
if (ast && ast.definitions) {
1111
ast.definitions.forEach(definition => {
12+
if (!firstOperationName) {
13+
firstOperationName = definition.name && definition.name.value
14+
}
15+
1216
if (!firstOperationName) {
1317
firstOperationName =
1418
definition.selectionSet &&

0 commit comments

Comments
 (0)