diff options
author | Corey Hulen <corey@hulen.com> | 2016-01-26 15:10:08 -0500 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-01-26 15:10:08 -0500 |
commit | f6540c4b5e349b3f6d4b807d698ac2c548b4fdb1 (patch) | |
tree | feb1ac4f79d2987d2b3e933afa03e930685d11e6 /web/react/stores | |
parent | 163bab98b5662b34515c70ecb86ea625742b9fea (diff) | |
parent | c889d9bee107c61513f037fa2f66bf3a0d3fcb42 (diff) | |
download | chat-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')
-rw-r--r-- | web/react/stores/preference_store.jsx | 21 |
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; } - } } } |