feat: update scrollToBottom()

This commit is contained in:
SauceyRed 2025-06-07 05:45:06 +02:00
parent ccefc8ca19
commit 2c76edaa32
Signed by: sauceyred
GPG key ID: 270B096EF6E9A462
2 changed files with 5 additions and 5 deletions

View file

@ -144,7 +144,7 @@ if (accessToken && apiBase) {
await nextTick();
if (messagesElement.value) {
console.log("scrolling to bottom");
scrollToBottom(messagesElement);
scrollToBottom(messagesElement.value);
}
});
@ -168,7 +168,7 @@ const route = useRoute();
onMounted(async () => {
if (import.meta.server) return;
if (messagesElement.value) {
scrollToBottom(messagesElement);
scrollToBottom(messagesElement.value);
let fetched = false;
const amount = messages.value.length;
let offset = messages.value.length;

View file

@ -1,6 +1,6 @@
export default (element: Ref<HTMLElement | undefined, HTMLElement | undefined>) => {
if (element.value) {
element.value.scrollTo({ top: element.value.scrollHeight });
export default (element: HTMLElement) => {
if (element) {
element.scrollTo({ top: element.scrollHeight });
return;
}
}