Skip to content

Commit

Permalink
subscribe: simplify root field extraction (#3025)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Apr 4, 2021
1 parent 3958158 commit 954913b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/subscription/subscribe.js
Expand Up @@ -203,11 +203,8 @@ async function executeSubscription(
Object.create(null),
Object.create(null),
);
const responseNames = Object.keys(fields);
const responseName = responseNames[0];
const fieldNodes = fields[responseName];
const fieldNode = fieldNodes[0];
const fieldName = fieldNode.name.value;
const [responseName, fieldNodes] = Object.entries(fields)[0];
const fieldName = fieldNodes[0].name.value;
const fieldDef = getFieldDef(schema, type, fieldName);

if (!fieldDef) {
Expand Down

0 comments on commit 954913b

Please sign in to comment.