aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/stores/Profile.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/main/src/stores/Profile.ts')
-rw-r--r--packages/main/src/stores/Profile.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/packages/main/src/stores/Profile.ts b/packages/main/src/stores/Profile.ts
index eaf23c4..5f77fe4 100644
--- a/packages/main/src/stores/Profile.ts
+++ b/packages/main/src/stores/Profile.ts
@@ -24,7 +24,6 @@ import {
24} from '@sophie/shared'; 24} from '@sophie/shared';
25import { getSnapshot, Instance } from 'mobx-state-tree'; 25import { getSnapshot, Instance } from 'mobx-state-tree';
26 26
27import SettingsWithId from '../utils/SettingsWithId';
28import generateId from '../utils/generateId'; 27import generateId from '../utils/generateId';
29 28
30export interface ProfileConfig extends ProfileSettingsSnapshotIn { 29export interface ProfileConfig extends ProfileSettingsSnapshotIn {
@@ -40,17 +39,16 @@ export const profile = originalProfile.views((self) => ({
40 39
41export interface Profile extends Instance<typeof profile> {} 40export interface Profile extends Instance<typeof profile> {}
42 41
43export type ProfileSettingsSnapshotWithId = 42export type ProfileSettingsSnapshotWithId = [string, ProfileSettingsSnapshotIn];
44 SettingsWithId<ProfileSettingsSnapshotIn>;
45 43
46export function addMissingProfileIds( 44export function addMissingProfileIds(
47 profileConfigs: ProfileConfig[] | undefined, 45 profileConfigs: ProfileConfig[] | undefined,
48): ProfileSettingsSnapshotWithId[] { 46): ProfileSettingsSnapshotWithId[] {
49 return (profileConfigs ?? []).map((profileConfig) => { 47 return (profileConfigs ?? []).map((profileConfig) => {
50 const { id, ...settings } = profileConfig; 48 const { id, ...settings } = profileConfig;
51 return { 49 return [
52 id: typeof id === 'undefined' ? generateId(settings.name) : id, 50 typeof id === 'undefined' ? generateId(settings.name) : id,
53 settings, 51 settings,
54 }; 52 ];
55 }); 53 });
56} 54}