diff --git a/src/hooks/useQuery.ts b/src/hooks/useQuery.ts index c02462e426..6591b99706 100644 --- a/src/hooks/useQuery.ts +++ b/src/hooks/useQuery.ts @@ -41,8 +41,8 @@ export const useQuery = ( const request = useRequest(args.query, args.variables); // Create a new query-source from client.executeQuery - const makeQuery$ = useMemo( - () => (opts?: Partial) => { + const makeQuery$ = useCallback( + (opts?: Partial) => { return client.executeQuery(request, { requestPolicy: args.requestPolicy, pollInterval: args.pollInterval, diff --git a/src/hooks/useSubscription.ts b/src/hooks/useSubscription.ts index 9a3377eb33..ef0f82bb57 100644 --- a/src/hooks/useSubscription.ts +++ b/src/hooks/useSubscription.ts @@ -47,8 +47,8 @@ export const useSubscription = ( const request = useRequest(args.query, args.variables); // Create a new subscription-source from client.executeSubscription - const makeSubscription$ = useMemo( - () => (opts?: Partial) => { + const makeSubscription$ = useCallback( + (opts?: Partial) => { return client.executeSubscription(request, { ...args.context, ...opts }); }, [client, request, args.context]