Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove tx history failed fetch 4 times #152

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/components/HistoryDialog/HistoryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ export const Item = forwardRef<HTMLDivElement, ItemProps>(function Item(props, r
const headingRef = useRef<HTMLHeadingElement>(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,
Expand All @@ -71,6 +75,9 @@ export const Item = forwardRef<HTMLDivElement, ItemProps>(function Item(props, r
});

useEffect(() => {
if (errorUpdateCount > 4) {
txHistory.remove(id);
}
if (txsStatus?.isSettled) {
if (txsStatus.isSuccess) {
txHistory.success(id);
Expand All @@ -79,7 +86,7 @@ export const Item = forwardRef<HTMLDivElement, ItemProps>(function Item(props, r
txHistory.fail(id);
}
}
}, [id, txsStatus]);
}, [errorUpdateCount, id, txsStatus]);

return (
<Accordion.Item
Expand Down