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:
parent
882efc889c
commit
ae9bdeb77f
@ -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} />,
|
||||
|
Loading…
Reference in New Issue
Block a user