I am currently bulding a chat app with Meteor, and i am facing a problem to display the messages with the
#each statement. I want to group the message by
user and add dividers if the messages dates are changing.
Actually, i am creating a new multi-dimensionnal array from the cursor of messages. This is not very good, and when i load more previous messages with and infinite scroll system, the UI become very slow when i send a new message.
The relevant part of the process is to access previous/sibling elements of a message because i need to compare if the sender of the messages differ, or if the dates of two messages are teh same day to display dividers or to group messages when the UI render them.
I could’nt find a way to access sibling elements with a minimongo cursor.
Do you know a way ?