summaryrefslogtreecommitdiffstats
path: root/web/react/stores/preference_store.jsx
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-01-26 15:10:08 -0500
committerCorey Hulen <corey@hulen.com>2016-01-26 15:10:08 -0500
commitf6540c4b5e349b3f6d4b807d698ac2c548b4fdb1 (patch)
treefeb1ac4f79d2987d2b3e933afa03e930685d11e6 /web/react/stores/preference_store.jsx
parent163bab98b5662b34515c70ecb86ea625742b9fea (diff)
parentc889d9bee107c61513f037fa2f66bf3a0d3fcb42 (diff)
downloadchat-f6540c4b5e349b3f6d4b807d698ac2c548b4fdb1.tar.gz
chat-f6540c4b5e349b3f6d4b807d698ac2c548b4fdb1.tar.bz2
chat-f6540c4b5e349b3f6d4b807d698ac2c548b4fdb1.zip
Merge pull request #1978 from hmhealey/plt1484
PLT-1484 Changed first preference load to be done synchronously
Diffstat (limited to 'web/react/stores/preference_store.jsx')
-rw-r--r--web/react/stores/preference_store.jsx21
1 files changed, 12 insertions, 9 deletions
diff --git a/web/react/stores/preference_store.jsx b/web/react/stores/preference_store.jsx
index 79eab4fe1..7ecaf0a95 100644
--- a/web/react/stores/preference_store.jsx
+++ b/web/react/stores/preference_store.jsx
@@ -133,6 +133,16 @@ class PreferenceStoreClass extends EventEmitter {
return preference;
}
+ setPreferences(newPreferences) {
+ const preferences = this.getAllPreferences();
+
+ for (const preference of newPreferences) {
+ preferences.set(getPreferenceKeyForModel(preference), preference);
+ }
+
+ this.setAllPreferences(preferences);
+ }
+
emitChange() {
this.emit(CHANGE_EVENT);
}
@@ -155,18 +165,11 @@ class PreferenceStoreClass extends EventEmitter {
this.emitChange();
break;
}
- case ActionTypes.RECIEVED_PREFERENCES: {
- const preferences = this.getAllPreferences();
-
- for (const preference of action.preferences) {
- preferences.set(getPreferenceKeyForModel(preference), preference);
- }
-
- this.setAllPreferences(preferences);
+ case ActionTypes.RECIEVED_PREFERENCES:
+ this.setPreferences(action.preferences);
this.emitChange();
break;
}
- }
}
}