@@ -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 ( {
@@ -240,14 +240,7 @@ export class ThemeService {
240240 if ( hasValue ( parentThemeName ) ) {
241241 // inherit the head tags of the parent theme
242242 return this . createHeadTags ( parentThemeName ) ;
243- }
244- const defaultThemeConfig = getDefaultThemeConfig ( ) ;
245- const defaultThemeName = defaultThemeConfig . name ;
246- if (
247- hasNoValue ( defaultThemeName ) ||
248- themeName === defaultThemeName ||
249- themeName === BASE_THEME_NAME
250- ) {
243+ } else {
251244 // last resort, use fallback favicon.ico
252245 return [
253246 this . createHeadTag ( {
@@ -260,9 +253,6 @@ export class ThemeService {
260253 } )
261254 ] ;
262255 }
263-
264- // inherit the head tags of the default theme
265- return this . createHeadTags ( defaultThemeConfig . name ) ;
266256 }
267257
268258 return headTagConfigs . map ( this . createHeadTag . bind ( this ) ) ;
@@ -425,9 +415,10 @@ export class ThemeService {
425415 * @private
426416 */
427417 private getActionForMatch ( newTheme : Theme , currentThemeName : string ) : SetThemeAction | NoOpAction {
428- if ( hasValue ( newTheme ) && newTheme . config . name !== currentThemeName ) {
418+ const newThemeName : string = newTheme ?. config . name ?? BASE_THEME_NAME ;
419+ if ( newThemeName !== currentThemeName ) {
429420 // 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 ) ;
421+ return new SetThemeAction ( newThemeName ) ;
431422 } else {
432423 // Otherwise, do nothing
433424 return new NoOpAction ( ) ;
0 commit comments