fix(send-scanner): navigate before async work#1096
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
7b7b002 to
8391545
Compare
I don't think this matters much as its very unlikely to scan a lightning address. I have seen lightning addresses as a QR codes but usually people just type them in. |
| const convert = useConverter(sendAccount); | ||
|
|
||
| const handleDecode = async (input: string) => { | ||
| const classified = classifyInput(input); |
There was a problem hiding this comment.
hm I am not sure I like that we are now doing similar things in two places. e.g. bolt11 invoice now gets validated more than once
There was a problem hiding this comment.
more important than that, seems like a code smell that now send-scanner component is doing some stuff even after we navigate away that has nothing to do with scanning. seems cleaner to just redirect to /send and pass destination as hash and then let send page handle proceeding with the send
8391545 to
5a8098b
Compare
Rebased onto post-monorepo master; paths relocated app/ -> apps/web-wallet/app/. Original commits: - fix(send-scanner): pass scanned input via hash, let /send loader resolve
5a8098b to
2e60047
Compare
Summary
Minimum-viable fix for #1092 — the slowness on
/send/scanwas the scanner sitting on the camera view whileselectDestinationandproceedWithSendran their network round-trips. Two changes here:handleDecodeusing the sameclassifyInput+validateBolt11pair that/scanuses. Catches unparseable QRs, cashu tokens (unsupported in send context), and BOLT11s with wrong network / expired / missing amount. These toast and keep the scanner open — user can scan again without re-tapping.navigate('/send')fires immediately, thenselectDestination(LNURL pre-check) andproceedWithSend(quote) run with the scanner already unmounted.proceedWithSendsetsstatus: 'quoting'synchronously before its first await, soSendInput's Continue button mounts in loading state. On quote success the handler navigates to/send/confirm; on failure (or async LNURL fetch failure) the toast lands on/send.See discord for video demos of both cases
Behavior summary
The only behavior regression is the last row — LN addresses that pass format validation but fail the LNURL fetch close the scanner before toasting. Acceptable: the LNURL fetch is what makes the LN-address path slow in the first place, and gating navigation on it brings the slowness back. Could be mitigated later (e.g., a sync "looks-like" check + defer the async LNURL toast to /send only when needed).
Also note: unparseable QRs and cashu tokens now share a generic "scan a lightning invoice or lightning address" toast instead of the more specific old messages — single check, single error path.
Related