Skip to content

refactor(scanner): unify through /scan, drop /send/scan and /receive/scan#1093

Closed
orveth wants to merge 3 commits into
masterfrom
fix/scanner-slowness
Closed

refactor(scanner): unify through /scan, drop /send/scan and /receive/scan#1093
orveth wants to merge 3 commits into
masterfrom
fix/scanner-slowness

Conversation

@orveth

@orveth orveth commented May 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Closes send scanner appears slow because decoding is async #1092: the send-flow scanner stayed open while it did async network work (LNURL ping in resolveSendDestination + quote in proceedWithSend). On slow internet the user couldn't tell the scan registered.
  • Fix path: delete /send/scan and /receive/scan entirely. The universal /scan route (_protected.scan.tsx) already does fully sync classification (classifyInput + validateBolt11) and just sets a URL hash + navigates. It doesn't have the slowness issue.
  • /send and /receive Scan icons now link to /scan with the current account passed through the URL (accountId / selectedAccountId). /scan preserves search params when forwarding to the destination, so the user's account selection is retained.
  • resolveSendDestination is now synchronous — dropped the redundant `isValidLightningAddress` pre-check. `getInvoiceFromLud16` already surfaces invalid addresses via toast later in the flow, so the pre-check just duplicated a round trip. This also speeds up the paste flow on /send.
  • No auto-continue: user lands on /send with the destination pinned (from URL hash → clientLoader → initialDestination) and clicks Continue manually. Same as /scan from the home page does today. Auto-continue can be a follow-up.

Net code change

4 files deleted, 4 files modified, +11 / -161 LOC.

Test plan

  • Scan a BOLT11 with amount from /send's Scan icon → land on /send with destination pinned and amount filled, click Continue → /send/confirm.
  • Scan a Lightning address from /send's Scan icon → land on /send with destination pinned, enter amount, Continue → /send/confirm.
  • Scan a Cashu token from /send's Scan icon → land on /receive/cashu/token (cross-flow handoff, account preserved as selectedAccountId).
  • Scan a Cashu token from /receive's Scan icon → land on /receive/cashu/token with the selected account preserved.
  • Scan a BOLT11 from /receive's Scan icon → land on /send (cross-flow).
  • Scan from the home page → still works as today.
  • Paste an LN address on /send → faster than before (no LNURL pre-ping), still toasts on invalid via getInvoiceFromLud16 when Continue is clicked.
  • Unparseable QR on /scan → toast and scanner stays open (existing behavior).
  • /scan's Cancel (X) button → still goes home.

Generated with Claude Code

resolveSendDestination becomes synchronous (dropped the redundant
isValidLightningAddress pre-check; getInvoiceFromLud16 already surfaces
invalid addresses via toast later in the send flow). The send-scanner
no longer awaits quote/network work — it classifies, sets the
destination on the store, marks a pendingContinue flag, and navigates
to /send. SendInput consumes the flag on mount and auto-fires
handleContinue, so the user lands on /send with the destination pinned
and the Continue button already in its loading state. Errors surface
as a toast on /send.

Closes #1092

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel

vercel Bot commented May 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agicash Ready Ready Preview, Comment May 20, 2026 10:35pm

Request Review

@supabase

supabase Bot commented May 20, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project hrebgkfhjpkbxpztqqke because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

…/scan

The send and receive flows now use the universal /scan route instead
of dedicated /send/scan and /receive/scan routes. /scan already does
sync classification (classifyInput + validateBolt11) so the slowness
from #1092 — scanner staying open during async network work — is
gone: the scanner closes the moment a QR decodes.

Scan icons on /send and /receive pass their currently selected
account through the URL (accountId / selectedAccountId), which /scan
preserves when forwarding to the destination route. Cross-flow scans
(e.g. cashu token scanned while on /send) work because each
destination route reads its own param name.

No auto-continue: user clicks Continue manually on /send, same as
when arriving via /scan from the home page today. resolveSendDestination
stays synchronous (kept from previous commit) so the paste flow on
/send also no longer pre-pings LNURL.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@orveth orveth changed the title fix(send): close scanner immediately, auto-continue on /send refactor(scanner): unify through /scan, drop /send/scan and /receive/scan May 20, 2026
The /scan route is entered with a slideUp transition (Scan icons on
/, /send, /receive); the close-X button slides down. Make the
classify-handler navigations match — close the scanner downward on
successful scan instead of sliding left to the destination route.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@gudnuf

gudnuf commented May 20, 2026

Copy link
Copy Markdown
Contributor

this changes the behavior of the send and receive scanners so closing in favor of #1096

@gudnuf gudnuf closed this May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

send scanner appears slow because decoding is async

2 participants