fix successive zap timing issues?
This commit is contained in:
parent
7b58edb77b
commit
ffe9983b80
|
@ -238,6 +238,7 @@ export const useInvoiceable = (onSubmit, options = defaultOptions) => {
|
|||
}
|
||||
|
||||
// if no cost is passed, just try the action first
|
||||
cost ??= formValues.amount
|
||||
if (!cost || (me && !options.forceInvoice)) {
|
||||
try {
|
||||
return await onSubmit(formValues, ...submitArgs)
|
||||
|
|
|
@ -162,23 +162,21 @@ export default function UpVote ({ item, className, pendingSats, setPendingSats }
|
|||
const zap = useDebounceCallback(async (sats) => {
|
||||
if (!sats) return
|
||||
const variables = { id: item.id, sats }
|
||||
try {
|
||||
setPendingSats(0)
|
||||
await act({
|
||||
variables,
|
||||
optimisticResponse: {
|
||||
act: {
|
||||
sats
|
||||
}
|
||||
act({
|
||||
variables,
|
||||
optimisticResponse: {
|
||||
act: {
|
||||
sats
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
}
|
||||
}).catch((error) => {
|
||||
if (payOrLoginError(error)) {
|
||||
showInvoiceModal({ amount: sats }, { variables })
|
||||
return
|
||||
}
|
||||
throw new Error({ message: error.toString() })
|
||||
}
|
||||
console.error(error)
|
||||
})
|
||||
setPendingSats(0)
|
||||
}, 500, [act, item?.id, showInvoiceModal, setPendingSats])
|
||||
|
||||
const disabled = useMemo(() => item?.mine || item?.meForward || item?.deletedAt,
|
||||
|
|
Loading…
Reference in New Issue