@@ -18,12 +18,14 @@ import {
1818 switchWalletModalAtom ,
1919} from 'lib/atoms/modals.atoms' ;
2020import { useAuth } from 'lib/auth/auth' ;
21+ import { reactQueryClient } from 'lib/clients/reactQueryClient' ;
2122import { apiServerUrl } from 'lib/env' ;
2223import { NormalizeProject } from 'lib/normalizers/projects/normalizeProjectsWithMetadata' ;
2324import { getCreditTypeQuery } from 'lib/queries/react-query/ecocredit/getCreditTypeQuery/getCreditTypeQuery' ;
2425import { getAllowedDenomQuery } from 'lib/queries/react-query/ecocredit/marketplace/getAllowedDenomQuery/getAllowedDenomQuery' ;
2526import { getPaymentMethodsQuery } from 'lib/queries/react-query/registry-server/getPaymentMethodsQuery/getPaymentMethodsQuery' ;
2627import { getSubscribersStatusQuery } from 'lib/queries/react-query/registry-server/getSubscribersStatusQuery/getSubscribersStatusQuery' ;
28+ import { getAccountByIdQueryKey } from 'lib/queries/react-query/registry-server/graphql/getAccountByIdQuery/getAccountByIdQuery.utils' ;
2729import { useWallet } from 'lib/wallet/wallet' ;
2830
2931import { useFetchUserBalance } from 'pages/BuyCredits/hooks/useFetchUserBalance' ;
@@ -224,6 +226,14 @@ export const BuyCreditsForm = ({
224226 [ data , handleSaveNext , setPaymentMethodId ] ,
225227 ) ;
226228
229+ const refreshProfileData = useCallback ( async ( ) => {
230+ if ( activeAccount ) {
231+ await reactQueryClient . invalidateQueries ( {
232+ queryKey : getAccountByIdQueryKey ( { id : activeAccount . id } ) ,
233+ } ) ;
234+ }
235+ } , [ activeAccount ] ) ;
236+
227237 const allowedDenoms = useMemo (
228238 ( ) => allowedDenomsData ?. allowedDenoms ,
229239 [ allowedDenomsData ?. allowedDenoms ] ,
@@ -325,6 +335,7 @@ export const BuyCreditsForm = ({
325335 } ,
326336 } ,
327337 } ) ;
338+ refreshProfileData ( ) ;
328339 }
329340
330341 if ( selectedSellOrders && creditsAmount )
@@ -362,14 +373,15 @@ export const BuyCreditsForm = ({
362373 project ,
363374 refetchSellOrders ,
364375 data ,
365- activeAccount ?. name ,
366376 activeAccount ?. id ,
377+ activeAccount ?. name ,
367378 creditsAmount ,
368379 purchase ,
369380 retiring ,
370381 paymentMethodId ,
371382 confirmationTokenId ,
372383 updateAccountById ,
384+ refreshProfileData ,
373385 currency ,
374386 _ ,
375387 allowedDenomsData ,
0 commit comments