(FuseConfig) Only reset the layout object on route changes

This commit is contained in:
Sercan Yemen 2018-08-27 12:28:20 +03:00
parent 962df7fe9a
commit 498b9647e6
3 changed files with 11 additions and 8 deletions

View File

@ -93,15 +93,18 @@ export class FuseConfigService
// Set the config from the default config
this._configSubject = new BehaviorSubject(_.cloneDeep(this._defaultConfig));
// Reload the default config on every RoutesRecognized event if
// the current config is different from the default one
// Reload the default layout config on every RoutesRecognized event
// if the current layout config is different from the default one
this._router.events
.pipe(filter(event => event instanceof RoutesRecognized))
.subscribe(() => {
if ( !_.isEqual(this._configSubject.getValue(), this._defaultConfig) )
if ( !_.isEqual(this._configSubject.getValue().layout, this._defaultConfig.layout) )
{
// Clone the default config
const config = _.cloneDeep(this._defaultConfig);
// Clone the current config
const config = _.cloneDeep(this._configSubject.getValue());
// Reset the layout from the default config
config.layout = _.cloneDeep(this._defaultConfig.layout);
// Set the config
this._configSubject.next(config);

View File

@ -1,6 +1,7 @@
export interface FuseConfig
{
colorTheme: string;
customScrollbars: boolean;
layout: {
style: string,
width: 'fullwidth' | 'boxed',
@ -29,5 +30,4 @@ export interface FuseConfig
position: 'left' | 'right'
}
};
customScrollbars: boolean;
}

View File

@ -11,6 +11,7 @@ import { FuseConfig } from '@fuse/types';
export const fuseConfig: FuseConfig = {
// Color themes can be defined in src/app/app.theme.scss
colorTheme : 'theme-default',
customScrollbars: true,
layout : {
style : 'vertical-layout-1',
width : 'fullwidth',
@ -38,6 +39,5 @@ export const fuseConfig: FuseConfig = {
hidden : false,
position: 'right'
}
},
customScrollbars: true
}
};