From 5c3a89354ea8e05e606f4c8c9ff7f9076a3e85b1 Mon Sep 17 00:00:00 2001 From: luciachizaram Date: Tue, 25 Aug 2026 16:33:03 +0100 Subject: [PATCH] docs: clarify post-fetch cancelledRef check in useClaim Re-check cancelledRef after await to guard against reset() firing while a fetch is in-flight. Refs #366 #367 #368. --- src/hooks/useClaim.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hooks/useClaim.ts b/src/hooks/useClaim.ts index 71f9c97..c7bb680 100644 --- a/src/hooks/useClaim.ts +++ b/src/hooks/useClaim.ts @@ -81,6 +81,7 @@ export function useClaim(policyId?: string) { if (cancelledRef.current) return; try { const result = await fetchClaim(currentClaimId); + // Re-check after await — reset() may have fired while the fetch was in-flight if (!active || cancelledRef.current) return; if (result) { if (cancelledRef.current) return;