@@ -11,11 +11,16 @@ import {
11
11
HostBinding ,
12
12
ElementRef ,
13
13
} from '@angular/core' ;
14
- import { hasNoValue , hasValue , isNotEmpty } from '../empty.util' ;
15
14
import { combineLatest , from as fromPromise , Observable , of as observableOf , Subscription , BehaviorSubject } from 'rxjs' ;
16
15
import { ThemeService } from './theme.service' ;
17
16
import { catchError , switchMap , map , tap } from 'rxjs/operators' ;
18
17
import { GenericConstructor } from '../../core/shared/generic-constructor' ;
18
+ import {
19
+ hasNoValue ,
20
+ hasValue ,
21
+ hasValueOperator ,
22
+ isNotEmpty ,
23
+ } from '../empty.util' ;
19
24
import { BASE_THEME_NAME } from './theme.constants' ;
20
25
21
26
@Component ( {
@@ -54,6 +59,7 @@ export abstract class ThemedComponent<T> implements AfterViewInit, OnDestroy, On
54
59
protected abstract getComponentName ( ) : string ;
55
60
56
61
protected abstract importThemedComponent ( themeName : string ) : Promise < any > ;
62
+
57
63
protected abstract importUnthemedComponent ( ) : Promise < any > ;
58
64
59
65
ngOnChanges ( changes : SimpleChanges ) : void {
@@ -82,16 +88,17 @@ export abstract class ThemedComponent<T> implements AfterViewInit, OnDestroy, On
82
88
}
83
89
84
90
initComponentInstance ( changes ?: SimpleChanges ) {
85
- this . themeSub = this . themeService ?. getThemeName$ ( ) . subscribe ( ( ) => {
86
- this . renderComponentInstance ( changes ) ;
87
- } ) ;
91
+ this . themeSub = this . themeService ?. getThemeName$ ( )
92
+ . pipe ( hasValueOperator ( ) )
93
+ . subscribe ( ( ) => {
94
+ this . renderComponentInstance ( changes ) ;
95
+ } ) ;
88
96
}
89
97
90
98
protected renderComponentInstance ( changes ?: SimpleChanges ) : void {
91
99
if ( hasValue ( this . lazyLoadSub ) ) {
92
100
this . lazyLoadSub . unsubscribe ( ) ;
93
101
}
94
-
95
102
if ( hasNoValue ( this . lazyLoadObs ) ) {
96
103
this . lazyLoadObs = combineLatest ( [
97
104
observableOf ( changes ) ,
0 commit comments