cef9ade10e
## 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 (missed component). 2. The translation file fetching is delayed (at least in Odysee) 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 odysee 921
17 lines
625 B
JavaScript
17 lines
625 B
JavaScript
import { connect } from 'react-redux';
|
|
import * as SETTINGS from 'constants/settings';
|
|
import { doSetAutoLaunch } from 'redux/actions/settings';
|
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
|
import { doToast } from 'redux/actions/notifications';
|
|
import SettingAutoLaunch from './view';
|
|
|
|
const select = (state) => ({
|
|
autoLaunch: makeSelectClientSetting(SETTINGS.AUTO_LAUNCH)(state),
|
|
});
|
|
|
|
const perform = (dispatch) => ({
|
|
showToast: (options) => dispatch(doToast(options)),
|
|
setAutoLaunch: (value) => dispatch(doSetAutoLaunch(value)),
|
|
});
|
|
|
|
export default connect(select, perform)(SettingAutoLaunch);
|