From 4110181ad8a7f2bbb6d65b7741955c964735a885 Mon Sep 17 00:00:00 2001
From: =Corey Hulen <corey@hulen.com>
Date: Fri, 6 Nov 2015 06:35:38 -0800
Subject: GIT-888 improving perf

---
 web/react/stores/user_store.jsx | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'web/react/stores/user_store.jsx')

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);
     }
 
-- 
cgit v1.2.3-1-g7c22

