Skip to content

Commit ffbf21d

Browse files
committed
Fix thread auto-follow to respect manual history scroll
1 parent 79a5cdd commit ffbf21d

2 files changed

Lines changed: 60 additions & 12 deletions

File tree

src/components/content/ThreadConversation.vue

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3736,10 +3736,7 @@ function applySavedScrollState(): void {
37363736
}
37373737
37383738
const maxScrollTop = Math.max(container.scrollHeight - container.clientHeight, 0)
3739-
const targetScrollTop =
3740-
typeof savedState.scrollRatio === 'number'
3741-
? savedState.scrollRatio * maxScrollTop
3742-
: savedState.scrollTop
3739+
const targetScrollTop = savedState.scrollTop
37433740
container.scrollTop = Math.min(Math.max(targetScrollTop, 0), maxScrollTop)
37443741
emitScrollState(container)
37453742
}
@@ -3884,6 +3881,7 @@ watch(
38843881
() => props.liveOverlay,
38853882
async (overlay) => {
38863883
if (!overlay) return
3884+
if (!autoFollowOutput.value) return
38873885
await nextTick()
38883886
enforceBottomState()
38893887
scheduleBottomLock(8)
@@ -3903,19 +3901,12 @@ watch(
39033901
() => props.activeThreadId,
39043902
() => {
39053903
localScrollState.value = null
3906-
autoFollowOutput.value = props.scrollState?.isAtBottom !== false
3904+
autoFollowOutput.value = true
39073905
modalImageUrl.value = ''
39083906
},
39093907
{ flush: 'post' },
39103908
)
39113909
3912-
watch(
3913-
() => props.scrollState?.isAtBottom,
3914-
(isAtBottom) => {
3915-
autoFollowOutput.value = isAtBottom !== false
3916-
},
3917-
)
3918-
39193910
function onConversationScroll(): void {
39203911
const container = conversationListRef.value
39213912
if (!container || props.isLoading) return

tests.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,3 +1676,60 @@ This file tracks manual regression and feature verification steps.
16761676

16771677
#### Rollback/Cleanup
16781678
- No cleanup required.
1679+
1680+
### Feature: Thread auto-scrolls to latest message after load
1681+
1682+
#### Prerequisites
1683+
- Start app from this repository (`pnpm run dev`).
1684+
- Have a thread with enough messages to require scrolling.
1685+
1686+
#### Steps
1687+
1. Open the long thread from the sidebar.
1688+
2. Wait for `Loading messages...` to disappear.
1689+
3. Observe the conversation viewport position immediately after load.
1690+
4. Switch to another thread, then back to the same long thread.
1691+
1692+
#### Expected Results
1693+
- After each thread load, conversation snaps to the bottom-most/latest message.
1694+
- The latest message is visible without manual scrolling.
1695+
1696+
#### Rollback/Cleanup
1697+
- No cleanup required.
1698+
1699+
### Feature: Assistant streaming does not force-scroll when user is reading history
1700+
1701+
#### Prerequisites
1702+
- Start app from this repository (`pnpm run dev`).
1703+
- Open a thread long enough to scroll.
1704+
1705+
#### Steps
1706+
1. Scroll up so latest message is not visible.
1707+
2. Send a new prompt and wait for assistant reply to stream.
1708+
3. Observe viewport while reply is in progress.
1709+
4. Click `Jump to latest` (or manually scroll to bottom).
1710+
5. Send another prompt and observe streaming behavior again.
1711+
1712+
#### Expected Results
1713+
- While scrolled up, streaming assistant output does not pull viewport to bottom.
1714+
- After returning to bottom, streaming output auto-follows newest content.
1715+
1716+
#### Rollback/Cleanup
1717+
- No cleanup required.
1718+
1719+
### Feature: While reading older messages, stream growth keeps viewport pinned
1720+
1721+
#### Prerequisites
1722+
- Start app from this repository (`pnpm run dev`).
1723+
- Open a long thread and scroll up away from bottom.
1724+
1725+
#### Steps
1726+
1. Keep viewport fixed on an older message section.
1727+
2. Trigger a long assistant response so content height grows continuously.
1728+
3. Observe viewport position for 10-20 seconds during streaming.
1729+
1730+
#### Expected Results
1731+
- Viewport stays pinned at the same absolute scroll location while streaming.
1732+
- No gradual downward drift occurs until user manually jumps to latest/bottom.
1733+
1734+
#### Rollback/Cleanup
1735+
- No cleanup required.

0 commit comments

Comments
 (0)