@@ -20,12 +20,6 @@ interface MessageListProps {
20
20
21
21
export default function MessageList ( { messages } : MessageListProps ) {
22
22
const scrollAreaRef = useRef < HTMLDivElement > ( null ) ;
23
- // Avoid the message list to change its height all the time. It causes some
24
- // flickering in the screen because some messages, as the ones displaying
25
- // progress statuses, are changing the content(the number of lines) and size
26
- // constantily. To minimize it, we keep track of the biggest scroll height of
27
- // the content, and use that as the min height of the scroll area.
28
- const contentMinHeight = useRef ( 0 ) ;
29
23
30
24
// Track if user is at bottom - default to true for initial scroll
31
25
const isAtBottomRef = useRef ( true ) ;
@@ -67,11 +61,6 @@ export default function MessageList({ messages }: MessageListProps) {
67
61
const isNewUserMessage =
68
62
messages . length > 0 && messages [ messages . length - 1 ] . role === "user" ;
69
63
70
- // Update content min height if needed
71
- if ( currentScrollHeight > contentMinHeight . current ) {
72
- contentMinHeight . current = currentScrollHeight ;
73
- }
74
-
75
64
// Auto-scroll only if:
76
65
// 1. It's the first render, OR
77
66
// 2. There's new content AND user was at the bottom, OR
@@ -104,9 +93,7 @@ export default function MessageList({ messages }: MessageListProps) {
104
93
return (
105
94
< div className = "overflow-y-auto flex-1" ref = { scrollAreaRef } >
106
95
< div
107
- className = "p-4 flex flex-col gap-4 max-w-4xl mx-auto"
108
- style = { { minHeight : contentMinHeight . current } }
109
- >
96
+ className = "p-4 flex flex-col gap-4 max-w-4xl mx-auto transition-all duration-300 ease-in-out min-h-0" >
110
97
{ messages . map ( ( message ) => (
111
98
< div
112
99
key = { message . id ?? "draft" }
0 commit comments