Skip to content

Commit 1bb2378

Browse files
authored
fix(vue): deep options reactivity in subscriptions (#3616)
1 parent 92fdbd2 commit 1bb2378

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.changeset/many-kings-double.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@urql/vue': patch
3+
---
4+
5+
Fix deep options reactivity for subscriptions

packages/vue-urql/src/useQuery.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/* eslint-disable react-hooks/rules-of-hooks */
22

33
import type { Ref, WatchStopHandle } from 'vue';
4-
import { reactive } from 'vue';
5-
import { isRef, ref, shallowRef, watch, watchEffect } from 'vue';
4+
import { isRef, ref, shallowRef, watch, watchEffect, reactive } from 'vue';
65

76
import type { Subscription, Source } from 'wonka';
87
import { pipe, subscribe, onEnd } from 'wonka';

packages/vue-urql/src/useSubscription.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { Source } from 'wonka';
44
import { pipe, subscribe, onEnd } from 'wonka';
55

66
import type { Ref, WatchStopHandle } from 'vue';
7-
import { isRef, ref, shallowRef, watch, watchEffect } from 'vue';
7+
import { isRef, ref, shallowRef, watch, watchEffect, reactive } from 'vue';
88

99
import type {
1010
Client,
@@ -239,11 +239,13 @@ export function callUseSubscription<
239239
R = T,
240240
V extends AnyVariables = AnyVariables,
241241
>(
242-
args: UseSubscriptionArgs<T, V>,
242+
_args: UseSubscriptionArgs<T, V>,
243243
handler?: MaybeRef<SubscriptionHandler<T, R>>,
244244
client: Ref<Client> = useClient(),
245245
stops: WatchStopHandle[] = []
246246
): UseSubscriptionResponse<T, R, V> {
247+
const args = reactive(_args) as UseSubscriptionArgs<T, V>;
248+
247249
const data: Ref<R | undefined> = ref();
248250
const stale: Ref<boolean> = ref(false);
249251
const fetching: Ref<boolean> = ref(false);

0 commit comments

Comments
 (0)