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.

convert to useCallback this reduces the function allocations by 1 for each useQuery/useSubscription (#504)

authored by

Jovi De Croock and committed by
Phil Plückthun
2fb68ee1 e06098d1

+4 -4
+2 -2
src/hooks/useQuery.ts
··· 41 41 const request = useRequest(args.query, args.variables); 42 42 43 43 // Create a new query-source from client.executeQuery 44 - const makeQuery$ = useMemo( 45 - () => (opts?: Partial<OperationContext>) => { 44 + const makeQuery$ = useCallback( 45 + (opts?: Partial<OperationContext>) => { 46 46 return client.executeQuery(request, { 47 47 requestPolicy: args.requestPolicy, 48 48 pollInterval: args.pollInterval,
+2 -2
src/hooks/useSubscription.ts
··· 47 47 const request = useRequest(args.query, args.variables); 48 48 49 49 // Create a new subscription-source from client.executeSubscription 50 - const makeSubscription$ = useMemo( 51 - () => (opts?: Partial<OperationContext>) => { 50 + const makeSubscription$ = useCallback( 51 + (opts?: Partial<OperationContext>) => { 52 52 return client.executeSubscription(request, { ...args.context, ...opts }); 53 53 }, 54 54 [client, request, args.context]