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

Configure Feed

Select the types of activity you want to include in your feed.

perf(vue): use shallowRef for data (#3641)

authored by

Yurk Sha and committed by
GitHub
1315df1e c012b073

+11 -6
+5
.changeset/old-humans-knock.md
··· 1 + --- 2 + '@urql/vue': patch 3 + --- 4 + 5 + Use `shallowRef` for data variable to avoid extra overhead for heavy objects
+2 -2
packages/vue-urql/src/useMutation.ts
··· 1 1 /* eslint-disable react-hooks/rules-of-hooks */ 2 2 3 3 import type { Ref } from 'vue'; 4 - import { ref } from 'vue'; 4 + import { shallowRef } from 'vue'; 5 5 import { pipe, onPush, filter, toPromise, take } from 'wonka'; 6 6 7 7 import type { ··· 133 133 query: MaybeRef<DocumentInput<T, V>>, 134 134 client: Ref<Client> = useClient() 135 135 ): UseMutationResponse<T, V> { 136 - const data: Ref<T | undefined> = ref(); 136 + const data: Ref<T | undefined> = shallowRef(); 137 137 138 138 const { fetching, operation, extensions, stale, error } = useRequestState< 139 139 T,
+2 -2
packages/vue-urql/src/useQuery.ts
··· 1 1 /* eslint-disable react-hooks/rules-of-hooks */ 2 2 3 3 import type { Ref, WatchStopHandle } from 'vue'; 4 - import { ref, watchEffect } from 'vue'; 4 + import { shallowRef, watchEffect } from 'vue'; 5 5 6 6 import type { Subscription } from 'wonka'; 7 7 import { pipe, subscribe, onEnd } from 'wonka'; ··· 239 239 client: Ref<Client> = useClient(), 240 240 stops?: WatchStopHandle[] 241 241 ): UseQueryResponse<T, V> { 242 - const data: Ref<T | undefined> = ref(); 242 + const data: Ref<T | undefined> = shallowRef(); 243 243 244 244 const { fetching, operation, extensions, stale, error } = useRequestState< 245 245 T,
+2 -2
packages/vue-urql/src/useSubscription.ts
··· 3 3 import { pipe, subscribe, onEnd } from 'wonka'; 4 4 5 5 import type { Ref, WatchStopHandle } from 'vue'; 6 - import { isRef, ref, watchEffect } from 'vue'; 6 + import { shallowRef, isRef, watchEffect } from 'vue'; 7 7 8 8 import type { 9 9 Client, ··· 239 239 client: Ref<Client> = useClient(), 240 240 stops?: WatchStopHandle[] 241 241 ): UseSubscriptionResponse<T, R, V> { 242 - const data: Ref<R | undefined> = ref(); 242 + const data: Ref<R | undefined> = shallowRef(); 243 243 244 244 const { fetching, operation, extensions, stale, error } = useRequestState< 245 245 T,