From 7838c335025c19be69bb02e25616c9f51d861a51 Mon Sep 17 00:00:00 2001 From: Riccardo Balbo Date: Tue, 5 Nov 2024 18:35:01 +0100 Subject: [PATCH] wait for invoice cancellation --- components/use-paid-mutation.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/use-paid-mutation.js b/components/use-paid-mutation.js index ff9105bfe..6b34fe0bc 100644 --- a/components/use-paid-mutation.js +++ b/components/use-paid-mutation.js @@ -54,7 +54,11 @@ export function usePaidMutation (mutation, if (response.retriable) { // every wallet failed, but we can still retry, so let's just cancel the invoice and ask for a better one - invoiceHelper.cancel(invoice).catch(console.error) + try { + await invoiceHelper.cancel(invoice) + } catch (err) { + console.error('usePaidMutation: failed to cancel invoice', err) + } const retry = retryPaidAction({ variables: { invoiceId: parseInt(invoice.id) } }) response = retry.data?.retryPaidAction invoice = response?.invoice