mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
Adding new ReactiveCache
This commit is contained in:
parent
384d80a647
commit
47427f89b0
2 changed files with 16 additions and 1 deletions
14
client/lib/reactiveCache.js
Normal file
14
client/lib/reactiveCache.js
Normal file
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -639,7 +639,8 @@ Cards.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
board() {
|
board() {
|
||||||
return Boards.findOne(this.boardId);
|
const ret = ReactiveCache.getBoard(this.boardId);
|
||||||
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
getRealId() {
|
getRealId() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue