fix: scroll to the top of a chat on the first click of Scroll to Top (#28659)

This commit is contained in:
G30
2026-08-17 02:40:14 -04:00
committed by GitHub
parent 16f118d77a
commit ad72dc6658

View File

@@ -159,12 +159,17 @@
messagesCount = null;
buildMessages();
await tick();
if (messages.length > 0) {
const firstMessageEl = document.getElementById(`message-${messages[0].id}`);
if (firstMessageEl) {
firstMessageEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
}
const element = getMessagesContainer();
if (!element) return;
element.scrollTo({ top: 0, behavior: 'smooth' });
requestAnimationFrame(() => {
element.scrollTo({ top: 0, behavior: 'smooth' });
requestAnimationFrame(() => {
element.scrollTo({ top: 0, behavior: 'smooth' });
});
});
};
const updateChat = async () => {