fix chat scroll jumps and move about us to home page

This commit is contained in:
2026-04-15 08:07:17 -06:00
parent bbda43e4a0
commit 50f8606ba8
3 changed files with 38 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ function ChatPage() {
const pollRef = useRef(null);
const lastMessageIdRef = useRef(null);
const fileInputRef = useRef(null);
const lastScrolledIdRef = useRef(null);
useEffect(() => {
if (!authLoading && !user) {
@@ -38,6 +39,10 @@ function ChatPage() {
}, [authLoading, user, router, conversationIdParam]);
useEffect(() => {
if (messages.length === 0) return;
const lastMsg = messages[messages.length - 1];
if (lastMsg.id === lastScrolledIdRef.current) return;
lastScrolledIdRef.current = lastMsg.id;
const area = messagesAreaRef.current;
if (!area) return;
const nearBottom = area.scrollHeight - area.scrollTop - area.clientHeight < 150;