Opening a card writes the user document (profile.cardLastViews, #3078). The
board view (Utils.storedBoardView and allowBoardView, which every list's card
loop reads) and the helpers every minicard runs read the WHOLE user document,
so that one write re-ran every list's card loop, and Blaze then re-evaluated
every minicard: 37,452 Tracker invalidations for one card open on a 40-card
board. Measured in the running app, it is now 390.
client/lib/currentUserWith.js reads the current user with only the named
fields; minimongo re-runs a field-limited query only when a projected field
changes. The board view, feature preview, unread comments, folds, drag
handles, label text, dependency layers, date format, week number, mobile mode
and the admin-only custom field check now use it. setCardLastViewed $sets one
entry instead of rewriting the whole map, which is also capped at 5,000.
Thanks to markusst1982 and xet7 !
Fixes#6745.
There was no way to tell at a glance which cards had new comments since the
user last looked (#3078). Add a per-user, per-card last-viewed timestamp
(Users profile.cardLastViews, same shape as the existing
profile.collapsedCardSections) set whenever the user opens a card's detail
view, and a pure, tested decision (models/lib/unreadComments.js) that flags
a card as unread when it has a comment created after that timestamp, or any
comment at all when the card was never opened. The minicard shows a subtle
inset highlight (minicard-unread-comments) and a tooltip when flagged, and
opening the card clears it.
Thanks to H4usi and xet7 !
Closes#3078,