Skip to content

Commit

Permalink
fix: fix infinite vestings loading
Browse files Browse the repository at this point in the history
  • Loading branch information
belopash committed Jun 11, 2024
1 parent 791ea9c commit 94a5019
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/api/contracts/vesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function useVestingContracts({ addresses }: { addresses: `0x${string}`[]
allowFailure: true,
blockNumber: BigInt(currentHeight),
query: {
enabled: !isSquidHeightLoading && !!addresses.length,
enabled: !isSquidHeightLoading,
select: r => {
if (r?.some(r => r.status === 'success')) {
return chunk(r, 8).map(ch => ({
Expand Down Expand Up @@ -94,7 +94,11 @@ export function useVestingContracts({ addresses }: { addresses: `0x${string}`[]
| undefined
>(undefined);
useEffect(() => {
if (!addresses.length) res.current = [];
if (!addresses.length) {
res.current = [];
return;
}

if (!isLoading) res.current = data;
}, [addresses, data, isLoading]);

Expand Down

0 comments on commit 94a5019

Please sign in to comment.