Remove unused forceWaitForPayment (#2529)

This commit is contained in:
ekzyis 2025-09-15 22:11:31 +02:00 committed by GitHub
parent e967455ded
commit 292a20bad5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,8 +10,7 @@ import { useWalletPayment } from '@/wallets/client/hooks'
this is just like useMutation with a few changes:
1. pays an invoice returned by the mutation
2. takes an onPaid and onPayError callback, and additional options for payment behavior
- namely forceWaitForPayment which will always wait for the invoice to be paid
- and persistOnNavigate which will keep the invoice in the cache after navigation
- persistOnNavigate which will keep the invoice in the cache after navigation
3. onCompleted behaves a little differently, but analogously to useMutation, ie clientside side effects
of completion can still rely on it
a. it's called before the invoice is paid for optimistic updates
@ -77,7 +76,7 @@ export function usePaidMutation (mutation,
// use the most inner callbacks/options if they exist
const {
onPaid, onPayError, forceWaitForPayment, persistOnNavigate,
onPaid, onPayError, persistOnNavigate,
update, waitFor = inv => inv?.actionState === 'PAID', updateOnFallback
} = { ...options, ...innerOptions }
const ourOnCompleted = innerOnCompleted || onCompleted
@ -107,7 +106,7 @@ export function usePaidMutation (mutation,
})
// should we wait for the invoice to be paid?
if (response?.paymentMethod === 'OPTIMISTIC' && !forceWaitForPayment) {
if (response?.paymentMethod === 'OPTIMISTIC') {
// onCompleted is called before the invoice is paid for optimistic updates
ourOnCompleted?.(data)
// don't wait to pay the invoice