1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-25 03:32:54 +01:00

fix bug with message list fetch more

This commit is contained in:
Puyodead1 2023-09-12 12:40:29 -04:00
parent 882efc889c
commit ae9bdeb77f
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC

View File

@ -61,6 +61,10 @@ function MessageList({ guild, channel }: Props) {
}
// get last group
const lastGroup = messageGroups[messageGroups.length - 1];
if (!lastGroup) {
logger.warn("No last group found, aborting fetchMore");
return;
}
// ignore queued messages
if ("status" in lastGroup.messages[0]) return;
// get first message in the group to use as before
@ -70,7 +74,7 @@ function MessageList({ guild, channel }: Props) {
if (r !== 50) setHasMore(false);
else setHasMore(true);
});
}, [channel, setHasMore]);
}, [channel, messageGroups, setHasMore]);
const renderGroup = React.useCallback(
(group: MessageGroupType) => <MessageGroup key={group.messages[0].id} group={group} />,