subtle change to usePaidMutation callback order

This commit is contained in:
keyan 2024-07-01 17:04:10 -05:00
parent 0aa5ba4955
commit 63e60fe2bc
1 changed files with 2 additions and 2 deletions

View File

@ -88,11 +88,11 @@ export function usePaidMutation (mutation,
hash: invoice.hash
}
}))
ourOnCompleted?.(data)
onPaid?.(client.cache, { data })
// block until the invoice to be marked as paid
// for pessimisitic actions, they won't show up on navigation until they are marked as paid
await invoiceWaiter.waitUntilPaid(invoice, inv => inv?.actionState === 'PAID')
ourOnCompleted?.(data)
onPaid?.(client.cache, { data })
} catch (e) {
console.error('usePaidMutation: failed to pay invoice', e)
onPayError?.(e, client.cache, { data })