Merge pull request #1971 from stackernews/fix-anon-failed-invoices

Don't poll failed invoices if anon
This commit is contained in:
Keyan 2025-03-12 20:25:12 -05:00 committed by GitHub
commit 0d93c92e30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -236,6 +236,7 @@ function RetryHandler ({ children }) {
const waitForWalletPayment = useWalletPayment()
const invoiceHelper = useInvoice()
const [getFailedInvoices] = useLazyQuery(FAILED_INVOICES, { fetchPolicy: 'network-only', nextFetchPolicy: 'network-only' })
const { me } = useMe()
const retry = useCallback(async (invoice) => {
const newInvoice = await invoiceHelper.retry({ ...invoice, newAttempt: true })
@ -255,6 +256,8 @@ function RetryHandler ({ children }) {
// we always retry failed invoices, even if the user has no wallets on any client
// to make sure that failed payments will always show up in notifications eventually
if (!me) return
const retryPoll = async () => {
let failedInvoices
try {
@ -298,7 +301,7 @@ function RetryHandler ({ children }) {
queuePoll()
return stopPolling
}, [wallets, getFailedInvoices, retry])
}, [me?.id, wallets, getFailedInvoices, retry])
return children
}