-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to updateQueries when a subscription result arrives? #1265
Comments
Might be related to #1224. |
Ah, I see this is more about subscriptions. Here is an example: https://github.com/graphcool-examples/react-apollo-instagram-subscriptions-example Of particular interest: https://github.com/graphcool-examples/react-apollo-instagram-subscriptions-example/blob/master/src/components/ListPage.js#L24 This |
@marktani thanks for taking the time to answer.
You mean For example, I have a |
Ahh, actually that didn't occur to me. Might be the case. But if you check the returned object it has the query name return {
viewerMessages: ...,
viewerMessage: ....
} |
Let me check ... :) |
In my top level |
@HriBB we're working on a set of imperative store update functions (read a fragment from the store, write a fragment to the store). Hopefully you'll be able to use that for your problem. You could still use |
The imperative store functions are available for you to use today! https://dev-blog.apollodata.com/apollo-clients-new-imperative-store-api-6cb69318a1e3#.p44izsa28 If you are using |
I have been trying to wrap my head around graphql subscriptions and how to implement them in my app. I want to do a simple messaging system, where a
Salon
and aCustomer
can communicate via WebSocket. I have a workingsubscribeToMore
implementation, and usingupdateQuery
, I can inject new data into a single query. But how can update other queries? Basically I want to doupdateQueries
for a subscription. How can we do that?Issue #644 suggests to use a
reducer
, but I don't think this is a solution to my problem.Anyways, this is my schema ATM
And on the client I have three different views, each with it's own query:
AppContainer (root container, has subscription)
UserMessageListContainer
UserMessageContainer
So when
AppContainer
receives anewMessage
via WebSocket, I want to update bothviewerMessageList
andviewerMessage
as necessary. Or is there a better way?Any help would be greatly appreciated ;)
The text was updated successfully, but these errors were encountered: