diff --git a/__fixtures__/v-next/outputhelperfunc/react-query.ts b/__fixtures__/v-next/outputhelperfunc/react-query.ts index 011a930fb..65cf59ccc 100644 --- a/__fixtures__/v-next/outputhelperfunc/react-query.ts +++ b/__fixtures__/v-next/outputhelperfunc/react-query.ts @@ -63,7 +63,9 @@ export const useRpcClient = ({ options, rpcClientQueryKey, }: UseRpcClientQuery) => { - const queryClient = useQueryClient(); + const queryClient = useQueryClient({ + context: options?.context + }); const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; return useQuery([key, rpcEndpoint], async () => { if(!rpcEndpoint) { @@ -120,7 +122,9 @@ export function buildUseQuery(opts: UseQueryBuilderOptions) => { - const queryClient = useQueryClient(); + const queryClient = useQueryClient({ + context: options?.context + }); const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [key]; const rpc = queryClient.getQueryData(queryKey); @@ -137,7 +141,7 @@ export interface UseQueryParams extends ReactQueryPara } export interface ReactMutationParams { - options?: MutationOptions; + options?: UseMutationOptions; rpcEndpoint?: string | HttpEndpoint; signingClientQueryKey?: string; } @@ -159,7 +163,9 @@ export function buildUseMutation(opts: UseMutationBuilderOptions>) => { - const queryClient = useQueryClient(); + const queryClient = useQueryClient({ + context: options?.context + }); const key = signingClientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [DEFAULT_SIGNING_CLIENT_QUERY_KEY]; const signingClient = queryClient.getQueryData(queryKey); diff --git a/__fixtures__/v-next/outputicjs/react-query.ts b/__fixtures__/v-next/outputicjs/react-query.ts index 3e95c229a..35967eb19 100644 --- a/__fixtures__/v-next/outputicjs/react-query.ts +++ b/__fixtures__/v-next/outputicjs/react-query.ts @@ -61,7 +61,9 @@ export const useRpcClient = ({ options, rpcClientQueryKey, }: UseRpcClientQuery) => { - const queryClient = useQueryClient(); + const queryClient = useQueryClient({ + context: options?.context + }); const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; return useQuery([key, rpcEndpoint], async () => { if(!rpcEndpoint) { @@ -93,7 +95,9 @@ export function buildUseQuery(opts: UseQueryBuilderOptions) => { - const queryClient = useQueryClient(); + const queryClient = useQueryClient({ + context: options?.context + }); const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [key]; const rpc = queryClient.getQueryData(queryKey); @@ -110,7 +114,7 @@ export interface UseQueryParams extends ReactQueryPara } export interface ReactMutationParams { - options?: MutationOptions; + options?: UseMutationOptions; rpcEndpoint?: string | HttpEndpoint; signingClientQueryKey?: string; } @@ -132,7 +136,9 @@ export function buildUseMutation(opts: UseMutationBuilderOptions>) => { - const queryClient = useQueryClient(); + const queryClient = useQueryClient({ + context: options?.context + }); const key = signingClientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [DEFAULT_SIGNING_CLIENT_QUERY_KEY]; const signingClient = queryClient.getQueryData(queryKey); diff --git a/packages/telescope/src/helpers/react-query-hooks-icjs.ts b/packages/telescope/src/helpers/react-query-hooks-icjs.ts index 17d08dea0..13cf16860 100644 --- a/packages/telescope/src/helpers/react-query-hooks-icjs.ts +++ b/packages/telescope/src/helpers/react-query-hooks-icjs.ts @@ -78,7 +78,9 @@ export const useRpcClient = ({ options, rpcClientQueryKey, }: UseRpcClientQuery) => { - const queryClient = useQueryClient(); + const queryClient = useQueryClient({ + context: options?.context + }); const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; return useQuery([key, rpcEndpoint], async () => { if(!rpcEndpoint) { @@ -110,7 +112,9 @@ export function buildUseQuery(opts: UseQueryBuilderOptions) => { - const queryClient = useQueryClient(); + const queryClient = useQueryClient({ + context: options?.context + }); const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [key]; const rpc = queryClient.getQueryData(queryKey); @@ -127,7 +131,7 @@ export interface UseQueryParams extends ReactQueryPara } export interface ReactMutationParams { - options?: MutationOptions; + options?: UseMutationOptions; rpcEndpoint?: string | HttpEndpoint; signingClientQueryKey?: string; } @@ -149,7 +153,9 @@ export function buildUseMutation(opts: UseMutationBuilderOptions>) => { - const queryClient = useQueryClient(); + const queryClient = useQueryClient({ + context: options?.context + }); const key = signingClientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [DEFAULT_SIGNING_CLIENT_QUERY_KEY]; const signingClient = queryClient.getQueryData(queryKey); diff --git a/packages/telescope/src/helpers/react-query-hooks.ts b/packages/telescope/src/helpers/react-query-hooks.ts index 2923a24ba..e935e134b 100644 --- a/packages/telescope/src/helpers/react-query-hooks.ts +++ b/packages/telescope/src/helpers/react-query-hooks.ts @@ -82,7 +82,9 @@ export const useRpcClient = ({ options, rpcClientQueryKey, }: UseRpcClientQuery) => { - const queryClient = useQueryClient(); + const queryClient = useQueryClient({ + context: options?.context + }); const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; return useQuery([key, rpcEndpoint], async () => { if(!rpcEndpoint) { @@ -151,7 +153,9 @@ export function buildUseQuery(opts: UseQueryBuilderOptions) => { - const queryClient = useQueryClient(); + const queryClient = useQueryClient({ + context: options?.context + }); const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [key]; const rpc = queryClient.getQueryData(queryKey); @@ -168,7 +172,7 @@ export interface UseQueryParams extends ReactQueryPara } export interface ReactMutationParams { - options?: MutationOptions; + options?: UseMutationOptions; rpcEndpoint?: string | HttpEndpoint; signingClientQueryKey?: string; } @@ -190,7 +194,9 @@ export function buildUseMutation(opts: UseMutationBuilderOptions>) => { - const queryClient = useQueryClient(); + const queryClient = useQueryClient({ + context: options?.context + }); const key = signingClientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [DEFAULT_SIGNING_CLIENT_QUERY_KEY]; const signingClient = queryClient.getQueryData(queryKey);