diff options
Diffstat (limited to 'src/stores/SettingsStore.js')
-rw-r--r-- | src/stores/SettingsStore.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 816f545ee..30058f41d 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -1,5 +1,5 @@ | |||
1 | import { ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | import { action, computed, observable } from 'mobx'; | 2 | import { action, computed, observable, extendObservable } from 'mobx'; |
3 | 3 | ||
4 | import Store from './lib/Store'; | 4 | import Store from './lib/Store'; |
5 | import Request from './lib/Request'; | 5 | import Request from './lib/Request'; |
@@ -17,10 +17,6 @@ export default class SettingsStore extends Store { | |||
17 | // Register action handlers | 17 | // Register action handlers |
18 | this.actions.settings.update.listen(this._update.bind(this)); | 18 | this.actions.settings.update.listen(this._update.bind(this)); |
19 | this.actions.settings.remove.listen(this._remove.bind(this)); | 19 | this.actions.settings.remove.listen(this._remove.bind(this)); |
20 | |||
21 | // this.registerReactions([ | ||
22 | // this._shareSettingsWithMainProcess.bind(this), | ||
23 | // ]); | ||
24 | } | 20 | } |
25 | 21 | ||
26 | setup() { | 22 | setup() { |
@@ -34,9 +30,13 @@ export default class SettingsStore extends Store { | |||
34 | 30 | ||
35 | @action async _update({ settings }) { | 31 | @action async _update({ settings }) { |
36 | await this.updateSettingsRequest.execute(settings)._promise; | 32 | await this.updateSettingsRequest.execute(settings)._promise; |
37 | await this.allSettingsRequest.invalidate({ immediately: true }); | 33 | await this.allSettingsRequest.patch((result) => { |
34 | if (!result) return; | ||
35 | extendObservable(result, settings); | ||
36 | }); | ||
38 | 37 | ||
39 | this._shareSettingsWithMainProcess(); | 38 | // We need a little hack to wait until everything is patched |
39 | setTimeout(() => this._shareSettingsWithMainProcess(), 0); | ||
40 | 40 | ||
41 | gaEvent('Settings', 'update'); | 41 | gaEvent('Settings', 'update'); |
42 | } | 42 | } |