diff options
Diffstat (limited to 'packages/main/src/reactions/synchronizeConfig.ts')
-rw-r--r-- | packages/main/src/reactions/synchronizeConfig.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/main/src/reactions/synchronizeConfig.ts b/packages/main/src/reactions/synchronizeConfig.ts index 4a9c24b..9436c16 100644 --- a/packages/main/src/reactions/synchronizeConfig.ts +++ b/packages/main/src/reactions/synchronizeConfig.ts | |||
@@ -58,6 +58,9 @@ export default async function synchronizeConfig( | |||
58 | return true; | 58 | return true; |
59 | } | 59 | } |
60 | lastConfigOnDisk = sharedStore.config; | 60 | lastConfigOnDisk = sharedStore.config; |
61 | // We can't use `comparer.structural` from `mobx`, because | ||
62 | // it handles missing values and `undefined` values differently, | ||
63 | // but JSON5 is unable to distinguish them. | ||
61 | if (!deepEqual(result.data, lastConfigOnDisk, { strict: true })) { | 64 | if (!deepEqual(result.data, lastConfigOnDisk, { strict: true })) { |
62 | await writeConfig(); | 65 | await writeConfig(); |
63 | } | 66 | } |
@@ -75,7 +78,7 @@ export default async function synchronizeConfig( | |||
75 | () => sharedStore.config, | 78 | () => sharedStore.config, |
76 | debounce((config) => { | 79 | debounce((config) => { |
77 | // We can compare snapshots by reference, since it is only recreated on store changes. | 80 | // We can compare snapshots by reference, since it is only recreated on store changes. |
78 | if (lastConfigOnDisk !== config) { | 81 | if (!deepEqual(config, lastConfigOnDisk, { strict: true })) { |
79 | writeConfig().catch((error) => { | 82 | writeConfig().catch((error) => { |
80 | log.error('Failed to write config on config change', error); | 83 | log.error('Failed to write config on config change', error); |
81 | }); | 84 | }); |