From 268b171ba4e5fd477ca0e95f89c79f69ea399767 Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 29 Apr 2026 12:11:45 -0700 Subject: [PATCH] Propagate abort signal to LNURL fetch in goal progress --- src/hooks/useGoalProgress.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hooks/useGoalProgress.ts b/src/hooks/useGoalProgress.ts index 9353e24e..636d4b24 100644 --- a/src/hooks/useGoalProgress.ts +++ b/src/hooks/useGoalProgress.ts @@ -45,7 +45,7 @@ function parseBolt11AmountMsats(bolt11: string | undefined): number { } } -async function resolveZapReceiptSigner(profileEvent: NostrEvent | undefined): Promise { +async function resolveZapReceiptSigner(profileEvent: NostrEvent | undefined, signal?: AbortSignal): Promise { if (!profileEvent) return undefined; let lnurl = ''; @@ -66,7 +66,7 @@ async function resolveZapReceiptSigner(profileEvent: NostrEvent | undefined): Pr if (!lnurl) return undefined; try { - const res = await fetch(lnurl, { signal: AbortSignal.timeout(5000) }); + const res = await fetch(lnurl, { signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(5000)]) : AbortSignal.timeout(5000) }); if (!res.ok) return undefined; const body = await res.json() as { allowsNostr?: boolean; nostrPubkey?: string }; return body.allowsNostr && /^[a-f0-9]{64}$/.test(body.nostrPubkey ?? '') @@ -126,7 +126,7 @@ export function useGoalProgress(goalEvent: NostrEvent | undefined, goal: ParsedG return { receipts: [] as { msats: number; sender: string; createdAt: number }[] }; } const signal = AbortSignal.any([c.signal, AbortSignal.timeout(8000)]); - const receiptSigner = await resolveZapReceiptSigner(author.data?.event); + const receiptSigner = await resolveZapReceiptSigner(author.data?.event, c.signal); const relay = goal.relays.length > 0 ? nostr.group(goal.relays) : nostr; const receipts = await relay.query(