From 558bed357a7765b12c9d368e48156100b275fd36 Mon Sep 17 00:00:00 2001 From: Carter Date: Fri, 6 Dec 2024 10:18:15 -0600 Subject: [PATCH] got rid of useless scrollPos variable --- src/chat/Chat.tsx | 9 --------- src/chat/ChatOutput.tsx | 1 - 2 files changed, 10 deletions(-) diff --git a/src/chat/Chat.tsx b/src/chat/Chat.tsx index 8384572..ee0badf 100644 --- a/src/chat/Chat.tsx +++ b/src/chat/Chat.tsx @@ -20,14 +20,7 @@ export default function Chat(props: Props) { const [loaded, setLoaded] = useState(false); const [loading, setLoading] = useState(false); const [totalMessages, setTotalMessages] = useState(0); - const [scrollPos, setScrollPos] = useState(0); const [{ user }] = useGlobalState(); - // const [attachmentMap, setAttachmentMap] = useState>(new Map()); - - - useEffect(() => { - console.log(scrollPos) - }, [scrollPos]) const loadChats = () => { setLoading(true) @@ -35,7 +28,6 @@ export default function Chat(props: Props) { // if (loaded) setScrollPos(chats.length-10) // setScrollPos(chats.length) setChats(resp.data.chats ? resp.data.chats.reverse().concat(chats) : []) - setScrollPos(resp.data.chats.reverse().concat(chats).length) setTotalMessages(resp.data.total) }).finally(() => { setLoading(false) @@ -93,7 +85,6 @@ export default function Chat(props: Props) { totalMessages={totalMessages} // attachmentMap={attachmentMap} messages={chats} - scrollPos={scrollPos} removeNoteMethod={removeNote} loadMore={loadMore} /> diff --git a/src/chat/ChatOutput.tsx b/src/chat/ChatOutput.tsx index 8b659ad..f99ccbf 100644 --- a/src/chat/ChatOutput.tsx +++ b/src/chat/ChatOutput.tsx @@ -9,7 +9,6 @@ interface Props { messages: pond.Chat[]; attachmentMap?: Map; totalMessages: number; - scrollPos: number; removeNoteMethod: (index: number) => void; loadMore: () => void; }