Chat Widget, changes in nav bar
Auto Scroll chat and changes in Nav bar
This commit is contained in:
@@ -32,10 +32,16 @@ function ChatPage() {
|
||||
}
|
||||
}, [authLoading, user, router, conversationIdParam]);
|
||||
|
||||
useEffect(() => {
|
||||
const prevMsgLengthRef = useRef(0);
|
||||
|
||||
useEffect(() => {
|
||||
if (messages.length > prevMsgLengthRef.current) {
|
||||
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
||||
}
|
||||
prevMsgLengthRef.current = messages.length;
|
||||
}, [messages]);
|
||||
|
||||
|
||||
const fetchMessages = useCallback(async (convId) => {
|
||||
if (!token || !convId) return;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user