Skip to content

Commit

Permalink
Fix invoice.stopWaiting() stops waiting for all pending invoices
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzyis committed Nov 7, 2024
1 parent d117549 commit 26bbb6b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -92,7 +92,7 @@ export const useInvoice = () => {
})
}

controller.stop = () => controller.abort()
controller.stop = (id) => controller.abort(id)

return controller
}, [isInvoice])
Expand Down Expand Up @@ -131,7 +131,7 @@ export const useWalletPayment = () => {
console.error('payment failed:', err)
throw err
} finally {
invoice.stopWaiting()
invoice.stopWaiting(id)
}
}, [wallet, invoice])

Expand Down

0 comments on commit 26bbb6b

Please sign in to comment.