In the example above, if we set a.value = 2 and inspect websocket traffic or debug the code we notice that subscribeToMore is called twice, setting up two subscriptions with variables a: 2. One of the new subscriptions is then then immediately closed/completed.
If we instead passed a plain object to subscribeToMore like this:
Describe the bug It seems that
subscribeToMore
is called twice when a query and a subscription both depend on a reactive variable.To Reproduce Example:
In the example above, if we set
a.value = 2
and inspect websocket traffic or debug the code we notice thatsubscribeToMore
is called twice, setting up two subscriptions with variablesa: 2
. One of the new subscriptions is then then immediately closed/completed.If we instead passed a plain object to
subscribeToMore
like this:subscribeToMore
would only be invoked once but with the old value1
, we want the subscription to be started with the new value2
, same as the query.Our guess is that this happens because when
a.value
is changed:useQuery
stops & starts and triggerssubscribeToMore
subscribeToMore
triggers awatch
which in turn triggerssubscribeToMore
Expected behavior
subscribeToMore
to be called once with variablea: 2
after variablea
was changed to2
.Versions vue:
3.4.21
@vue/apollo-composable:4.0.2
@vue/apollo-option:4.0.0
@apollo/client:3.7.1