graphql-python / graphql-core-legacy

GraphQL base implementation for Python (legacy version – see graphql-core for the current one)
MIT License
374 stars 183 forks source link

FIX: subscription returns incorrect result when data loader is used during fields resolving. #287

Closed DayS1eeper closed 1 year ago

DayS1eeper commented 3 years ago

This PR fixes batching for subscriptions.

Without this fix batch_load_fn is called after every load call and test_batches_subscription_result fails on

assert subscription_results[0].data == expected_data_1 

because subscription_results[0].data contains

{'newPosts': <Promise at 0x7f9ea611c6a0 fulfilled with [OrderedDict([('id', 1), ('tag', OrderedDict([('id', 1), ('name', '#music')]))]), OrderedDict([('id', 2), ('tag', OrderedDict([('id', 2), ('name', '#beautiful')]))]), OrderedDict([('id', 3), ('tag', OrderedDict([('id', 1), ('name', '#music')]))])]>} 
DayS1eeper commented 3 years ago

@syrusakbary Could you please take a look at this?

TitanFighter commented 3 years ago

@DayS1eeper this is legacy repo, with the last commit more than 1 year ago. Probably you need https://github.com/graphql-python/graphql-core

DayS1eeper commented 3 years ago

@TitanFighter I use graphql-core 2.3.2 and graphene 2.1.9 in my project.