I have chat messages displayed like this:
{{#each msg}}
{{> chatMsg}}
{{/each}}
When users enter the chat I add a document to the collection with user joins the chat. When a user rapidly reenters and leaves the chat I don’t want to duplicate user joins the chat over and over again. I want to display something like user joins the chat x3.
Is there a way to do this on the client side by hooking into renderList? I know I can change the doc on the server side but it seems unnecessarily intensive.
The easiest way to get there from here is to write a custom publisher. Instead of just returning a cursor from your publish function, call observe() on your cursor within the publish function, and do the appropriate set(), unset(), and flush() calls within that, that do the appropriate multiplying a previous message instead of adding a new one. You can find the relevant documentation at the meteor documentation for Meteor.publish
To get a basis from comparison, you can look at the current code to publish a Cursor, which is in packages/mongo-livedata/mongo_driver.js, in Cursor.prototype._publishCursor.
Note: My answer here is for Meteor 0.5.2. The API for custom publishers is going to be changing in a future release of Meteor, and there will be different functions you have to call than set() unset() and flush()