File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export const themeStateSelector = createFeatureSelector<ThemeState>('theme');
2929
3030export const currentThemeSelector = createSelector (
3131 themeStateSelector ,
32- ( state : ThemeState ) : string => hasValue ( state ) ? state . currentTheme : undefined
32+ ( state : ThemeState ) : string => hasValue ( state ) ? state . currentTheme : BASE_THEME_NAME ,
3333) ;
3434
3535@Injectable ( {
@@ -262,7 +262,7 @@ export class ThemeService {
262262 }
263263
264264 // inherit the head tags of the default theme
265- return this . createHeadTags ( defaultThemeConfig . name ) ;
265+ return this . createHeadTags ( defaultThemeName ) ;
266266 }
267267
268268 return headTagConfigs . map ( this . createHeadTag . bind ( this ) ) ;
@@ -425,9 +425,10 @@ export class ThemeService {
425425 * @private
426426 */
427427 private getActionForMatch ( newTheme : Theme , currentThemeName : string ) : SetThemeAction | NoOpAction {
428- if ( hasValue ( newTheme ) && newTheme . config . name !== currentThemeName ) {
428+ const newThemeName : string = newTheme ?. config . name ?? BASE_THEME_NAME ;
429+ if ( newThemeName !== currentThemeName ) {
429430 // If we have a match, and it isn't already the active theme, set it as the new theme
430- return new SetThemeAction ( newTheme . config . name ) ;
431+ return new SetThemeAction ( newThemeName ) ;
431432 } else {
432433 // Otherwise, do nothing
433434 return new NoOpAction ( ) ;
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ import { environment } from '../environments/environment';
55import { hasNoValue } from '../app/shared/empty.util' ;
66
77import { AppConfig } from './app-config.interface' ;
8- import { ThemeConfig } from './theme.model' ;
8+ import { ThemeConfig , NamedThemeConfig } from './theme.model' ;
9+ import { BASE_THEME_NAME } from '../app/shared/theme-support/theme.constants' ;
910
1011/**
1112 * Extend Angular environment with app config.
@@ -44,7 +45,9 @@ const getDefaultThemeConfig = (): ThemeConfig => {
4445 hasNoValue ( themeConfig . regex ) &&
4546 hasNoValue ( themeConfig . handle ) &&
4647 hasNoValue ( themeConfig . uuid )
47- ) ;
48+ ) ?? {
49+ name : BASE_THEME_NAME ,
50+ } as NamedThemeConfig ;
4851} ;
4952
5053export {
You can’t perform that action at this time.
0 commit comments