From 49cea0c28a4bd2c06acdc1bf20a69c3f91c8b941 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Thu, 12 Jan 2017 16:15:57 -0200 Subject: [PATCH] Remove Tracker.nonreactive in favor of curValue --- packages/rocketchat-lib/client/lib/TabBar.js | 66 +++++++++----------- 1 file changed, 28 insertions(+), 38 deletions(-) diff --git a/packages/rocketchat-lib/client/lib/TabBar.js b/packages/rocketchat-lib/client/lib/TabBar.js index b2a47189c2b..8a73bf412e3 100644 --- a/packages/rocketchat-lib/client/lib/TabBar.js +++ b/packages/rocketchat-lib/client/lib/TabBar.js @@ -18,34 +18,28 @@ RocketChat.TabBar = new (class TabBar { return false; } - Tracker.nonreactive(() => { - let btns = this.buttons.get(); - btns[config.id] = config; + let btns = this.buttons.curValue; + btns[config.id] = config; - if (this.extraGroups[config.id]) { - btns[config.id].groups = _.union((btns[config.id].groups || []), this.extraGroups[config.id]); - } + if (this.extraGroups[config.id]) { + btns[config.id].groups = _.union((btns[config.id].groups || []), this.extraGroups[config.id]); + } - this.buttons.set(btns); - }); + this.buttons.set(btns); } removeButton(id) { - Tracker.nonreactive(() => { - let btns = this.buttons.get(); - delete btns[id]; - this.buttons.set(btns); - }); + let btns = this.buttons.curValue; + delete btns[id]; + this.buttons.set(btns); } updateButton(id, config) { - Tracker.nonreactive(() => { - let btns = this.buttons.get(); - if (btns[id]) { - btns[id] = _.extend(btns[id], config); - this.buttons.set(btns); - } - }); + let btns = this.buttons.curValue; + if (btns[id]) { + btns[id] = _.extend(btns[id], config); + this.buttons.set(btns); + } } getButtons() { @@ -57,26 +51,22 @@ RocketChat.TabBar = new (class TabBar { } addGroup(id, groups) { - Tracker.nonreactive(() => { - let btns = this.buttons.get(); - if (btns[id]) { - btns[id].groups = _.union((btns[id].groups || []), groups); - this.buttons.set(btns); - } else { - this.extraGroups[id] = _.union((this.extraGroups[id] || []), groups); - } - }); + let btns = this.buttons.curValue; + if (btns[id]) { + btns[id].groups = _.union((btns[id].groups || []), groups); + this.buttons.set(btns); + } else { + this.extraGroups[id] = _.union((this.extraGroups[id] || []), groups); + } } removeGroup(id, groups) { - Tracker.nonreactive(() => { - let btns = this.buttons.get(); - if (btns[id]) { - btns[id].groups = _.difference((btns[id].groups || []), groups); - this.buttons.set(btns); - } else { - this.extraGroups[id] = _.difference((this.extraGroups[id] || []), groups); - } - }); + let btns = this.buttons.curValue; + if (btns[id]) { + btns[id].groups = _.difference((btns[id].groups || []), groups); + this.buttons.set(btns); + } else { + this.extraGroups[id] = _.difference((this.extraGroups[id] || []), groups); + } } });