Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.

fix(vue): Fix regression causing `pause` argument to not be reactive (#3595)

Co-authored-by: Phil Pluckthun <phil@kitten.sh>

Changed files
+13 -2
.changeset
packages
+5
.changeset/eight-mirrors-sing.md
···
···
+
---
+
'@urql/vue': patch
+
---
+
+
Fix regression causing `pause` argument on `useQuery` and `useSubscription` to not be reactive
+4 -1
packages/vue-urql/src/useQuery.ts
···
/* eslint-disable react-hooks/rules-of-hooks */
import type { WatchStopHandle, Ref } from 'vue';
import { shallowRef, ref, watchEffect, reactive } from 'vue';
import type { Subscription, Source } from 'wonka';
···
const operation: Ref<Operation<T, V> | undefined> = ref();
const extensions: Ref<Record<string, any> | undefined> = ref();
-
const isPaused = ref(!!unref(args.pause));
const input = shallowRef({
request: createRequest<T, V>(unref(args.query), unref(args.variables) as V),
···
/* eslint-disable react-hooks/rules-of-hooks */
import type { WatchStopHandle, Ref } from 'vue';
+
import { isRef } from 'vue';
import { shallowRef, ref, watchEffect, reactive } from 'vue';
import type { Subscription, Source } from 'wonka';
···
const operation: Ref<Operation<T, V> | undefined> = ref();
const extensions: Ref<Record<string, any> | undefined> = ref();
+
const isPaused: Ref<boolean> = isRef(_args.pause)
+
? _args.pause
+
: ref(!!_args.pause);
const input = shallowRef({
request: createRequest<T, V>(unref(args.query), unref(args.variables) as V),
+4 -1
packages/vue-urql/src/useSubscription.ts
···
import { pipe, subscribe, onEnd } from 'wonka';
import type { WatchStopHandle, Ref } from 'vue';
import { ref, shallowRef, watchEffect, reactive } from 'vue';
import type {
···
const extensions: Ref<Record<string, any> | undefined> = ref();
const scanHandler = ref(handler);
-
const isPaused = ref(!!unref(args.pause));
const input = shallowRef({
request: createRequest<T, V>(unref(args.query), unref(args.variables) as V),
···
import { pipe, subscribe, onEnd } from 'wonka';
import type { WatchStopHandle, Ref } from 'vue';
+
import { isRef } from 'vue';
import { ref, shallowRef, watchEffect, reactive } from 'vue';
import type {
···
const extensions: Ref<Record<string, any> | undefined> = ref();
const scanHandler = ref(handler);
+
const isPaused: Ref<boolean> = isRef(_args.pause)
+
? _args.pause
+
: ref(!!_args.pause);
const input = shallowRef({
request: createRequest<T, V>(unref(args.query), unref(args.variables) as V),