aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/stores/SharedStore.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-26 19:59:04 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-26 20:02:08 +0100
commit4ef4306cf401829905f764845ed78ac072fb94b6 (patch)
tree980a91a11cb1ac5f730d72c385e542edd0617d82 /packages/main/src/stores/SharedStore.ts
parentrefactor: Clarify main process architecture (diff)
downloadsophie-4ef4306cf401829905f764845ed78ac072fb94b6.tar.gz
sophie-4ef4306cf401829905f764845ed78ac072fb94b6.tar.zst
sophie-4ef4306cf401829905f764845ed78ac072fb94b6.zip
refactor: Make all stores optional
This reduces boilerplate and helps with config file robustness: if a field is missing from the config file, it will be replaced with its default value.
Diffstat (limited to 'packages/main/src/stores/SharedStore.ts')
-rw-r--r--packages/main/src/stores/SharedStore.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/main/src/stores/SharedStore.ts b/packages/main/src/stores/SharedStore.ts
index 04dda32..e20150d 100644
--- a/packages/main/src/stores/SharedStore.ts
+++ b/packages/main/src/stores/SharedStore.ts
@@ -18,7 +18,7 @@
18 * SPDX-License-Identifier: AGPL-3.0-only 18 * SPDX-License-Identifier: AGPL-3.0-only
19 */ 19 */
20 20
21import { Instance } from 'mobx-state-tree'; 21import { Instance, types } from 'mobx-state-tree';
22import { sharedStore as originalSharedStore } from '@sophie/shared'; 22import { sharedStore as originalSharedStore } from '@sophie/shared';
23 23
24import { config } from './Config'; 24import { config } from './Config';
@@ -26,7 +26,7 @@ import { config } from './Config';
26export type { SharedStoreSnapshotIn, SharedStoreSnapshotOut } from '@sophie/shared'; 26export type { SharedStoreSnapshotIn, SharedStoreSnapshotOut } from '@sophie/shared';
27 27
28export const sharedStore = originalSharedStore.props({ 28export const sharedStore = originalSharedStore.props({
29 config, 29 config: types.optional(config, {}),
30}); 30});
31 31
32export interface SharedStore extends Instance<typeof sharedStore> {} 32export interface SharedStore extends Instance<typeof sharedStore> {}