Skip to content

Commit 0d93c92

Browse files
authored
Merge pull request #1971 from stackernews/fix-anon-failed-invoices
Don't poll failed invoices if anon
2 parents 6715943 + 6f50b48 commit 0d93c92

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

wallets/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ function RetryHandler ({ children }) {
236236
const waitForWalletPayment = useWalletPayment()
237237
const invoiceHelper = useInvoice()
238238
const [getFailedInvoices] = useLazyQuery(FAILED_INVOICES, { fetchPolicy: 'network-only', nextFetchPolicy: 'network-only' })
239+
const { me } = useMe()
239240

240241
const retry = useCallback(async (invoice) => {
241242
const newInvoice = await invoiceHelper.retry({ ...invoice, newAttempt: true })
@@ -255,6 +256,8 @@ function RetryHandler ({ children }) {
255256
// we always retry failed invoices, even if the user has no wallets on any client
256257
// to make sure that failed payments will always show up in notifications eventually
257258

259+
if (!me) return
260+
258261
const retryPoll = async () => {
259262
let failedInvoices
260263
try {
@@ -298,7 +301,7 @@ function RetryHandler ({ children }) {
298301

299302
queuePoll()
300303
return stopPolling
301-
}, [wallets, getFailedInvoices, retry])
304+
}, [me?.id, wallets, getFailedInvoices, retry])
302305

303306
return children
304307
}

0 commit comments

Comments
 (0)