From c949a626b07540cbf324481d310b9842e6f8307e Mon Sep 17 00:00:00 2001
From: Kit La Touche <kit@transneptune.net>
Date: Tue, 25 Feb 2025 22:48:59 -0500
Subject: Don't scroll all the time as messages are added

Only once on load, then once per new message.
---
 ui/lib/components/ActiveChannel.svelte | 6 ++++++
 1 file changed, 6 insertions(+)

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

diff --git a/ui/lib/components/ActiveChannel.svelte b/ui/lib/components/ActiveChannel.svelte
index f7837aa..30b8385 100644
--- a/ui/lib/components/ActiveChannel.svelte
+++ b/ui/lib/components/ActiveChannel.svelte
@@ -2,6 +2,12 @@
   import MessageRun from './MessageRun.svelte';
 
   let { messageRuns, deleteMessage = async (id) => {} } = $props();
+
+  $effect(() => {
+    // This is just to force it to track messageRuns.
+    const _ = messageRuns;
+    document.querySelector('.message-run:last-child .message:last-child').scrollIntoView();
+  });
 </script>
 
 {#each messageRuns as { sender, ownMessage, messages }}
-- 
cgit v1.2.3

