mirror of https://github.com/vector-im/riot-web
				
				
				
			Add hack to work around mystery settings bug
							parent
							
								
									71f5c8b2b0
								
							
						
					
					
						commit
						a744415221
					
				| 
						 | 
				
			
			@ -185,7 +185,10 @@ export default class GeneralUserSettingsTab extends React.Component {
 | 
			
		|||
        // The settings watcher doesn't fire until the echo comes back from the
 | 
			
		||||
        // server, so to make the theme change immediately we need to manually
 | 
			
		||||
        // do the dispatch now
 | 
			
		||||
        dis.dispatch({action: 'recheck_theme'});
 | 
			
		||||
        // XXX: The local echoed value appears to be unreliable, in particular
 | 
			
		||||
        // when settings custom themes(!) so adding forceTheme to override
 | 
			
		||||
        // the value from settings.
 | 
			
		||||
        dis.dispatch({action: 'recheck_theme', forceTheme: newTheme});
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    _onUseSystemThemeChanged = (checked) => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,13 +60,15 @@ export class ThemeWatcher {
 | 
			
		|||
 | 
			
		||||
    _onAction = (payload) => {
 | 
			
		||||
        if (payload.action === 'recheck_theme') {
 | 
			
		||||
            this.recheck();
 | 
			
		||||
            // XXX forceTheme
 | 
			
		||||
            this.recheck(payload.forceTheme);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    recheck() {
 | 
			
		||||
    // XXX: forceTheme param aded here as local echo appears to be unreliable
 | 
			
		||||
    recheck(forceTheme) {
 | 
			
		||||
        const oldTheme = this._currentTheme;
 | 
			
		||||
        this._currentTheme = this.getEffectiveTheme();
 | 
			
		||||
        this._currentTheme = forceTheme === undefined ? this.getEffectiveTheme() : forceTheme;
 | 
			
		||||
        if (oldTheme !== this._currentTheme) {
 | 
			
		||||
            setTheme(this._currentTheme);
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue