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
I believe you can use the onData callback of useSubscription for this.
functionMyComponent(){constcalledRef=useRef(false);const{ loading, data }=useSubscription(subscription,{onData({ data }){if(!calledRef.current){calledRef.current=true;console.log(data)// execute your mutation here}},});}
I believe beyond that, we can't really do a lot here - React doesn't wait for something to happen before rendering, it just synchronously renders your component.
As a result I'm going to close this issue - if you have any further usage questions, please also consider joining our Discord - we try to keep the issue tracker for bug reports and usage questions more in the Discord.
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.
Intended outcome:
I want to implement response for mutation to come through websocket.
I.e.
But I can call mutation only after I can confirm I subscribed to subscription
Actual outcome:
loading
is true when I subscribed to subscriptionHow to reproduce the issue:
Just subscribe to subscription
Versions
version 3
The text was updated successfully, but these errors were encountered: