fix: check loadedlanguages exists
This commit is contained in:
parent
d8b580b9f5
commit
92e04bcf4f
2 changed files with 2 additions and 2 deletions
|
@ -91,7 +91,7 @@ export function doSetDarkTime(value, options) {
|
|||
export function doSetLanguage(language) {
|
||||
return (dispatch, getState) => {
|
||||
const { settings } = getState();
|
||||
if (settings.language !== language || !settings.loadedLanguages.include(language)) {
|
||||
if (settings.language !== language || (settings.loadedLanguages && !settings.loadedLanguages.include(language))) {
|
||||
// this should match the behavior/logic in index-web.html
|
||||
fetch('https://lbry.com/i18n/get/lbry-desktop/app-strings/' + language + '.json')
|
||||
.then(r => r.json())
|
||||
|
|
|
@ -83,7 +83,7 @@ reducers[ACTIONS.DOWNLOAD_LANGUAGE_SUCCESS] = (state, action) => {
|
|||
const { loadedLanguages } = state;
|
||||
const { language } = action.data;
|
||||
|
||||
if (language && !loadedLanguages.includes(language)) {
|
||||
if (language && loadedLanguages && !loadedLanguages.includes(language)) {
|
||||
return Object.assign({}, state, {
|
||||
loadedLanguages: [...loadedLanguages, language],
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue