diff --git a/ui/js/actions/app.js b/ui/js/actions/app.js index ac757496a..a3b63578c 100644 --- a/ui/js/actions/app.js +++ b/ui/js/actions/app.js @@ -1,4 +1,5 @@ import * as types from "constants/action_types"; +import * as settings from "constants/settings"; import lbry from "lbry"; import { selectUpdateUrl, @@ -320,7 +321,8 @@ export function doDaemonReady() { type: types.DAEMON_READY, data: { page }, }); - dispatch(doSetTheme()); + // Load last theme selected + dispatch(doSetTheme(lbry.getClientSetting(settings.THEME))); dispatch(doFetchDaemonSettings()); dispatch(doFileList()); }; diff --git a/ui/js/actions/settings.js b/ui/js/actions/settings.js index 52a1fee9d..be614c7f5 100644 --- a/ui/js/actions/settings.js +++ b/ui/js/actions/settings.js @@ -67,20 +67,21 @@ export function doGetThemes() { export function doSetTheme(name) { return function(dispatch, getState) { - const last = lbry.getClientSetting(settings.THEME); - const find = name => themes.find(theme => theme.name === name); + // Find a theme from themes list + const find = themeName => themes.find(theme => theme.name === themeName); // Get themes const themes = lbry.getClientSetting(settings.THEMES); - // Find theme - const theme = find(name) || find(last) || find("light"); + // Find theme and set fallback + const theme = find(name) || find("light"); if (theme.path) { - // update theme + // load css const link = document.getElementById("theme"); link.href = theme.path; + // update theme dispatch(doSetClientSetting(settings.THEME, theme.name)); } };