-
Notifications
You must be signed in to change notification settings - Fork 2.7k
GraphQLWsLink does not work together with fetchMore #12479
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
Comments
Hey @sebakerckhof 👋 We could really use a reproduction of some kind because its difficult to tell what the differences are. Both We don't need a reproduction of your system, just something that demonstrates the bug. Could you perhaps inspect the value emitted from each terminating link to see if there are differences there? Try adding this in your link chain to see the values emitted from those terminating links: const loggerLink = new ApolloLink((operation, forward) => {
return forward(operation).map((result) => {
console.log(result);
return result;
})
}) Try this both with |
The loggerlink returns the exact same data for both httplink and graphqlwslink What I also notice is that the query that executed via fetchMore does not get completed (complete message send from client to server) when the component unmounts. Only the initial query gets completed. |
Hmm, that sounds like for some reason the GraphQLWS-Server you are using is not sending the Looking at their code, that should always be sent - except if you are maybe using a different server implementation? Generally: Do you see the |
No, the complete event should only be send from server to browser if there are no further results. It only seems not to work in combination with fetchMore. |
Are you sure you don't want to use |
Just to be clear here - the GraphQL-WS-spec is just the transport protocol spec, it doesn't override the GraphQL spec itself, it just describes how to transport results of the GraphQL spec. The GraphQL spec defines the result of executing a query as a single map object containing
There is no wiggle room for more than one result here - this will slightly change with the |
I was indeed hoping to use similar mechanisms as So if we forget about that part, I think there's still an issue here (although not tied to the graphql-ws transport link), since I tried making a minimal reproduction to show this: https://github.com/sebakerckhof/graphql-defer-test |
Yes, you're right, there's a bug in there - we're tracking that one over in #12257. We'll need to revisit the whole implementation of |
Issue Description
I'm using the GraphQLWsLink to query data over a websocket.
This works fine, but it does not seem to work in combination with
fetchMore
.The image above shows 2 calls. The original call (via
useQuery
), which returns the data succesfully.Then we see a second call being launched via
fetchMore
. The operation is requested and the server returns the results, but the data returned fromuseQuery
is not updated. The results are also not added to the apollo client cache.This does work with a regular HttpLink.
Link to Reproduction
Not possible due to dependency on a public graphql-ws server...
Reproduction Steps
No response
@apollo/client
version3.13.5
The text was updated successfully, but these errors were encountered: