@@ -8,7 +8,14 @@ import {
88 QueryList
99} from '@angular/core' ;
1010import { ActivatedRoute } from '@angular/router' ;
11- import { Color , FeatureState , NavigationParams , NavigationParamsType , NavigationService } from '@hypertrace/common' ;
11+ import {
12+ Color ,
13+ FeatureState ,
14+ NavigationParams ,
15+ NavigationParamsType ,
16+ NavigationService ,
17+ queryListAndChanges$
18+ } from '@hypertrace/common' ;
1219import { merge , Observable } from 'rxjs' ;
1320import { distinctUntilChanged , map , startWith , tap } from 'rxjs/operators' ;
1421import { NavigableTabComponent } from './navigable-tab.component' ;
@@ -20,7 +27,7 @@ import { NavigableTabComponent } from './navigable-tab.component';
2027 template : `
2128 <div class="tab-group">
2229 <nav mat-tab-nav-bar *htLetAsync="this.activeTab$ as activeTab" disableRipple>
23- <ng-container *ngFor="let tab of this.tabs">
30+ <ng-container *ngFor="let tab of this.tabs$ | async ">
2431 <ng-container *ngIf="!tab.hidden">
2532 <div class="tab-button" *htIfFeature="tab.featureFlags | htFeature as featureState">
2633 <ht-link
@@ -53,19 +60,21 @@ import { NavigableTabComponent } from './navigable-tab.component';
5360} )
5461export class NavigableTabGroupComponent implements AfterContentInit {
5562 @ContentChildren ( NavigableTabComponent )
56- public tabs ! : QueryList < NavigableTabComponent > ;
63+ private readonly tabs ! : QueryList < NavigableTabComponent > ;
5764
5865 @Output ( )
5966 public readonly tabChange : EventEmitter < string | undefined > = new EventEmitter < string | undefined > ( ) ;
6067
6168 public activeTab$ ?: Observable < NavigableTabComponent | undefined > ;
69+ public tabs$ ! : Observable < NavigableTabComponent [ ] > ;
6270
6371 public constructor (
6472 public readonly navigationService : NavigationService ,
6573 private readonly activatedRoute : ActivatedRoute
6674 ) { }
6775
6876 public ngAfterContentInit ( ) : void {
77+ this . tabs$ = queryListAndChanges$ ( this . tabs ) . pipe ( map ( list => list . toArray ( ) ) ) ;
6978 this . activeTab$ = merge ( this . navigationService . navigation$ , this . tabs . changes ) . pipe (
7079 startWith ( undefined ) ,
7180 map ( ( ) => this . findActiveTab ( ) ) ,
0 commit comments