[GH-ISSUE #15997] app/ui: chat doesn't scroll to the bottom on page refresh or when switching conversations #87874

Open
opened 2026-05-10 06:29:34 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @matteocelani on GitHub (May 6, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15997

What is the issue?

When you open a long chat via a direct link or refresh the page, the chat stays scrolled to the top instead of jumping to the most recent messages at the bottom. The same can happen intermittently when switching between chats — sometimes the scroll-to-bottom just doesn't fire.

Why it happens
The scroll-to-bottom logic tracks the previous chat ID to detect navigation. Two problems:

  1. On page refresh, the tracking ref is initialized with the current chat ID, so the "did the chat change?" check immediately fails — it thinks you're already on this chat.
  2. The ref gets updated unconditionally on every render, even before messages have actually loaded. So when messages finally arrive and the effect re-runs, it thinks nothing changed because the ref was already set.

Expected behavior
Opening any existing chat — whether via navigation or page refresh — should always scroll to the most recent messages at the bottom.

Relevant log output


OS

macOS

GPU

Intel, Apple

CPU

Apple

Ollama version

No response

Originally created by @matteocelani on GitHub (May 6, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15997 ### What is the issue? When you open a long chat via a direct link or refresh the page, the chat stays scrolled to the top instead of jumping to the most recent messages at the bottom. The same can happen intermittently when switching between chats — sometimes the scroll-to-bottom just doesn't fire. **Why it happens** The scroll-to-bottom logic tracks the previous chat ID to detect navigation. Two problems: 1. On page refresh, the tracking ref is initialized with the current chat ID, so the "did the chat change?" check immediately fails — it thinks you're already on this chat. 2. The ref gets updated unconditionally on every render, even before messages have actually loaded. So when messages finally arrive and the effect re-runs, it thinks nothing changed because the ref was already set. **Expected behavior** Opening any existing chat — whether via navigation or page refresh — should always scroll to the most recent messages at the bottom. ### Relevant log output ```shell ``` ### OS macOS ### GPU Intel, Apple ### CPU Apple ### Ollama version _No response_
GiteaMirror added the bug label 2026-05-10 06:29:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#87874