fix: toggleDirection now reorders existing messages in DOM

This commit is contained in:
gramps
2026-07-14 13:43:01 -07:00
parent fbd734ccd4
commit 1f571f6284
+4
View File
@@ -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() {