⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
'use client';
import { useEffect, useRef } from 'react';
import { useMessageScroller } from '@/components/ui/message-scroller';
// Jumps the transcript to the newest message once, on the first render that has
// messages. Renders nothing.
export default function InitialScrollToEnd({ hasMessages }: { hasMessages: boolean }) {
const { scrollToEnd } = useMessageScroller();
const hasScrolled = useRef(false);
useEffect(() => {
if (!hasMessages || hasScrolled.current) return;
const frame = window.requestAnimationFrame(() => {
scrollToEnd({ behavior: 'auto' });
hasScrolled.current = true;
});
return () => window.cancelAnimationFrame(frame);
}, [hasMessages, scrollToEnd]);
return null;
}