Skip to content

Commit f7fa313

Browse files
committed
fix(web): keep scroll position when a turn completes
1 parent 63fa9e2 commit f7fa313

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3777,6 +3777,12 @@ function ChatViewContent(props: ChatViewProps) {
37773777
}, [activeThread?.id, composerOverlayHeight, timelineRealContentOverflowsViewport]);
37783778

37793779
const onTimelineAnchorReady = useCallback((messageId: MessageId, anchorIndex: number) => {
3780+
// Anchored-end space can be remeasured when the turn completes. Once the
3781+
// user has scrolled away (or returned to ordinary end-following), that
3782+
// remeasurement must not restart the send-time anchor positioning.
3783+
if (timelineScrollModeRef.current !== "anchoring-new-turn") {
3784+
return;
3785+
}
37803786
if (pendingTimelineAnchorRef.current === messageId) {
37813787
pendingTimelineAnchorRef.current = null;
37823788
}

0 commit comments

Comments
 (0)