mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Merge pull request #1628 from florianorben/fix-font-load-on-first-page-visit
fix font not being changed on first page visit (if preferences havent been loaded before)
This commit is contained in:
@@ -70,6 +70,7 @@ export default class ChannelLoader extends React.Component {
|
||||
Utils.applyTheme(Constants.THEMES.default);
|
||||
}
|
||||
|
||||
// if preferences have already been stored in local storage do not wait until preference store change is fired and handled in channel.jsx
|
||||
const selectedFont = PreferenceStore.getPreference(Constants.Preferences.CATEGORY_DISPLAY_SETTINGS, 'selected_font', {value: Constants.DEFAULT_FONT}).value;
|
||||
Utils.applyFont(selectedFont);
|
||||
|
||||
|
||||
@@ -18,9 +18,20 @@ import RegisterAppModal from '../components/register_app_modal.jsx';
|
||||
import ImportThemeModal from '../components/user_settings/import_theme_modal.jsx';
|
||||
import InviteMemberModal from '../components/invite_member_modal.jsx';
|
||||
|
||||
import PreferenceStore from '../stores/preference_store.jsx';
|
||||
|
||||
import * as Utils from '../utils/utils.jsx';
|
||||
import * as AsyncClient from '../utils/async_client.jsx';
|
||||
import * as EventHelpers from '../dispatcher/event_helpers.jsx';
|
||||
|
||||
import Constants from '../utils/constants.jsx';
|
||||
|
||||
function onPreferenceChange() {
|
||||
const selectedFont = PreferenceStore.getPreference(Constants.Preferences.CATEGORY_DISPLAY_SETTINGS, 'selected_font', {value: Constants.DEFAULT_FONT}).value;
|
||||
Utils.applyFont(selectedFont);
|
||||
PreferenceStore.removeChangeListener(onPreferenceChange);
|
||||
}
|
||||
|
||||
function setupChannelPage(props, team, channel) {
|
||||
if (props.PostId === '') {
|
||||
EventHelpers.emitChannelClickEvent(channel);
|
||||
@@ -28,6 +39,7 @@ function setupChannelPage(props, team, channel) {
|
||||
EventHelpers.emitPostFocusEvent(props.PostId);
|
||||
}
|
||||
|
||||
PreferenceStore.addChangeListener(onPreferenceChange);
|
||||
AsyncClient.getAllPreferences();
|
||||
|
||||
// ChannelLoader must be rendered first
|
||||
|
||||
Reference in New Issue
Block a user