feat: group when elements are in the same minute

This commit is contained in:
Shivam Mishra
2024-11-27 16:13:19 +05:30
parent caeb3bc88c
commit b753d27301
@@ -722,8 +722,8 @@ const shouldGroupWithNext = index => {
const currentSenderId = current.senderId ?? current.sender?.id;
if (currentSenderId !== nextSenderId) return false;
// if next and current createdAt is within 1 min group them;
return next.createdAt - current.createdAt < 60;
// Check if messages are in the same minute by rounding down to nearest minute
return Math.floor(next.createdAt / 60) === Math.floor(current.createdAt / 60);
};
</script>