From 1eec6338e1146439b1dbc6207843fbc44dd13088 Mon Sep 17 00:00:00 2001 From: Owen Jacobson 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/MessageInput.svelte | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ui/lib/components/MessageInput.svelte') diff --git a/ui/lib/components/MessageInput.svelte b/ui/lib/components/MessageInput.svelte index b2746e0..03ac7fa 100644 --- a/ui/lib/components/MessageInput.svelte +++ b/ui/lib/components/MessageInput.svelte @@ -5,16 +5,16 @@ export let channel = null; let input; let value = ''; - let sending = false; + let pending = false; - $: disabled = (channel === null); + $: disabled = pending || (channel === null); async function handleSubmit() { if (channel !== null) { - sending = true; + pending = true; // TODO try/catch: await postToChannel(channel, value); - sending = false; + pending = false; value = ''; await tick(); input.focus(); @@ -23,6 +23,6 @@
- +
-- cgit v1.2.3