Merge pull request #1481 from AnishSarkar22/fix/chat-stream-flicker

fix(chat): stabilize active thread rendering and top-anchored scrolling
This commit is contained in:
Rohan Verma 2026-06-11 14:47:15 -07:00 committed by GitHub
commit aee0c1a3ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 118 additions and 58 deletions

View file

@ -27,8 +27,8 @@ export interface ChatViewportProps {
export const ChatViewport: FC<ChatViewportProps> = ({ children, footer }) => (
<ThreadPrimitive.Viewport
turnAnchor="top"
autoScroll
scrollToBottomOnRunStart
autoScroll={false}
scrollToBottomOnRunStart={false}
scrollToBottomOnInitialize
scrollToBottomOnThreadSwitch
className="aui-thread-viewport relative flex flex-1 min-h-0 flex-col overflow-y-auto px-4 scroll-smooth"

View file

@ -144,11 +144,15 @@ function getComposerSuggestionAnchorPoint(
};
}
export const Thread: FC = () => {
return <ThreadContent />;
interface ThreadProps {
hasActiveThread?: boolean;
}
export const Thread: FC<ThreadProps> = ({ hasActiveThread = false }) => {
return <ThreadContent hasActiveThread={hasActiveThread} />;
};
const ThreadContent: FC = () => {
const ThreadContent: FC<ThreadProps> = ({ hasActiveThread = false }) => {
return (
<ThreadPrimitive.Root
className="aui-root aui-thread-root @container flex h-full min-h-0 flex-col bg-main-panel"
@ -158,13 +162,13 @@ const ThreadContent: FC = () => {
>
<ChatViewport
footer={
<AuiIf condition={({ thread }) => !thread.isEmpty}>
<AuiIf condition={({ thread }) => hasActiveThread || !thread.isEmpty}>
<PremiumQuotaPinnedAlert />
<Composer />
</AuiIf>
}
>
<AuiIf condition={({ thread }) => thread.isEmpty}>
<AuiIf condition={({ thread }) => !hasActiveThread && thread.isEmpty}>
<ThreadWelcome />
</AuiIf>