From 00fc2c8da49088edeaba39521d6229360697c322 Mon Sep 17 00:00:00 2001 From: jessop Date: Fri, 28 Aug 2020 11:22:00 -0400 Subject: [PATCH] quick fix for sync --- ui/redux/actions/app.js | 22 ++++++++++++---------- ui/redux/reducers/settings.js | 10 ++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ui/redux/actions/app.js b/ui/redux/actions/app.js index 84f7ee1e6..7b9eeef0c 100644 --- a/ui/redux/actions/app.js +++ b/ui/redux/actions/app.js @@ -605,18 +605,20 @@ export function doGetAndPopulatePreferences() { // @if TARGET='app' const { settings } = savedPreferences.value; - Object.entries(settings).forEach(([key, val]) => { - if (SDK_SYNC_KEYS.includes(key)) { - if (shouldSetSetting(key, val, daemonSettings[key])) { - if (key === DAEMON_SETTINGS.LBRYUM_SERVERS) { - const servers = stringifyServerParam(val); - dispatch(doSetDaemonSetting(key, servers, true)); - } else { - dispatch(doSetDaemonSetting(key, val, true)); + if (settings) { + Object.entries(settings).forEach(([key, val]) => { + if (SDK_SYNC_KEYS.includes(key)) { + if (shouldSetSetting(key, val, daemonSettings[key])) { + if (key === DAEMON_SETTINGS.LBRYUM_SERVERS) { + const servers = stringifyServerParam(val); + dispatch(doSetDaemonSetting(key, servers, true)); + } else { + dispatch(doSetDaemonSetting(key, val, true)); + } } } - } - }); + }); + } // @endif } } diff --git a/ui/redux/reducers/settings.js b/ui/redux/reducers/settings.js index 7a100fd96..a59a4c79c 100644 --- a/ui/redux/reducers/settings.js +++ b/ui/redux/reducers/settings.js @@ -167,12 +167,10 @@ reducers[LBRY_REDUX_ACTIONS.USER_STATE_POPULATE] = (state, action) => { const { clientSettings: currentClientSettings } = state; const { settings: sharedPreferences } = action.data; - if (currentClientSettings[SETTINGS.ENABLE_SYNC]) { - const selectedSettings = getSubsetFromKeysArray(sharedPreferences, clientSyncKeys); - const mergedClientSettings = { ...currentClientSettings, ...selectedSettings }; - return Object.assign({}, state, { sharedPreferences, clientSettings: mergedClientSettings }); - } - return Object.assign({}, state, { sharedPreferences, clientSettings: currentClientSettings }); + const selectedSettings = sharedPreferences ? getSubsetFromKeysArray(sharedPreferences, clientSyncKeys) : {}; + const mergedClientSettings = { ...currentClientSettings, ...selectedSettings }; + const newSharedPreferences = sharedPreferences || {}; + return Object.assign({}, state, { sharedPreferences: newSharedPreferences, clientSettings: mergedClientSettings }); }; reducers[LBRY_REDUX_ACTIONS.SAVE_CUSTOM_WALLET_SERVERS] = (state, action) => { -- 2.45.2