aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Lnurlp.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/Lnurlp.svelte')
-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">