diff options
author | 2018-11-15 14:11:39 +0100 | |
---|---|---|
committer | 2018-11-15 14:11:39 +0100 | |
commit | 334c908b5f29617b24df14c9c1c11b76a2648d5a (patch) | |
tree | 4b6be32d2d88fdcca3d148c98fe96f7e3f5704f3 /src/electron/Settings.js | |
parent | Streamline toggle styling (diff) | |
download | ferdium-app-334c908b5f29617b24df14c9c1c11b76a2648d5a.tar.gz ferdium-app-334c908b5f29617b24df14c9c1c11b76a2648d5a.tar.zst ferdium-app-334c908b5f29617b24df14c9c1c11b76a2648d5a.zip |
Fix issue when hydrating settings with missing default keys
Diffstat (limited to 'src/electron/Settings.js')
-rw-r--r-- | src/electron/Settings.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/electron/Settings.js b/src/electron/Settings.js index b3138e948..622d53ebc 100644 --- a/src/electron/Settings.js +++ b/src/electron/Settings.js | |||
@@ -17,7 +17,7 @@ export default class Settings { | |||
17 | } | 17 | } |
18 | 18 | ||
19 | set(settings) { | 19 | set(settings) { |
20 | this.store = Object.assign(this.store, settings); | 20 | this.store = this._merge(this.store, settings); |
21 | 21 | ||
22 | this._writeFile(); | 22 | this._writeFile(); |
23 | } | 23 | } |
@@ -30,8 +30,12 @@ export default class Settings { | |||
30 | return this.store[key]; | 30 | return this.store[key]; |
31 | } | 31 | } |
32 | 32 | ||
33 | _merge(settings) { | ||
34 | return Object.assign(DEFAULT_APP_SETTINGS, settings); | ||
35 | } | ||
36 | |||
33 | _hydrate() { | 37 | _hydrate() { |
34 | this.store = readJsonSync(SETTINGS_PATH); | 38 | this.store = this._merge(readJsonSync(SETTINGS_PATH)); |
35 | debug('Hydrate store', toJS(this.store)); | 39 | debug('Hydrate store', toJS(this.store)); |
36 | } | 40 | } |
37 | 41 | ||