From 92e04bcf4faaef66bf73bc5cd6ca1d731aaad9ac Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Fri, 6 Dec 2019 08:58:17 -0500 Subject: [PATCH] fix: check loadedlanguages exists --- ui/redux/actions/settings.js | 2 +- ui/redux/reducers/settings.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/redux/actions/settings.js b/ui/redux/actions/settings.js index c3726ac4c..2b2242fd8 100644 --- a/ui/redux/actions/settings.js +++ b/ui/redux/actions/settings.js @@ -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()) diff --git a/ui/redux/reducers/settings.js b/ui/redux/reducers/settings.js index 4b2e14192..714b3f7cb 100644 --- a/ui/redux/reducers/settings.js +++ b/ui/redux/reducers/settings.js @@ -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], });