f88bfcd7f3
## Issues 1. We were manually adding `selectLanguage(state)` as a prop to components used in Settings Page to trigger a render. Flaws: - Unclear that the unused prop is just to trigger a render. - Manually adding on a case-by-case basis will break over time, especially when language can now be changed outside of the Settings Page. 2. The translation file fetching is delayed and also takes time, so the GUI will end up having mixed strings on F5, depending on when the fetch completed. ## Approach Make the app wrapper have a key that's tied to the language and translation data, so the entire app renders when language changes. Seems like a common design in most apps. ## Ticket 921 language refresh / selection issues
21 lines
856 B
JavaScript
21 lines
856 B
JavaScript
import * as SETTINGS from 'constants/settings';
|
|
import { connect } from 'react-redux';
|
|
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
|
import { selectGetSyncErrorMessage } from 'redux/selectors/sync';
|
|
import { selectClientSetting } from 'redux/selectors/settings';
|
|
import { doSetWalletSyncPreference } from 'redux/actions/settings';
|
|
import { doOpenModal } from 'redux/actions/app';
|
|
import SyncToggle from './view';
|
|
|
|
const select = (state) => ({
|
|
syncEnabled: selectClientSetting(state, SETTINGS.ENABLE_SYNC),
|
|
verifiedEmail: selectUserVerifiedEmail(state),
|
|
getSyncError: selectGetSyncErrorMessage(state),
|
|
});
|
|
|
|
const perform = (dispatch) => ({
|
|
setSyncEnabled: (value) => dispatch(doSetWalletSyncPreference(value)),
|
|
openModal: (id, props) => dispatch(doOpenModal(id, props)),
|
|
});
|
|
|
|
export default connect(select, perform)(SyncToggle);
|