@@ -252,12 +252,7 @@ export function BubbleList({
252
252
background = "right-solid" ,
253
253
footer,
254
254
pending,
255
- assistant = {
256
- avatar : {
257
- text : "A" ,
258
- } ,
259
- align : "left" ,
260
- } ,
255
+ assistant,
261
256
isPending = true ,
262
257
messages,
263
258
threshold = 8 ,
@@ -324,6 +319,23 @@ export function BubbleList({
324
319
}
325
320
} , [ isScrollAtBottom ] ) ;
326
321
322
+ const handleTouchStart = useCallback ( ( ) => {
323
+ pauseScroll . current = true ;
324
+ } , [ ] ) ;
325
+
326
+ const handleTouchEnd = useCallback ( ( ) => {
327
+ if ( isScrollAtBottom ( ) ) {
328
+ pauseScroll . current = false ;
329
+ scrollContainer ( false ) ;
330
+ } else {
331
+ pauseScroll . current = true ;
332
+ }
333
+ } , [ isScrollAtBottom , scrollContainer ] ) ;
334
+
335
+ const handleTouchMove = useCallback ( ( ) => {
336
+ pauseScroll . current = true ;
337
+ } , [ ] ) ;
338
+
327
339
return (
328
340
< div
329
341
data-slot = "bubble-list"
@@ -332,30 +344,19 @@ export function BubbleList({
332
344
) }
333
345
ref = { containerRef }
334
346
onWheel = { handleWheel }
335
- onTouchStart = { ( ) => {
336
- pauseScroll . current = true ;
337
- } }
338
- onTouchEnd = { ( ) => {
339
- if ( isScrollAtBottom ( ) ) {
340
- pauseScroll . current = false ;
341
- scrollContainer ( false ) ;
342
- } else {
343
- pauseScroll . current = true ;
344
- }
345
- } }
346
- onTouchMove = { ( ) => {
347
- pauseScroll . current = true ;
348
- } }
347
+ onTouchStart = { handleTouchStart }
348
+ onTouchEnd = { handleTouchEnd }
349
+ onTouchMove = { handleTouchMove }
349
350
{ ...props }
350
351
>
351
352
< div
352
353
data-slot = "bubble-items"
353
354
className = "flex flex-col max-w-full flex-1 gap-4"
354
355
ref = { contentRef }
355
356
>
356
- { messages . map ( ( message , index ) => (
357
+ { messages . map ( ( message ) => (
357
358
< div
358
- key = { message . content . slice ( 0 , 8 ) + index . toString ( ) }
359
+ key = { message . id }
359
360
data-slot = "bubble-item"
360
361
className = { twMerge (
361
362
clsx (
0 commit comments