summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-11-06 06:35:38 -0800
committer=Corey Hulen <corey@hulen.com>2015-11-06 06:35:38 -0800
commit4110181ad8a7f2bbb6d65b7741955c964735a885 (patch)
tree618e72350b162fb24d8ff6c94973181ae876ec51
parent5359de4a71fa405eb068002e8bdcaf50c5dbb214 (diff)
downloadchat-4110181ad8a7f2bbb6d65b7741955c964735a885.tar.gz
chat-4110181ad8a7f2bbb6d65b7741955c964735a885.tar.bz2
chat-4110181ad8a7f2bbb6d65b7741955c964735a885.zip
GIT-888 improving perf
-rw-r--r--web/react/stores/user_store.jsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/web/react/stores/user_store.jsx b/web/react/stores/user_store.jsx
index 4fa7224b7..6b7d671fc 100644
--- a/web/react/stores/user_store.jsx
+++ b/web/react/stores/user_store.jsx
@@ -58,6 +58,8 @@ class UserStoreClass extends EventEmitter {
this.setStatus = this.setStatus.bind(this);
this.getStatuses = this.getStatuses.bind(this);
this.getStatus = this.getStatus.bind(this);
+
+ this.profileCache = null;
}
emitChange(userId) {
@@ -184,6 +186,10 @@ class UserStoreClass extends EventEmitter {
}
getProfiles() {
+ if (this.profileCache !== null) {
+ return this.profileCache;
+ }
+
return BrowserStore.getItem('profiles', {});
}
@@ -218,6 +224,7 @@ class UserStoreClass extends EventEmitter {
saveProfile(profile) {
var ps = this.getProfiles();
ps[profile.id] = profile;
+ this.profileCache = ps;
BrowserStore.setItem('profiles', ps);
}
@@ -226,6 +233,8 @@ class UserStoreClass extends EventEmitter {
if (currentId in profiles) {
delete profiles[currentId];
}
+
+ this.profileCache = profiles;
BrowserStore.setItem('profiles', profiles);
}