From 89fe68d35602868e64cb1f7ccadd10ec14763dd0 Mon Sep 17 00:00:00 2001 From: TaiAurori <31465218+TaiAurori@users.noreply.github.com> Date: Sat, 30 Oct 2021 20:18:57 -0400 Subject: [PATCH] whoops --- src/MessageView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessageView.js b/src/MessageView.js index 1da8ad1..4667bf7 100644 --- a/src/MessageView.js +++ b/src/MessageView.js @@ -50,7 +50,7 @@ export class Messages extends React.Component { if (newMessages.length >= (!this.state.bottomOfPage ? 150 : 50)) { newMessages = newMessages.slice(newMessages.length - 50, newMessages.length) } - let grouped = (newMessages[0].message.author?._id == message.author?._id) && !(message.reply_ids && message.reply_ids.length > 0) + let grouped = newMessages.length > 0 && ((newMessages[newMessages.length - 1].message?.author?._id == message.author?._id) && !(message.reply_ids && message.reply_ids.length > 0) && (dayjs(decodeTime(message._id)).diff(dayjs(decodeTime(newMessages[newMessages.length - 1].message?._id)), "minute") < 5)) newMessages.push({message, grouped, rendered: this.renderMessage({grouped, message})}) return {messages: newMessages, newMessageCount: !this.state.bottomOfPage ? (this.state.newMessageCount + 1) || 1 : 0} })