From b214702a5e80395c3e4550e06a8b1daac93685fd Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 11 Nov 2024 10:26:12 +0530 Subject: [PATCH] Clear tx timeout --- .../frontend/src/components/projects/create/Configure.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/components/projects/create/Configure.tsx b/packages/frontend/src/components/projects/create/Configure.tsx index e45cba29..3aab266d 100644 --- a/packages/frontend/src/components/projects/create/Configure.tsx +++ b/packages/frontend/src/components/projects/create/Configure.tsx @@ -333,6 +333,7 @@ const Configure = () => { const senderAddress = selectedAccount; const snowballAddress = await client.getAddress(); + let timeoutId; try { setIsPaymentDone(false); @@ -365,7 +366,7 @@ const Configure = () => { window.addEventListener('message', handleTxStatus); // Set a timeout, consider unsuccessful after 1 min - setTimeout(() => { + timeoutId = setTimeout(() => { reject(new Error('Transaction timeout')); window.removeEventListener('message', handleTxStatus); toast({ @@ -382,6 +383,7 @@ const Configure = () => { throw new Error('Error in transaction'); } finally { setIsPaymentLoading(false); + clearTimeout(timeoutId); } }, [client, dismiss, toast],