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:
Subscribe to watch().valueChanges on a Apollo.Query.
At the same time, subscribe to fetch() on the same Apollo.Query
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.
Describe the bug
If a
watch
subscription for a query is active, afetch
on the same query cannot complete until thewatch
completes. This is, becauseApolloClient
will use the same underlying "Concast" (their multicasting observable implementation) for both queries.fetch
will then wait for this Concast'spromise
, which will not complete until the whole Concast is complete, which cannot happen until thewatch
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:
watch().valueChanges
on aApollo.Query
.fetch()
on the sameApollo.Query
Expected behavior
A
fetch
should trigger, even if awatch
is active for the same query at the same time.Environment: