Skip to content

Commit

Permalink
Fix: check KYC query running twice
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubcolony committed Jan 31, 2025
1 parent c2a41ed commit 97e6118
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import React, { type PropsWithChildren, useMemo } from 'react';

import { useAppContext } from '~context/AppContext/AppContext.ts';
import { useCheckKycStatusQuery } from '~gql';

import { CryptoToFiatContext } from './CryptoToFiatContext.ts';

const CryptoToFiatContextProvider: React.FC<PropsWithChildren> = ({
children,
}) => {
const { user } = useAppContext();
const { data, loading, refetch } = useCheckKycStatusQuery({
fetchPolicy: 'cache-and-network',
skip: !user,
});

const value = useMemo(
() => ({
refetchKycData: refetch,
kycStatusData: data?.bridgeCheckKYC,
bankAccountData: data?.bridgeCheckKYC?.bankAccount,
isKycStatusDataLoading: loading,
isKycStatusDataLoading: loading || !user,
}),
[data?.bridgeCheckKYC, loading, refetch],
[data?.bridgeCheckKYC, loading, refetch, user],
);

return (
Expand Down

0 comments on commit 97e6118

Please sign in to comment.