diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-11-06 10:16:27 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-11-06 10:16:27 -0500 |
commit | 93a684ca1b0030d2c13fb8e157b9db7c0541f513 (patch) | |
tree | 618e72350b162fb24d8ff6c94973181ae876ec51 /web/react | |
parent | 5359de4a71fa405eb068002e8bdcaf50c5dbb214 (diff) | |
parent | 4110181ad8a7f2bbb6d65b7741955c964735a885 (diff) | |
download | chat-93a684ca1b0030d2c13fb8e157b9db7c0541f513.tar.gz chat-93a684ca1b0030d2c13fb8e157b9db7c0541f513.tar.bz2 chat-93a684ca1b0030d2c13fb8e157b9db7c0541f513.zip |
Merge pull request #1333 from mattermost/GIT-888
GIT-888 improving perf
Diffstat (limited to 'web/react')
-rw-r--r-- | web/react/stores/user_store.jsx | 9 |
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); } |