mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
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.
18 lines
978 B
JavaScript
18 lines
978 B
JavaScript
// #6736: the instance's feature decisions (Admin Panel / Settings / Visibility /
|
|
// Features) for the signed-in user, reactively. The decisions themselves are
|
|
// models/lib/instanceFeatures.js; this only supplies what the client knows -
|
|
// the published Settings document and the user's own preview flag.
|
|
import { ReactiveCache } from '/imports/reactiveCache';
|
|
import { currentUserWith } from '/client/lib/currentUserWith';
|
|
const { isBoardViewAvailable } = require('/models/lib/instanceFeatures');
|
|
|
|
// #6745: only the two fields canPreviewFeatures() reads. Utils.boardView()
|
|
// calls this, and every list's card loop reads boardView(): with the whole user
|
|
// document here, a card open (a user write) re-ran every list and Blaze then
|
|
// re-evaluated every minicard.
|
|
const PREVIEW_USER_FIELDS = ['featurePreview', 'isAdmin'];
|
|
|
|
export function allowBoardView(view) {
|
|
return isBoardViewAvailable(ReactiveCache.getCurrentSetting(), currentUserWith(PREVIEW_USER_FIELDS), view);
|
|
}
|