diff --git a/src/client/chat--messages.jsx b/src/client/chat--messages.jsx index 0ef8d3b..a47529e 100644 --- a/src/client/chat--messages.jsx +++ b/src/client/chat--messages.jsx @@ -23,7 +23,7 @@ export default function ChatMessages() { const {current} = $messages; const [, setIsAtBottom] = useState(true); const [outerHeight, setOuterHeight] = useState(0); - const [scrollTop, setScrollTop] = useState(0); + const [scrollTop, setScrollTop] = useState(-1); const [scrollHeight, setScrollHeight] = useState(Infinity); const messages = useSelector((state) => channelMessagesSelector(state, channel)); const messageCount = messages && messages.length; @@ -44,7 +44,7 @@ export default function ChatMessages() { useLayoutEffect(() => { const isAtBottom = !current ? true - : 0 === scrollTop || scrollTop + outerHeight >= scrollHeight; + : -1 === scrollTop || scrollTop + outerHeight >= scrollHeight; setIsAtBottom(isAtBottom); if (isAtBottom) { current?.scrollTo(0, scrollHeight);