From 1eec6338e1146439b1dbc6207843fbc44dd13088 Mon Sep 17 00:00:00 2001
From: Owen Jacobson <owen@grimoire.ca>
Date: Wed, 30 Oct 2024 18:01:48 -0400
Subject: Don't leave field binding vars uninitialized.

This was causing problems for changing passwords: if the user didn't type anything in the "original password" field, the code path to sending that field to the server was just straight-up omitting the field from the message, rather than setting it to empty string, causing a 422 Unprocessable Entity.

On investigation we had latent bugs related to this in a bunch of spots.
---
 ui/lib/components/CreateChannelForm.svelte | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'ui/lib/components/CreateChannelForm.svelte')

diff --git a/ui/lib/components/CreateChannelForm.svelte b/ui/lib/components/CreateChannelForm.svelte
index ddcf486..b716736 100644
--- a/ui/lib/components/CreateChannelForm.svelte
+++ b/ui/lib/components/CreateChannelForm.svelte
@@ -1,16 +1,17 @@
 <script>
     import { createChannel } from '$lib/apiServer';
 
-    let name = '';
-    let disabled = false;
+    let name = "";
+    let pending = false;
+    $: disabled = pending;
 
     async function handleSubmit(event) {
-        disabled = true;
+        pending = true;
         const response = await createChannel(name);
         if (200 <= response.status && response.status < 300) {
             name = '';
         }
-        disabled = false;
+        pending = false;
     }
 </script>
 
-- 
cgit v1.2.3

