Skip to content

Commit

Permalink
fix: handle exceptions for the first hash value of a transaction (#633)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinoosss authored Nov 10, 2024
1 parent 75fb9fe commit eeba6df
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,16 @@ export const useTokenTransactionsPage = (
return allTransactions.pages.flatMap((page) => page?.transactions || []);
}, [allTransactions]);

const firstTransactionHash = useMemo(() => {
if (!transactions || transactions.length === 0) {
return '';
}

return transactions[0]?.hash;
}, [transactions]);

const { data, isFetched, status, isLoading, isFetching } = useMakeTransactionsWithTime(
`token-details/page/history/${currentNetwork.chainId}/${transactions?.[0].hash}/${tokenPath}`,
`token-details/page/history/${currentNetwork.chainId}/${firstTransactionHash}/${tokenPath}`,
transactions,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,16 @@ export const useTransactionHistoryPage = ({
);
}, [allTransactions?.pages]);

const firstTransactionHash = useMemo(() => {
if (!transactions || transactions.length === 0) {
return '';
}

return transactions[0]?.hash;
}, [transactions]);

const { data, isFetched, status, isLoading, isFetching } = useMakeTransactionsWithTime(
`history/page/all/${currentNetwork.chainId}/${transactions?.[0].hash}`,
`history/page/all/${currentNetwork.chainId}/${firstTransactionHash}`,
transactions,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,16 @@ export const useTransactionHistory = ({
return allTransactions.slice(0, blockIndex || 0);
}, [allTransactions, blockIndex]);

const firstTransactionHash = useMemo(() => {
if (!transactions || transactions.length === 0) {
return '';
}

return transactions[0]?.hash;
}, [transactions]);

const { data, isFetched, status, isLoading, isFetching } = useMakeTransactionsWithTime(
`history/common/all/${currentNetwork.chainId}/${transactions?.[0].hash}`,
`history/common/all/${currentNetwork.chainId}/${firstTransactionHash}`,
transactions,
);

Expand Down

0 comments on commit eeba6df

Please sign in to comment.