From 656a8110d30fb0774902dbd6e92c173f5f6b072c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 25 Jun 2026 16:05:36 -0700 Subject: Gift claim: show a loading screen while checking, not the claimable amount Avoids flashing 'You've been sent Bitcoin' before flipping to 'Already claimed' for a spent gift. Offline fallback clears the checking flag so the loader can't hang. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app.js | 15 +++++++++++++++ src/i18n.js | 1 + 2 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/app.js b/src/app.js index 47f37fa..5ea8eec 100644 --- a/src/app.js +++ b/src/app.js @@ -856,6 +856,7 @@ function enterOfflineFallback() { wallet.setOffline(true); wallet.deriveWindow(40); ui.offlineFallback = true; + ui.claimChecking = false; // can't verify a gift offline; don't hang on the loader ui.tab = 'settings'; render(); } @@ -1518,6 +1519,20 @@ function claimScreen() { ) ); } + // While verifying the gift is still unclaimed, show a loading screen rather + // than flashing the claimable amount (which would then jump to "already + // claimed" for a spent gift). + if (ui.claimChecking) { + return h( + 'div', + { class: 'col', style: 'gap:16px' }, + brandHeader(false), + h('div', { class: 'card col', style: 'align-items:center;text-align:center;gap:14px;padding:32px 14px' }, + h('span', { class: 'spinner' }), + h('p', { class: 'muted', style: 'margin:0' }, t('giftChecking')) + ) + ); + } // Already claimed (funding coin spent, possibly only in the mempool) — show a // dead end with a link to the claim, instead of a claimable amount. if (ui.claimTaken) { diff --git a/src/i18n.js b/src/i18n.js index 65171f7..2a52d22 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -207,6 +207,7 @@ const STR = { giftSplitFirst: 'Split a coin first', giftLockWhole: 'Lock the whole coin ({n})', giftSplitFailed: 'Could not split the coin.', + giftChecking: 'Opening your gift…', giftTakenTitle: 'Already claimed', giftTakenBody: 'Sorry, this gift has already been claimed.', giftHistoryTitle: 'Gift link', -- cgit v1.2.3