From b313370996d99577992e62ee235831b99e161caa Mon Sep 17 00:00:00 2001 From: Nur Fikri Date: Sat, 3 Feb 2024 04:20:49 +0700 Subject: [PATCH] feat: remove tx history failed fetch 4 times --- src/components/HistoryDialog/HistoryList.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/HistoryDialog/HistoryList.tsx b/src/components/HistoryDialog/HistoryList.tsx index 30a78bd0..ec0eb1fb 100644 --- a/src/components/HistoryDialog/HistoryList.tsx +++ b/src/components/HistoryDialog/HistoryList.tsx @@ -61,7 +61,11 @@ export const Item = forwardRef(function Item(props, r const headingRef = useRef(null); const estimatedFinalityTime = useFinalityTimeEstimate(data.route); - const { data: txsStatus, isLoading } = useBroadcastedTxsStatus({ + const { + data: txsStatus, + isLoading, + errorUpdateCount, + } = useBroadcastedTxsStatus({ txsRequired: data.route.txsRequired, txs: data.txStatus.map((item) => ({ chainID: item.chainId, @@ -71,6 +75,9 @@ export const Item = forwardRef(function Item(props, r }); useEffect(() => { + if (errorUpdateCount > 4) { + txHistory.remove(id); + } if (txsStatus?.isSettled) { if (txsStatus.isSuccess) { txHistory.success(id); @@ -79,7 +86,7 @@ export const Item = forwardRef(function Item(props, r txHistory.fail(id); } } - }, [id, txsStatus]); + }, [errorUpdateCount, id, txsStatus]); return (