Skip to content

Commit

Permalink
fixed key
Browse files Browse the repository at this point in the history
  • Loading branch information
Zetazzz committed Oct 7, 2024
1 parent 1ee8781 commit 609e577
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/interchainjs/src/codegen/react-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const useDefaultRpcClient = <TData = ProtobufRpcClient>({
throw new Error('Failed to connect to rpc client');
}

queryClient.setQueryData([DEFAULT_RPC_CLIENT_QUERY_KEY], client);
queryClient.setQueryData([key], client);

return client;
}, options);
Expand Down Expand Up @@ -128,10 +128,12 @@ export function buildUseQuery<TReq, TRes>(opts: UseQueryBuilderOptions<TReq, TRe
return <TData = TRes>({
request,
options,
rpcEndpoint
rpcEndpoint,
rpcClientQueryKey
}: UseQueryParams<TReq, TRes, TData>) => {
const queryClient = useQueryClient();
const queryKey = rpcEndpoint ? [DEFAULT_RPC_CLIENT_QUERY_KEY, rpcEndpoint] : [DEFAULT_RPC_CLIENT_QUERY_KEY];
const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY;
const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [key];
const rpc = queryClient.getQueryData<Rpc>(queryKey);
const queryFn = opts.builderQueryFn(()=>{
return rpc;
Expand Down

0 comments on commit 609e577

Please sign in to comment.