diff --git a/components/payment.js b/components/payment.js index 8bba56da90..73341cd14e 100644 --- a/components/payment.js +++ b/components/payment.js @@ -82,8 +82,8 @@ export const useInvoice = () => { } }, FAST_POLL_INTERVAL) - const abort = () => { - console.info(`invoice #${id}: stopped waiting`) + const abort = (invoiceId) => { + if (id !== invoiceId) return resolve() clearInterval(interval) signal.removeEventListener('abort', abort) @@ -92,7 +92,7 @@ export const useInvoice = () => { }) } - controller.stop = () => controller.abort() + controller.stop = (id) => controller.abort(id) return controller }, [isInvoice]) @@ -131,7 +131,7 @@ export const useWalletPayment = () => { console.error('payment failed:', err) throw err } finally { - invoice.stopWaiting() + invoice.stopWaiting(id) } }, [wallet, invoice])