Skip to content
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

fetch and watch for the same query at the same time produce unexpected results #1820

Open
diesieben07 opened this issue Oct 4, 2022 · 0 comments

Comments

@diesieben07
Copy link

diesieben07 commented Oct 4, 2022

Describe the bug

If a watch subscription for a query is active, a fetch on the same query cannot complete until the watch completes. This is, because ApolloClient will use the same underlying "Concast" (their multicasting observable implementation) for both queries. fetch will then wait for this Concast's promise, which will not complete until the whole Concast is complete, which cannot happen until the watch is complete.
I am not sure if it is worth working around this or if this should just be documented. But one of the two should be done. I just spent the past two hours digging through the source and the debugger trying to figure out why my Observable did not trigger.

To Reproduce
Steps to reproduce the behavior:

  1. Subscribe to watch().valueChanges on a Apollo.Query.
  2. At the same time, subscribe to fetch() on the same Apollo.Query
  3. Observe the 2nd subscription never triggering.

Expected behavior

A fetch should trigger, even if a watch is active for the same query at the same time.

Environment:

├── @angular/cli@14.0.7
├── @angular/core@14.2.4
├── @apollo/client@3.6.10
├── apollo-angular@4.0.1
├── graphql@16.6.0
└── typescript@4.7.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant