Skip to content

Commit

Permalink
fix bug with message list fetch more
Browse files Browse the repository at this point in the history
  • Loading branch information
Puyodead1 committed Sep 12, 2023
1 parent 882efc8 commit ae9bdeb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/messaging/MessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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} />,
Expand Down

0 comments on commit ae9bdeb

Please sign in to comment.