mirror of
https://github.com/coder/coder.git
synced 2026-11-09 22:23:27 +08:00
When switching between chats on the agents page, the scroll position was preserved from the previous chat instead of resetting to show the most recent messages. ## Problem Clicking a different chat in the sidebar loaded the new chat's messages but kept the scroll container at whatever position the user had scrolled to in the previous chat. This meant users often landed in the middle of a conversation instead of at the bottom where the latest messages are. ## Fix Added a `useEffect` in `AgentDetail` that resets `scrollTop` to `0` whenever `agentId` changes. The scroll container uses `flex-col-reverse`, so `scrollTop = 0` corresponds to the bottom (most recent messages).