Skip to content

Commit

Permalink
feat(#28) Migrations fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
piwko28 committed Oct 22, 2024
1 parent 7522670 commit d005397
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion i18n/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default {
'settings.locale.datesDisplay.option.descriptive': 'Opisowo',
'settings.locale.datesDisplay.option.numeric': 'Numerycznie',
'settings.app.header': 'Aplikacja',
'settings.app.colorScheme.label': 'Schemat koloróœ',
'settings.app.colorScheme.label': 'Schemat kolorów',
'settings.app.colorScheme.option.auto': 'Automatyczny',
'settings.app.colorScheme.option.light': 'Jasny',
'settings.app.colorScheme.option.dark': 'Ciemny',
Expand Down
14 changes: 8 additions & 6 deletions store/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,8 @@ const v1Migrations = (settings?: ISettings): ISettings | undefined => {
};
};

export const settingsMigrations = (state: State): State => {
return {
v1: fillGaps(initialSettings, v1Migrations(state.v1)),
};
export const settingsMigrations = (settings: ISettings): ISettings => {
return fillGaps(initialSettings, v1Migrations(settings));
};

/**
Expand Down Expand Up @@ -215,8 +213,12 @@ export const selectServers = (state: RootState) =>

const temporaryEmptyServer = emptyServer();

export const selectServer = (state: RootState) =>
selectSettings(state).servers[0] ?? temporaryEmptyServer;
export const selectServer = (state: RootState) => {
const settings = selectSettings(state);
return 'servers' in settings && settings.servers.length > 0
? settings.servers[0]
: temporaryEmptyServer;
};

/* locale */

Expand Down

0 comments on commit d005397

Please sign in to comment.