From d26688c9e1271666ec90592318dfc0141d56aa3d Mon Sep 17 00:00:00 2001 From: Maximilian Martin Date: Mon, 17 Aug 2026 15:53:16 +0000 Subject: [PATCH] fix: scroll to bottom works also for long messages Signed-off-by: Maximilian Martin --- src/composables/useGetMessages.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/composables/useGetMessages.ts b/src/composables/useGetMessages.ts index 0fea230f783..3dcc9692010 100644 --- a/src/composables/useGetMessages.ts +++ b/src/composables/useGetMessages.ts @@ -257,8 +257,9 @@ export function useGetMessagesProvider() { * @param messageId * @param threadId * @param highlight + * @param focus */ - async function checkContextAndFocusMessage(token: string, messageId: number, threadId: number, highlight: boolean = false) { + async function checkContextAndFocusMessage(token: string, messageId: number, threadId: number, highlight: boolean = false, focus: boolean = true) { if (!chatStore.hasMessage(token, { messageId, threadId })) { // message not found in the list, need to fetch it first await getMessageContext(token, messageId, threadId) @@ -283,11 +284,13 @@ export function useGetMessagesProvider() { } } - // need some delay (next tick is too short) to be able to run - // after the browser's native "scroll to anchor" from the hash - window.setTimeout(() => { - EventBus.emit('focus-message', { messageId, highlight }) - }, 2) + if (focus) { + // need some delay (next tick is too short) to be able to run + // after the browser's native "scroll to anchor" from the hash + window.setTimeout(() => { + EventBus.emit('focus-message', { messageId, highlight }) + }, 2) + } } /** @@ -295,7 +298,7 @@ export function useGetMessagesProvider() { */ async function setContextIdToBottom() { contextMessageId.value = conversationLastMessageId.value - await checkContextAndFocusMessage(currentToken.value, contextMessageId.value, contextThreadId.value) + await checkContextAndFocusMessage(currentToken.value, contextMessageId.value, contextThreadId.value, false, false) } /**