got rid of useless scrollPos variable

This commit is contained in:
Carter 2024-12-06 10:18:15 -06:00
parent 48549bf4de
commit 558bed357a
2 changed files with 0 additions and 10 deletions

View file

@ -20,14 +20,7 @@ export default function Chat(props: Props) {
const [loaded, setLoaded] = useState<boolean>(false); const [loaded, setLoaded] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false); const [loading, setLoading] = useState<boolean>(false);
const [totalMessages, setTotalMessages] = useState(0); const [totalMessages, setTotalMessages] = useState(0);
const [scrollPos, setScrollPos] = useState(0);
const [{ user }] = useGlobalState(); const [{ user }] = useGlobalState();
// const [attachmentMap, setAttachmentMap] = useState<Map<string, pond.FileReference[]>>(new Map());
useEffect(() => {
console.log(scrollPos)
}, [scrollPos])
const loadChats = () => { const loadChats = () => {
setLoading(true) setLoading(true)
@ -35,7 +28,6 @@ export default function Chat(props: Props) {
// if (loaded) setScrollPos(chats.length-10) // if (loaded) setScrollPos(chats.length-10)
// setScrollPos(chats.length) // setScrollPos(chats.length)
setChats(resp.data.chats ? resp.data.chats.reverse().concat(chats) : []) setChats(resp.data.chats ? resp.data.chats.reverse().concat(chats) : [])
setScrollPos(resp.data.chats.reverse().concat(chats).length)
setTotalMessages(resp.data.total) setTotalMessages(resp.data.total)
}).finally(() => { }).finally(() => {
setLoading(false) setLoading(false)
@ -93,7 +85,6 @@ export default function Chat(props: Props) {
totalMessages={totalMessages} totalMessages={totalMessages}
// attachmentMap={attachmentMap} // attachmentMap={attachmentMap}
messages={chats} messages={chats}
scrollPos={scrollPos}
removeNoteMethod={removeNote} removeNoteMethod={removeNote}
loadMore={loadMore} loadMore={loadMore}
/> />

View file

@ -9,7 +9,6 @@ interface Props {
messages: pond.Chat[]; messages: pond.Chat[];
attachmentMap?: Map<string, pond.FileReference[]>; attachmentMap?: Map<string, pond.FileReference[]>;
totalMessages: number; totalMessages: number;
scrollPos: number;
removeNoteMethod: (index: number) => void; removeNoteMethod: (index: number) => void;
loadMore: () => void; loadMore: () => void;
} }