You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
When the subscription event is triggered, its query should reflect the current state of the data.
Desktop (please complete the following information):
OS: Windows
Version 10
Additional context
The issue appears to be caused by the fact that the subscription event queries end up sharing the same service scope as the initial request to create the subscription instead of having their own scope.
Using the example repo, this is what the service scope looks like during the initial subscription event query:
This is what the service scope looks like after subsequent subscription event queries; note the DataLoader from the initial query is in the scope with the original data:
The text was updated successfully, but these errors were encountered:
rafd123
added a commit
to rafd123/hotchocolate
that referenced
this issue
Nov 18, 2019
…stContext
Doing so ensures that any queries that use the cloned context get their
own scoped service instances instead of using the scoped service instances
of the original RequestContext.
This solves the issue of inadvertently having subscription event queries
use the service scope of the originating long-lived subscription request.
See issue ChilliCream#1210
Describe the bug
When using subscriptions in conjunction with DataLoaders, queries of subsequent subscription events return stale data.
To Reproduce
The following repo demonstrates the issue: https://github.com/rafd123/SubscriptionIssueRepro
Expected behavior
When the subscription event is triggered, its query should reflect the current state of the data.
Desktop (please complete the following information):
Additional context
The issue appears to be caused by the fact that the subscription event queries end up sharing the same service scope as the initial request to create the subscription instead of having their own scope.
Using the example repo, this is what the service scope looks like during the initial subscription event query:
This is what the service scope looks like after subsequent subscription event queries; note the DataLoader from the initial query is in the scope with the original data:
The text was updated successfully, but these errors were encountered: