From 94bbdccf67bb908ed2033c7a475b48161e394d24 Mon Sep 17 00:00:00 2001 From: innolove-dev Date: Mon, 31 Aug 2026 16:43:23 +0100 Subject: [PATCH] fix(claim): stop claim page crashing on links with no events relation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API stopped selecting the SendLink `events` relation post-ledger-collapse, so `claimLinkData.events` is now always undefined. Claim.tsx dereferenced `events[0]` with the optional chain on the wrong side of the index, throwing "Cannot read properties of undefined (reading '0')" inside a render-phase useMemo — which Next.js surfaces as "Application error: a client-side exception has occurred" (Sentry PEANUT-UI-SJ0). Guard the array itself and mark `events` optional on the SendLink type so the compiler catches the next orphaned access. --- src/components/Claim/Claim.tsx | 5 ++++- src/services/services.types.ts | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Claim/Claim.tsx b/src/components/Claim/Claim.tsx index dbd6cda8dd..ff197595e6 100644 --- a/src/components/Claim/Claim.tsx +++ b/src/components/Claim/Claim.tsx @@ -181,7 +181,10 @@ export const Claim = ({}) => { initials: getInitialsFromName(recipientName), memo: claimLinkData.textContent, attachmentUrl: claimLinkData.fileUrl, - cancelledDate: status === 'cancelled' ? new Date(claimLinkData.events[0]?.timestamp) : undefined, + cancelledDate: + status === 'cancelled' && claimLinkData.events?.[0] + ? new Date(claimLinkData.events[0].timestamp) + : undefined, txHash: claimLinkData.claim?.txHash, extraDataForDrawer: { isLinkTransaction: true, diff --git a/src/services/services.types.ts b/src/services/services.types.ts index 4cc97869fe..99be569dcc 100644 --- a/src/services/services.types.ts +++ b/src/services/services.types.ts @@ -374,7 +374,8 @@ export type SendLink = { }[] } } - events: { + /** Absent post-ledger-collapse: the API no longer selects the `events` relation. */ + events?: { timestamp: Date status: SendLinkStatus reason?: string