diff --git a/ui/component/router/index.js b/ui/component/router/index.js index f9d5a16ed..4fe62a966 100644 --- a/ui/component/router/index.js +++ b/ui/component/router/index.js @@ -3,7 +3,7 @@ import { selectUserVerifiedEmail } from 'redux/selectors/user'; import { selectHasNavigated, selectScrollStartingPosition, selectWelcomeVersion } from 'redux/selectors/app'; import Router from './view'; import { normalizeURI, makeSelectTitleForUri } from 'lbry-redux'; -import { doSetHasNavigated } from 'redux/actions/app'; +import { doSetHasNavigated, doSyncWithPreferences } from 'redux/actions/app'; import { doSyncClientSettings } from 'redux/actions/settings'; const select = state => { const { pathname, hash } = state.router.location; @@ -35,6 +35,7 @@ const select = state => { const perform = dispatch => ({ setHasNavigated: () => dispatch(doSetHasNavigated()), syncSettings: () => dispatch(doSyncClientSettings()), + checkSync: () => dispatch(doSyncWithPreferences()), }); export default connect(select, perform)(Router); diff --git a/ui/component/router/view.jsx b/ui/component/router/view.jsx index aacf5b4c8..590d6954d 100644 --- a/ui/component/router/view.jsx +++ b/ui/component/router/view.jsx @@ -98,6 +98,7 @@ type Props = { hasNavigated: boolean, setHasNavigated: () => void, syncSettings: () => void, + checkSync: () => void, }; function AppRouter(props: Props) { @@ -112,6 +113,7 @@ function AppRouter(props: Props) { hasNavigated, setHasNavigated, syncSettings, + checkSync, } = props; const { entries } = history; const entryIndex = history.index; @@ -135,11 +137,11 @@ function AppRouter(props: Props) { if (!location.pathname.includes(PAGES.SETTINGS) && prevPath.includes(PAGES.SETTINGS)) { syncSettings(); } else if (location.pathname.includes(PAGES.SETTINGS) && !prevPath.includes(PAGES.SETTINGS)) { - syncSettings(); + checkSync(); } }); return unlisten; - }, [prevPath, syncSettings]); + }, [prevPath, syncSettings, checkSync]); useEffect(() => { const unlisten = history.listen(location => {