aboutsummaryrefslogtreecommitdiffstats
path: root/packages/shared/src/stores/SharedStore.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-01-25 17:26:32 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-02-08 21:43:17 +0100
commit038b35cc43d38d53c3a7f2c90479bb16a18084a6 (patch)
tree72f205b4d79de71b2a60f44c1461d5a1f2237f70 /packages/shared/src/stores/SharedStore.ts
parentrefactor: Move runtime state into shared models (diff)
downloadsophie-038b35cc43d38d53c3a7f2c90479bb16a18084a6.tar.gz
sophie-038b35cc43d38d53c3a7f2c90479bb16a18084a6.tar.zst
sophie-038b35cc43d38d53c3a7f2c90479bb16a18084a6.zip
refactor: Store services in a map
Makes the synchronization of references across the main/renderer process boundary more robust. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/shared/src/stores/SharedStore.ts')
-rw-r--r--packages/shared/src/stores/SharedStore.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/shared/src/stores/SharedStore.ts b/packages/shared/src/stores/SharedStore.ts
index a04f4bf..fc8372e 100644
--- a/packages/shared/src/stores/SharedStore.ts
+++ b/packages/shared/src/stores/SharedStore.ts
@@ -32,8 +32,10 @@ import { service } from './Service';
32 32
33export const sharedStore = types.model('SharedStore', { 33export const sharedStore = types.model('SharedStore', {
34 settings: types.optional(globalSettings, {}), 34 settings: types.optional(globalSettings, {}),
35 profiles: types.array(profile), 35 profilesById: types.map(profile),
36 services: types.array(service), 36 profiles: types.array(types.reference(profile)),
37 servicesById: types.map(service),
38 services: types.array(types.reference(service)),
37 selectedService: types.safeReference(service), 39 selectedService: types.safeReference(service),
38 shouldUseDarkColors: false, 40 shouldUseDarkColors: false,
39}); 41});