From 945d15d77fb487435b626fddf1383b4dd69d365e Mon Sep 17 00:00:00 2001 From: Brendan Kellam <10233483+brendan-kellam@users.noreply.github.com> Date: Wed, 1 Jul 2026 01:37:26 +0000 Subject: [PATCH 1/2] fix(web): stop chat jitter when opening citations at the bottom When the chat is stuck to the bottom, selecting a citation triggers a scroll-into-view that fights useStickToBottom's auto-scroll, causing the view to jitter. Release the stick-to-bottom lock on citation selection so the reveal scroll can settle. Generated with [Linear](https://linear.app/sourcebot/issue/SOU-1486/chat-jitters-when-opening-citations-at-bottom#agent-session-fbed4bdc) Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com> --- .../chat/components/chatThread/chatThread.tsx | 3 ++- .../components/chatThread/chatThreadListItem.tsx | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/web/src/ee/features/chat/components/chatThread/chatThread.tsx b/packages/web/src/ee/features/chat/components/chatThread/chatThread.tsx index ddfd0a151..f02dab643 100644 --- a/packages/web/src/ee/features/chat/components/chatThread/chatThread.tsx +++ b/packages/web/src/ee/features/chat/components/chatThread/chatThread.tsx @@ -76,7 +76,7 @@ export const ChatThread = ({ const [isErrorBannerVisible, setIsErrorBannerVisible] = useState(false); const hasSubmittedInputMessage = useRef(false); const chatBoxRef = useRef(null); - const { scrollRef, contentRef, scrollToBottom, isAtBottom } = useStickToBottom({ initial: false }); + const { scrollRef, contentRef, scrollToBottom, isAtBottom, stopScroll } = useStickToBottom({ initial: false }); const { toast } = useToast(); const router = useRouter(); const [isContextSelectorOpen, setIsContextSelectorOpen] = useState(false); @@ -435,6 +435,7 @@ export const ChatThread = ({ isNetworkActive={isPairNetworkActive} isAwaitingToolApproval={isPairAwaitingToolApproval} sources={sources} + onStickToBottomRelease={stopScroll} /> {index !== messagePairs.length - 1 && ( diff --git a/packages/web/src/ee/features/chat/components/chatThread/chatThreadListItem.tsx b/packages/web/src/ee/features/chat/components/chatThread/chatThreadListItem.tsx index d6388443c..8813f152b 100644 --- a/packages/web/src/ee/features/chat/components/chatThread/chatThreadListItem.tsx +++ b/packages/web/src/ee/features/chat/components/chatThread/chatThreadListItem.tsx @@ -29,6 +29,9 @@ interface ChatThreadListItemProps { sources: Source[]; chatId: string; index: number; + // Releases the chat's stick-to-bottom lock. Called when a citation is + // selected so the citation-reveal scroll doesn't fight the auto-scroll. + onStickToBottomRelease?: () => void; } const ChatThreadListItemComponent = forwardRef(({ @@ -40,6 +43,7 @@ const ChatThreadListItemComponent = forwardRef { const leftPanelRef = useRef(null); const [leftPanelHeight, setLeftPanelHeight] = useState(null); @@ -55,8 +59,16 @@ const ChatThreadListItemComponent = forwardRef (hovered?.kind === 'reference' ? hovered.reference : undefined), [hovered]); const setSelectedReference = useCallback((reference?: Reference) => { + // Selecting a citation scrolls it into view (see the effect below). If the + // chat is stuck to the bottom, that scroll fights the stick-to-bottom + // auto-scroll and the view jitters. Release the lock on selection so the + // reveal scroll can settle. This mirrors the state entered when the user + // scrolls up manually. + if (reference) { + onStickToBottomRelease?.(); + } setSelected(reference ? { kind: 'reference', reference } : undefined); - }, []); + }, [onStickToBottomRelease]); const setHoveredReference = useCallback((reference?: Reference) => { setHovered(reference ? { kind: 'reference', reference } : undefined); }, []); From d068c09605cff91195b23bb3dea632d8cfe1d147 Mon Sep 17 00:00:00 2001 From: Brendan Kellam <10233483+brendan-kellam@users.noreply.github.com> Date: Wed, 1 Jul 2026 01:37:54 +0000 Subject: [PATCH 2/2] docs: add changelog entry for citation jitter fix Generated with [Linear](https://linear.app/sourcebot/issue/SOU-1486/chat-jitters-when-opening-citations-at-bottom#agent-session-fbed4bdc) Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com> --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32a565fc3..456e556b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [EE] Fixed Ask Sourcebot mermaid diagrams overflowing their container by contain-fitting them to both width and height, and made revealing a diagram from the answer jump it into view instantly to avoid over/undershooting. [#1373](https://github.com/sourcebot-dev/sourcebot/pull/1373) - Verified GitHub review webhook deliveries before processing them. [#1378](https://github.com/sourcebot-dev/sourcebot/pull/1378) - Passed Zoekt index parameters via argv to preserve revision names with punctuation. [#1376](https://github.com/sourcebot-dev/sourcebot/pull/1376) +- [EE] Fixed Ask Sourcebot chat jittering when opening a citation while scrolled to the bottom, by releasing the stick-to-bottom lock on citation selection. [#1406](https://github.com/sourcebot-dev/sourcebot/pull/1406) ## [5.0.4] - 2026-06-18