summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2017-12-02 22:00:42 +0200
committerLauri Ojansivu <x@xet7.org>2017-12-02 22:00:42 +0200
commit233554a3d69f1cf3a509e540fc1623d17c357037 (patch)
tree0321320f8be205aaf558b8912c4d63f98fa40639
parentfa281e3f5f7362797224c0eb11faec26351a407d (diff)
downloadwekan-233554a3d69f1cf3a509e540fc1623d17c357037.tar.gz
wekan-233554a3d69f1cf3a509e540fc1623d17c357037.tar.bz2
wekan-233554a3d69f1cf3a509e540fc1623d17c357037.zip
Move global subscription to template subscription so that subscription
will stop when template is unused. It's very important for efficiency espacially with large number of users. Thanks to mfshiu !
-rw-r--r--CHANGELOG.md5
-rw-r--r--client/components/cards/cardDetails.js4
-rw-r--r--client/components/settings/settingBody.js10
-rw-r--r--client/components/users/userAvatar.js4
-rw-r--r--client/lib/unsavedEdits.js2
5 files changed, 14 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 01358a7f..10f4a0b4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,10 +2,11 @@
This release adds the following new features:
-* [Change password of any user in Standalone Wekan Admin Panel](https://github.com/wekan/wekan/pull/1372).
+* [Change password of any user in Standalone Wekan Admin Panel](https://github.com/wekan/wekan/pull/1372);
+* [Performance optimization: Move more global subscriptions to template subscription](https://github.com/wekan/wekan/pull/1373);
* Update tranlations. Add Latvian language.
-Thanks to GitHub user thuanpq for contributions. Thanks to translators for their translations.
+Thanks to GitHub users mfshiu and thuanpq for their contributions. Thanks to translators for their translations.
# v0.60 2017-11-29 Wekan release
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index b62f31d4..e18de87c 100644
--- a/client/components/cards/cardDetails.js
+++ b/client/components/cards/cardDetails.js
@@ -23,8 +23,12 @@ BlazeComponent.extendComponent({
this.parentComponent().showOverlay.set(true);
this.parentComponent().mouseHasEnterCardDetails = false;
this.calculateNextPeak();
+
+ Meteor.subscribe('unsaved-edits');
},
+
+
isWatching() {
const card = this.currentData();
return card.findWatcher(Meteor.userId());
diff --git a/client/components/settings/settingBody.js b/client/components/settings/settingBody.js
index 5b015918..fabcc70c 100644
--- a/client/components/settings/settingBody.js
+++ b/client/components/settings/settingBody.js
@@ -1,8 +1,3 @@
-Meteor.subscribe('setting');
-Meteor.subscribe('mailServer');
-Meteor.subscribe('accountSettings');
-Meteor.subscribe('announcements');
-
BlazeComponent.extendComponent({
onCreated() {
this.error = new ReactiveVar('');
@@ -11,6 +6,11 @@ BlazeComponent.extendComponent({
this.emailSetting = new ReactiveVar(false);
this.accountSetting = new ReactiveVar(false);
this.announcementSetting = new ReactiveVar(false);
+
+ Meteor.subscribe('setting');
+ Meteor.subscribe('mailServer');
+ Meteor.subscribe('accountSettings');
+ Meteor.subscribe('announcements');
},
setError(error) {
diff --git a/client/components/users/userAvatar.js b/client/components/users/userAvatar.js
index 1066c632..be7a85d2 100644
--- a/client/components/users/userAvatar.js
+++ b/client/components/users/userAvatar.js
@@ -1,5 +1,3 @@
-Meteor.subscribe('my-avatars');
-
Template.userAvatar.helpers({
userData() {
// We need to handle a special case for the search results provided by the
@@ -54,6 +52,8 @@ Template.userAvatarInitials.helpers({
BlazeComponent.extendComponent({
onCreated() {
this.error = new ReactiveVar('');
+
+ Meteor.subscribe('my-avatars');
},
avatarUrlOptions() {
diff --git a/client/lib/unsavedEdits.js b/client/lib/unsavedEdits.js
index 17bb29b5..9c02eb84 100644
--- a/client/lib/unsavedEdits.js
+++ b/client/lib/unsavedEdits.js
@@ -1,5 +1,3 @@
-Meteor.subscribe('unsaved-edits');
-
// `UnsavedEdits` is a global key-value store used to save drafts of user
// inputs. We used to have the notion of a `cachedValue` that was local to a
// component but the global store has multiple advantages: