Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions frontend/src/features/home/components/HomeChatTranscript.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { Trash2 } from 'lucide-react'
import { useSocAi } from '@/features/soc-ai/SocAiProvider'
Expand All @@ -6,6 +7,13 @@ import { MessageRow } from '@/features/soc-ai/components/MessageRow'
export function HomeChatTranscript() {
const { t } = useTranslation()
const { homeMessages, clear } = useSocAi()
const bottomRef = useRef<HTMLDivElement>(null)

// Stick to bottom: on mount (navigating back with existing messages) and as
// new messages stream in. Works regardless of which ancestor scrolls.
useEffect(() => {
bottomRef.current?.scrollIntoView({ block: 'end' })
}, [homeMessages])

return (
<section className="mx-auto max-w-3xl pb-28">
Expand All @@ -24,6 +32,7 @@ export function HomeChatTranscript() {
<MessageRow key={m.id} message={m} />
))}
</div>
<div ref={bottomRef} />
</section>
)
}
Loading