diff --git a/client/lib/reactiveCache.js b/client/lib/reactiveCache.js new file mode 100644 index 000000000..f72bfa3c1 --- /dev/null +++ b/client/lib/reactiveCache.js @@ -0,0 +1,14 @@ +import { DataCache } from 'meteor-reactive-cache'; + +// global Reactive Cache class to avoid big overhead while searching for the same data often again +ReactiveCache = { + getBoard(id) { + if (!this.__board) { + this.__board = new DataCache(boardId => { + return Boards.findOne(boardId); + }); + } + const ret = this.__board.get(id); + return ret; + } +} diff --git a/models/cards.js b/models/cards.js index 42a3fb048..dae7df02e 100644 --- a/models/cards.js +++ b/models/cards.js @@ -639,7 +639,8 @@ Cards.helpers({ }, board() { - return Boards.findOne(this.boardId); + const ret = ReactiveCache.getBoard(this.boardId); + return ret; }, getRealId() {