From 1f571f6284d927b78ab2d183476e8807cce32eb2 Mon Sep 17 00:00:00 2001 From: gramps Date: Tue, 14 Jul 2026 13:43:01 -0700 Subject: [PATCH] fix: toggleDirection now reorders existing messages in DOM --- templates/index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/index.html b/templates/index.html index 4cc303c..bd9286a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1624,6 +1624,10 @@ function toggleDirection() { localStorage.setItem('waterfallDirection', _waterfallDirection); const badge = document.getElementById('directionBadge'); if (badge) badge.textContent = _waterfallDirection === 'newest' ? 'NEW' : 'OLD'; + const container = document.getElementById('chatContainer'); + const items = Array.from(container.children); + items.reverse().forEach(el => container.appendChild(el)); + scrollToLatest(); } let _userScrolledAway = false; document.getElementById('chatContainer')?.addEventListener('scroll', function() {