StrawberryShake not waiting for subscription to execute #8690
Unanswered
huysentruitw
asked this question in
Q&A
Replies: 1 comment
-
I am having the same issue. I don't have a way in code to know if the connection was successful. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We're using StrawberryShake in integration testing, but we are a bit stuck in how StrawberryShake subscribes to subscriptions.
F.e. if we write this scenario:
Then the subscription is made after the mutation has been executed, so
.Watch().Subscribe()
doesn't actually wait for the subscription to be made. In real-world scenario's, this could also cause problems as in code, when yourSubscribe
has succeeded, you expect to be kept up to date from that point in code, which is not the case. This behavior is the same for all transports (WebSocket, InMemory, HTTP).I've digged into the codebase and I believe this
Task.Run();
here is the problem:graphql-platform/src/StrawberryShake/Client/src/Core/OperationExecutor.Observable.cs
Line 57 in d8cf45d
Apart from being bad practice, I wonder why
Task.Run
is being used here? Can this be made soSubscribe
actually waits for the subscription to be made? Is there any other way to wait for the subscription to be established?Beta Was this translation helpful? Give feedback.
All reactions