From 32f0b175972d46fc52709bbd4eead4e3b2b3ae30 Mon Sep 17 00:00:00 2001 From: zaidmukaddam Date: Wed, 18 Dec 2024 20:46:36 +0530 Subject: [PATCH] fix: enhance autoscroll logic to consider messages and suggested questions --- app/search/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/search/page.tsx b/app/search/page.tsx index 86c90c5..2251dce 100644 --- a/app/search/page.tsx +++ b/app/search/page.tsx @@ -2033,7 +2033,7 @@ The new Anthropic models: Claude 3.5 Sonnet and 3.5 Haiku models are now availab useEffect(() => { const handleScroll = () => { const userScrolled = window.innerHeight + window.scrollY < document.body.offsetHeight; - if (!userScrolled && bottomRef.current) { + if (!userScrolled && bottomRef.current && (messages.length > 0 || suggestedQuestions.length > 0)) { bottomRef.current.scrollIntoView({ behavior: "smooth" }); } };