aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-21 19:41:37 -0700
committerAdam Soltys <[email protected]>2026-09-21 19:41:39 -0700
commit2e98fba55d572186f39d00235db1024791ba1561 (patch)
tree24f65c725540f400b913116017db896700a6ffc0 /src/routes
parentefeab01cd99c5f57e7c904df96030fc518371fa2 (diff)
downloadcoinos-ui-2e98fba55d572186f39d00235db1024791ba1561.tar.gz
coinos-ui-2e98fba55d572186f39d00235db1024791ba1561.zip
send: stop the Max buttons from cancelling their own submit, show LNURL action errors
Choosing Max on the LNURL-pay page left the button spinning forever. Two things combined: The Max buttons set `loading` from their click handler. Svelte flushes `disabled={loading}` to the DOM before the browser runs the button's submit activation, and a disabled button submits nothing. Set loading from the form's onsubmit instead, the way the Send button always did. The /ln page never passed `form` into the Lnurlp and Lnurlw components, so any action failure (pay, max or withdraw) rendered nothing and never reset the spinner. Pass it through, and reset loading when a result arrives. Verified in headless Chrome against the dev stack: the bolt11 Max lands on the fee view, and the LNURL Max surfaces the server's error and re-enables the buttons. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/(app)/ln/[lnurl]/+page.svelte8
-rw-r--r--src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte11
2 files changed, 14 insertions, 5 deletions
diff --git a/src/routes/(app)/ln/[lnurl]/+page.svelte b/src/routes/(app)/ln/[lnurl]/+page.svelte
index 386df9d2..0f1b030f 100644
--- a/src/routes/(app)/ln/[lnurl]/+page.svelte
+++ b/src/routes/(app)/ln/[lnurl]/+page.svelte
@@ -1,12 +1,14 @@
<script>
import Lnurlp from "$comp/Lnurlp.svelte";
import Lnurlw from "$comp/Lnurlw.svelte";
- let { data } = $props();
+ let { data, form } = $props();
let { tag } = data;
</script>
+<!-- form carries the action result; without it a failed pay/max/withdraw
+ showed nothing and left the button spinning forever -->
{#if tag === "payRequest"}
- <Lnurlp {data} />
+ <Lnurlp {data} {form} />
{:else if tag === "withdrawRequest"}
- <Lnurlw {data} />
+ <Lnurlw {data} {form} />
{/if}
diff --git a/src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte b/src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte
index c84e5d53..d3d9f757 100644
--- a/src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte
+++ b/src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte
@@ -174,7 +174,13 @@
{/if}
</form>
{:else}
- <form method="POST" action="?/setAmount" class="space-y-2" use:enhance>
+ <form
+ method="POST"
+ action="?/setAmount"
+ class="space-y-2"
+ use:enhance
+ onsubmit={submit}
+ >
<input type="hidden" value={a} name="amount" />
<input name="rate" value={$rate} type="hidden" />
@@ -187,12 +193,13 @@
/>
<div class="flex justify-center gap-2">
+ <!-- no onclick: see Lnurlp.svelte — disabling from the click
+ handler cancels the submit; the form's onsubmit sets loading -->
<button
type="submit"
class="btn !w-auto grow"
formaction="?/max"
disabled={loading}
- onclick={submit}
>
{#if loading}
<Spinner />