Browse Source

Fix default settings not creating (#237)

This happened due to adding the config reducer to the main process. Since it tries to set up the initial state, the current implementation was failing since it wasn't trying to use the mock settings.
master
jeffvli 3 years ago
parent
commit
66ca03f746
  1. 30
      src/redux/configSlice.ts

30
src/redux/configSlice.ts

@ -122,42 +122,42 @@ const initialState: ConfigPage = {
font: String(parsedSettings.font), font: String(parsedSettings.font),
listView: { listView: {
music: { music: {
columns: parsedSettings.musicListColumns!.map((col: any) => { columns: parsedSettings.musicListColumns?.map((col: any) => {
return { ...col, uniqueId: nanoid() }; return { ...col, uniqueId: nanoid() };
}), }),
rowHeight: Number(parsedSettings.musicListRowHeight), rowHeight: Number(parsedSettings.musicListRowHeight),
fontSize: Number(parsedSettings.musicListFontSize), fontSize: Number(parsedSettings.musicListFontSize),
}, },
album: { album: {
columns: parsedSettings.albumListColumns!.map((col: any) => { columns: parsedSettings.albumListColumns?.map((col: any) => {
return { ...col, uniqueId: nanoid() }; return { ...col, uniqueId: nanoid() };
}), }),
rowHeight: Number(parsedSettings.albumListRowHeight), rowHeight: Number(parsedSettings.albumListRowHeight),
fontSize: Number(parsedSettings.albumListFontSize), fontSize: Number(parsedSettings.albumListFontSize),
}, },
playlist: { playlist: {
columns: parsedSettings.playlistListColumns!.map((col: any) => { columns: parsedSettings.playlistListColumns?.map((col: any) => {
return { ...col, uniqueId: nanoid() }; return { ...col, uniqueId: nanoid() };
}), }),
rowHeight: Number(parsedSettings.playlistListRowHeight), rowHeight: Number(parsedSettings.playlistListRowHeight),
fontSize: Number(parsedSettings.playlistListFontSize), fontSize: Number(parsedSettings.playlistListFontSize),
}, },
artist: { artist: {
columns: parsedSettings.artistListColumns!.map((col: any) => { columns: parsedSettings.artistListColumns?.map((col: any) => {
return { ...col, uniqueId: nanoid() }; return { ...col, uniqueId: nanoid() };
}), }),
rowHeight: Number(parsedSettings.artistListRowHeight), rowHeight: Number(parsedSettings.artistListRowHeight),
fontSize: Number(parsedSettings.artistListFontSize), fontSize: Number(parsedSettings.artistListFontSize),
}, },
genre: { genre: {
columns: parsedSettings.genreListColumns!.map((col: any) => { columns: parsedSettings.genreListColumns?.map((col: any) => {
return { ...col, uniqueId: nanoid() }; return { ...col, uniqueId: nanoid() };
}), }),
rowHeight: Number(parsedSettings.genreListRowHeight), rowHeight: Number(parsedSettings.genreListRowHeight),
fontSize: Number(parsedSettings.genreListFontSize), fontSize: Number(parsedSettings.genreListFontSize),
}, },
mini: { mini: {
columns: parsedSettings.miniListColumns!.map((col: any) => { columns: parsedSettings.miniListColumns?.map((col: any) => {
return { ...col, uniqueId: nanoid() }; return { ...col, uniqueId: nanoid() };
}), }),
rowHeight: Number(parsedSettings.miniListRowHeight), rowHeight: Number(parsedSettings.miniListRowHeight),
@ -190,20 +190,20 @@ const initialState: ConfigPage = {
}, },
external: { external: {
discord: { discord: {
enabled: parsedSettings.discord.enabled || false, enabled: parsedSettings.discord?.enabled || false,
clientId: parsedSettings.discord.clientId || '', clientId: parsedSettings.discord?.clientId || '',
}, },
obs: { obs: {
enabled: parsedSettings.obs.enabled || false, enabled: parsedSettings.obs?.enabled || false,
url: parsedSettings.obs.url || '', url: parsedSettings.obs?.url || '',
path: parsedSettings.obs.path || '', path: parsedSettings.obs?.path || '',
pollingInterval: parsedSettings.obs.pollingInterval || 1000, pollingInterval: parsedSettings.obs?.pollingInterval || 1000,
type: parsedSettings.obs.type || 'local', type: parsedSettings.obs?.type || 'local',
}, },
}, },
window: { window: {
minimizeToTray: Boolean(parsedSettings.minimizeToTray), minimizeToTray: parsedSettings.minimizeToTray,
exitToTray: Boolean(parsedSettings.exitToTray), exitToTray: parsedSettings.exitToTray,
}, },
serverType: parsedSettings.serverType, serverType: parsedSettings.serverType,
}; };

Loading…
Cancel
Save