aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
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/components
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/components')
-rw-r--r--src/components/Lnurlp.svelte9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/components/Lnurlp.svelte b/src/components/Lnurlp.svelte
index 2b715667..c1ae0c95 100644
--- a/src/components/Lnurlp.svelte
+++ b/src/components/Lnurlp.svelte
@@ -17,6 +17,8 @@
let amount = $state(Math.round(minSendable / 1000)),
loading = $state();
let submit = () => (loading = true);
+ // An action result (an error, since success redirects) ends the wait
+ $effect(() => form && (loading = false));
</script>
<div class="container px-4 mt-20 max-w-xl mx-auto space-y-2">
@@ -60,12 +62,15 @@
<div class="flex w-full gap-2">
{#if max >= Math.round(minSendable / 1000)}
+ <!-- loading is set by the form's onsubmit, not here: flipping
+ `disabled` from a click handler lands in the DOM before the
+ browser's submit activation runs, and a disabled button submits
+ nothing (the page just sat on a spinner). -->
<button
type="submit"
class="btn !w-auto grow"
formaction="?/max"
- disabled={loading}
- onclick={submit}>Max ⚡️{s(max)}</button
+ disabled={loading}>Max ⚡️{s(max)}</button
>
{/if}
<button bind:this={send} type="submit" class="btn btn-accent !w-auto grow">