Show todos immediately after subscribe() to a channel and publish() to the same channel #1852
-
I am fairly new to using graphql-yoga, so forgive me if this is a naive question or mistake from my side. Libraries used:Backend
Frontend
My understanding, there is something I am missing in the schema definition which is not showing the todo list when tried accessing Yoga Graphiql explorer. ScreenshotCodesandboxhttps://codesandbox.io/s/currying-firefly-pmgme6 Stackblitzhttps://stackblitz.com/edit/node-p64u5i Code SnippetsSchema definition
Server backend
Expected BehaviourIt should show the initial todo item as soon as it has subscribed and published in schema definition.
Actual Behaviour |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Because you publish before client subscribes the topic. |
Beta Was this translation helpful? Give feedback.
-
This is documented here https://www.the-guild.dev/graphql/yoga-server/v3/features/subscriptions#subscriptions-with-initial-value |
Beta Was this translation helpful? Give feedback.
This is documented here https://www.the-guild.dev/graphql/yoga-server/v3/features/subscriptions#subscriptions-with-initial-value