Reactively show number of unread comments in a thread?

I’m making a forum type app with Threads and Comments within a Thread. I’m trying to figure out how to show the total number of unread comments within a thread to each user.

I considered publishing all the Comments for every Thread, but this seems like excessive data to be publishing to the client when all I want is a single number showing the unread Comments. But if I start adding metadata to the Thread collection (such as numComments, numCommentsUnread…), this adds extra moving parts to the app (i.e. I have to track every time a different user adds a Comment to a Thread, etc…).

What are some of the best practices for dealing with this?

Can’t you just use the publish counts package to figure out the number on the server side, and then simply get that number from the client?

1 Like