From e554de7a1277f992528d13dc4fd37445c2a181b4 Mon Sep 17 00:00:00 2001 From: Jinmiao Luo <39730824+jinmiaoluo@users.noreply.github.com> Date: Tue, 18 Apr 2023 20:21:06 +0800 Subject: [PATCH] Improve the logic for scrolling to the bottom Remove unnecessary 20px offset, because `scrollHeight = clientHeight + scrollTop` Fix: #905 --- app/components/chat.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 5dce8fd61..ac21599e0 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -434,7 +434,7 @@ export function Chat(props: { const [hitBottom, setHitBottom] = useState(false); const onChatBodyScroll = (e: HTMLElement) => { - const isTouchBottom = e.scrollTop + e.clientHeight >= e.scrollHeight - 20; + const isTouchBottom = e.scrollTop + e.clientHeight >= e.scrollHeight; setHitBottom(isTouchBottom); };