Skip to content

Commit 6818c35

Browse files
committed
Init filter chips after completing all loads
1 parent 4d76bd9 commit 6818c35

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

src/app/component/circular-heatmap/circular-heatmap.component.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,19 @@ export class CircularHeatmapComponent implements OnInit {
6868
}
6969

7070
ngOnInit(): void {
71+
console.log(`${this.perfNow()}s: ngOnInit`);
7172
// Ensure that Levels and Teams load before MaturityData
7273
// using promises, since ngOnInit does not support async/await
7374
this.LoadMaturityLevels()
7475
.then(() => this.LoadTeamsFromMetaYaml())
75-
.then(() => this.LoadMaturityDataFromGeneratedYaml());
76+
.then(() => this.LoadMaturityDataFromGeneratedYaml())
77+
.then(() => {
78+
console.log(`${this.perfNow()}s: set filters: ${this.chips?.length}`);
79+
this.matChipsArray = this.chips.toArray();
80+
});
7681
}
7782

83+
7884
@ViewChildren(MatChip) chips!: QueryList<MatChip>;
7985
matChipsArray: MatChip[] = [];
8086

@@ -255,7 +261,6 @@ export class CircularHeatmapComponent implements OnInit {
255261
this.teamList = this.YamlObject['teams'];
256262
this.teamGroups = this.YamlObject['teamGroups'];
257263
this.teamVisible = [...this.teamList];
258-
console.log(`${this.perfNow()}s: LoadTeamsFromMetaYaml End`);
259264
resolve();
260265
});
261266
});
@@ -276,7 +281,6 @@ export class CircularHeatmapComponent implements OnInit {
276281
this.radial_labels.push('Level ' + y);
277282
this.maxLevelOfActivities = y;
278283
}
279-
console.log(`${this.perfNow()}s: LoadMaturityLevels End`);
280284
resolve();
281285
});
282286
});
@@ -334,16 +338,6 @@ export class CircularHeatmapComponent implements OnInit {
334338
this.updateChips(prevSelectedChip);
335339
}
336340

337-
ngAfterViewInit() {
338-
// Putting all the chips inside an array
339-
340-
setTimeout(() => {
341-
this.matChipsArray = this.chips.toArray();
342-
this.updateChips(true);
343-
this.reColorHeatmap();
344-
}, 100);
345-
}
346-
347341
updateChips(fromTeamGroup: any) {
348342
console.log('updating chips', fromTeamGroup);
349343
// Re select chips

0 commit comments

Comments
 (0)