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
27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
JavaScript
import * as MODALS from 'constants/modal_types';
|
|
import { connect } from 'react-redux';
|
|
import { selectShowMatureContent } from 'redux/selectors/settings';
|
|
import { doToast } from 'redux/actions/notifications';
|
|
import { doOpenModal, doHideModal } from 'redux/actions/app';
|
|
import { withRouter } from 'react-router';
|
|
import { doResolveUris } from 'redux/actions/claims';
|
|
import analytics from 'analytics';
|
|
import Wunderbar from './view';
|
|
|
|
const select = (state, props) => ({
|
|
showMature: selectShowMatureContent(state),
|
|
});
|
|
|
|
const perform = (dispatch, ownProps) => ({
|
|
doResolveUris: (uris) => dispatch(doResolveUris(uris)),
|
|
navigateToSearchPage: (query) => {
|
|
let encodedQuery = encodeURIComponent(query);
|
|
ownProps.history.push({ pathname: `/$/search`, search: `?q=${encodedQuery}` });
|
|
analytics.apiLogSearch();
|
|
},
|
|
doShowSnackBar: (message) => dispatch(doToast({ isError: true, message })),
|
|
doOpenMobileSearch: () => dispatch(doOpenModal(MODALS.MOBILE_SEARCH)),
|
|
doCloseMobileSearch: () => dispatch(doHideModal()),
|
|
});
|
|
|
|
export default withRouter(connect(select, perform)(Wunderbar));
|