File tree 1 file changed +5
-2
lines changed 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,7 @@ def subscribe_fields(
267
267
parent_type , # type: GraphQLObjectType
268
268
source_value , # type: Any
269
269
fields , # type: DefaultOrderedDict
270
+ only_first_field = True , # type: bool
270
271
):
271
272
# type: (...) -> Observable
272
273
subscriber_exe_context = SubscriberExecutionContext (exe_context )
@@ -290,7 +291,7 @@ def catch_error(error):
290
291
observables = [] # type: List[Observable]
291
292
292
293
# TODO: Make sure this works with multiple fields (currently untested)
293
- # assert len(fields) == 1, "Can only subscribe one element at a time."
294
+ # so we can remove the "only_first_field" argument.
294
295
295
296
for response_name , field_asts in fields .items ():
296
297
result = subscribe_field (
@@ -306,9 +307,11 @@ def catch_error(error):
306
307
observable = result .catch_exception (catch_error ).map (
307
308
lambda data : map_result ({response_name : data })
308
309
)
310
+ if only_first_field :
311
+ return observable
309
312
observables .append (observable )
310
313
311
- return observables [ 0 ] if len ( observables ) == 1 else Observable .merge (observables )
314
+ return Observable .merge (observables )
312
315
313
316
314
317
def resolve_field (
You can’t perform that action at this time.
0 commit comments