Skip to content

Commit d3c1350

Browse files
committed
subscribe: simplify root field extraction
Replicates graphql/graphql-js@954913b
1 parent 586fcc3 commit d3c1350

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/graphql/subscription/subscribe.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,8 @@ async def execute_subscription(context: ExecutionContext) -> AsyncIterable[Any]:
164164
schema = context.schema
165165
type_ = get_operation_root_type(schema, context.operation)
166166
fields = context.collect_fields(type_, context.operation.selection_set, {}, set())
167-
response_names = list(fields)
168-
response_name = response_names[0]
169-
field_nodes = fields[response_name]
170-
field_node = field_nodes[0]
171-
field_name = field_node.name.value
167+
response_name, field_nodes = next(iter(fields.items()))
168+
field_name = field_nodes[0].name.value
172169
field_def = get_field_def(schema, type_, field_name)
173170

174171
if not field_def:

0 commit comments

Comments
 (0)