Skip to content

Commit 62df723

Browse files
authored
fix(tarko): prevent auto-scroll on refresh for historical user messages (#1415)
1 parent 18dc008 commit 62df723

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

multimodal/tarko/agent-web-ui/src/standalone/chat/hooks/useScrollToBottom.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,13 @@ export const useScrollToBottom = ({
197197

198198
const latestUserMessage = allUserMessages[allUserMessages.length - 1];
199199

200-
// Auto-scroll if we have a new user message
201-
if (latestUserMessage?.id && latestUserMessage.id !== lastUserMessageIdRef.current) {
200+
// Auto-scroll ONLY if:
201+
// 1. We have a new user message
202+
// 2. It's the LAST user message (most recent one)
203+
// 3. It has the isLocalMessage flag (indicating it was just sent by user)
204+
if (latestUserMessage?.id &&
205+
latestUserMessage.id !== lastUserMessageIdRef.current &&
206+
latestUserMessage.isLocalMessage) {
202207
lastUserMessageIdRef.current = latestUserMessage.id;
203208

204209
const timer = setTimeout(autoScrollToBottom, SCROLL_CHECK_DELAY);

0 commit comments

Comments
 (0)