File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
app/classrooms/[classroomId]/chat Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change 22
33import { ScrollArea } from "@/shared/components/ui/scroll-area" ;
44import { useEffect , useRef } from "react" ;
5+ import { RagFlowMessage } from "@shared/lib/ragflow/chat/chat-client" ;
56
67interface AutoScrollProps {
78 children : React . ReactNode ;
8- isMessageSent : boolean ;
9+ messages : RagFlowMessage [ ] ;
910}
1011
11- export default function AutoScroll ( {
12- children,
13- isMessageSent,
14- } : AutoScrollProps ) {
12+ export default function AutoScroll ( { children, messages } : AutoScrollProps ) {
1513 const scrollRef = useRef < HTMLDivElement > ( null ) ;
1614
1715 useEffect ( ( ) => {
18- if ( isMessageSent ) {
19- scrollRef . current ?. scrollIntoView ( { behavior : "smooth" } ) ;
20- }
21- } , [ isMessageSent ] ) ;
22-
16+ scrollRef . current ?. scrollIntoView ( { behavior : "smooth" } ) ;
17+ } , [ messages ] ) ;
2318 useEffect ( ( ) => {
2419 scrollRef . current ?. scrollIntoView ( { behavior : "smooth" } ) ;
2520 } , [ ] ) ;
You can’t perform that action at this time.
0 commit comments