From 038b35cc43d38d53c3a7f2c90479bb16a18084a6 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Tue, 25 Jan 2022 17:26:32 +0100 Subject: refactor: Store services in a map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes the synchronization of references across the main/renderer process boundary more robust. Signed-off-by: Kristóf Marussy --- packages/shared/src/stores/SharedStore.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'packages/shared/src/stores/SharedStore.ts') 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'; export const sharedStore = types.model('SharedStore', { settings: types.optional(globalSettings, {}), - profiles: types.array(profile), - services: types.array(service), + profilesById: types.map(profile), + profiles: types.array(types.reference(profile)), + servicesById: types.map(service), + services: types.array(types.reference(service)), selectedService: types.safeReference(service), shouldUseDarkColors: false, }); -- cgit v1.2.3-54-g00ecf