Update screen/transactions/TransactionStatus.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Marcos Rodriguez Vélez 2024-11-23 16:47:27 -04:00 committed by GitHub
parent 6847802d40
commit a6d8975f66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -539,15 +539,19 @@ const TransactionStatus: React.FC<TransactionStatusProps> = ({ transaction, txid
useEffect(() => {
if (isLoading) {
let isComponentMounted = true;
const loadingTimeout = setTimeout(() => {
if (isLoading) {
if (isComponentMounted && isLoading) {
dispatch({ type: ActionType.SetLoadingError, payload: true });
dispatch({ type: ActionType.SetLoading, payload: false });
console.error('Loading timed out. There was an issue fetching the transaction.');
}
}, 10000);
return () => clearTimeout(loadingTimeout);
return () => {
isComponentMounted = false;
clearTimeout(loadingTimeout);
};
}
}, [isLoading]);