diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-08-31 19:39:56 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-08-31 19:39:56 +0200 |
commit | 34b232ac0a777d2be88da00da5d393b64090f4c8 (patch) | |
tree | 33790481a9bb55ae4a07a2d1b2b218c641b6338d /client/components/boards | |
parent | 21f90382d0465eb7cf7e30e3c68a246105ef317b (diff) | |
download | wekan-34b232ac0a777d2be88da00da5d393b64090f4c8.tar.gz wekan-34b232ac0a777d2be88da00da5d393b64090f4c8.tar.bz2 wekan-34b232ac0a777d2be88da00da5d393b64090f4c8.zip |
Improve the board subscription
Fixes #258
Diffstat (limited to 'client/components/boards')
-rw-r--r-- | client/components/boards/boardBody.js | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 669b5b4b..aa9d630d 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -6,25 +6,31 @@ BlazeComponent.extendComponent({ }, onCreated: function() { - var self = this; - self.draggingActive = new ReactiveVar(false); - self.showOverlay = new ReactiveVar(false); - self.isBoardReady = new ReactiveVar(false); + this.draggingActive = new ReactiveVar(false); + this.showOverlay = new ReactiveVar(false); + this.isBoardReady = new ReactiveVar(false); // The pattern we use to manually handle data loading is described here: // https://kadira.io/academy/meteor-routing-guide/content/subscriptions-and-data-management/using-subs-manager // XXX The boardId should be readed from some sort the component "props", // unfortunatly, Blaze doesn't have this notion. - self.autorun(function() { - var handle = subManager.subscribe('board', Session.get('currentBoard')); - self.isBoardReady.set(handle.ready()); + this.autorun(() => { + let currentBoardId = Session.get('currentBoard'); + if (! currentBoardId) + return; + var handle = subManager.subscribe('board', currentBoardId); + Tracker.nonreactive(() => { + Tracker.autorun(() => { + this.isBoardReady.set(handle.ready()); + }) + }) }); - self._isDragging = false; - self._lastDragPositionX = 0; + this._isDragging = false; + this._lastDragPositionX = 0; // Used to set the overlay - self.mouseHasEnterCardDetails = false; + this.mouseHasEnterCardDetails = false; }, openNewListForm: function() { |