11'use client' ;
22
3- import { useCallback , useMemo , useState } from 'react' ;
3+ import { useCallback , useEffect , useMemo , useState } from 'react' ;
44import type { Hex } from 'viem' ;
55import { useQueryClient } from '@tanstack/react-query' ;
66import { AlertTriangle , Plug , RotateCw } from 'lucide-react' ;
@@ -9,11 +9,12 @@ import { Button } from '@/app/components/ui/button';
99import { TransactionFilters } from '@/app/components/transactions/transaction-filters' ;
1010import { TransactionList } from '@/app/components/transactions/transaction-list' ;
1111import { ClaimResultModal } from '@/app/components/transactions/claim-result-modal' ;
12- import { useTransactions } from '@/app/hooks/useTransactions' ;
12+ import { TOTAL_REFETCH_TIME , useTransactions } from '@/app/hooks/useTransactions' ;
1313import { useClaimExecution } from '@/app/hooks/useClaimExecution' ;
1414import { useEnforceCorrectChain } from '@/app/hooks/useEnforceCorrectChain' ;
1515import { useWallet } from '@/app/context/wallet' ;
1616import { useAppMode } from '@/app/context/app-mode' ;
17+ import { useRefetch } from '@/app/context/refetch' ;
1718import type { TransactionStatus , Transaction } from '@/app/types/transaction' ;
1819import { getTransactionInitialStatus } from '@/app/components/transactions/intialStatus' ;
1920import { TransactionDetailsModal } from '@/app/components/transactions/transactions-details-modal/transaction-details-modal' ;
@@ -23,6 +24,7 @@ import { cn } from '@/app/utils/common';
2324export const TransactionsView = ( ) => {
2425 const { address, status, chainId, connect } = useWallet ( ) ;
2526 const { defaultFromChainId, chains, bridgeAddress } = useAppMode ( ) ;
27+ const { aggressiveRefetch, triggerAggressiveRefetch, clearAggressiveRefetch } = useRefetch ( ) ;
2628 const queryClient = useQueryClient ( ) ;
2729 const initialStatus = getTransactionInitialStatus ( ) ;
2830 const [ filters , setFilters ] = useState < { status ?: TransactionStatus ; updatedSince ?: number } > ( ( ) => ( {
@@ -51,12 +53,21 @@ export const TransactionsView = () => {
5153 chainId : effectiveChainId ,
5254 filters : queryFilters ,
5355 enabled : isConnected ,
56+ aggressiveRefetch,
5457 } ) ;
5558
59+ // Auto-disable aggressive mode after burst completes
60+ useEffect ( ( ) => {
61+ if ( ! aggressiveRefetch ) return ;
62+ const timeout = setTimeout ( clearAggressiveRefetch , TOTAL_REFETCH_TIME ) ;
63+ return ( ) => clearTimeout ( timeout ) ;
64+ } , [ aggressiveRefetch , clearAggressiveRefetch ] ) ;
65+
5666 const handleClaimComplete = useCallback ( ( ) => {
67+ triggerAggressiveRefetch ( ) ;
5768 refetch ( ) ;
5869 queryClient . invalidateQueries ( { queryKey : [ 'ready-to-claim-count' ] } ) ;
59- } , [ queryClient , refetch ] ) ;
70+ } , [ queryClient , refetch , triggerAggressiveRefetch ] ) ;
6071
6172 const ensureCorrectChain = useEnforceCorrectChain ( ) ;
6273 const claimExecution = useClaimExecution ( {
0 commit comments