Move every ChecklistItems.findOne() to the ReactiveCache

This commit is contained in:
Martin Filser 2023-02-03 23:33:38 +01:00
parent 5e3a9dc059
commit 0e714a90e0
4 changed files with 26 additions and 3 deletions

View file

@ -19,6 +19,10 @@ ReactiveCacheServer = {
const ret = Checklists.findOne(id);
return ret;
},
getChecklistItem(id) {
const ret = ChecklistItems.findOne(id);
return ret;
},
getCard(id) {
const ret = Cards.findOne(id);
return ret;
@ -89,6 +93,16 @@ ReactiveCacheClient = {
const ret = this.__checklist.get(id);
return ret;
},
getChecklistItem(id) {
if (!this.__checklistItem) {
this.__checklistItem = new DataCache(_id => {
const _ret = ChecklistItems.findOne(_id);
return _ret;
});
}
const ret = this.__checklistItem.get(id);
return ret;
},
getCard(id) {
if (!this.__card) {
this.__card = new DataCache(cardId => {
@ -194,6 +208,15 @@ ReactiveCache = {
}
return ret;
},
getChecklistItem(id) {
let ret;
if (Meteor.isServer) {
ret = ReactiveCacheServer.getChecklistItem(id);
} else {
ret = ReactiveCacheClient.getChecklistItem(id);
}
return ret;
},
getCard(id) {
let ret;
if (Meteor.isServer) {