fix successive zap timing issues?

This commit is contained in:
keyan 2023-11-13 20:02:34 -06:00
parent 7b58edb77b
commit ffe9983b80
2 changed files with 11 additions and 12 deletions

View File

@ -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)

View File

@ -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,