Skip to content

Commit 5f980ca

Browse files
authored
fix(ui): resolve duplicate rendering of foundation health cards (#202)
Replace CommonModule with NgTemplateOutlet and use property binding instead of structural directive to fix hydration issues in Angular 19 SSR with zoneless change detection. LFXV2-890 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Asitha de Silva <[email protected]>
1 parent 5977c97 commit 5f980ca

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

apps/lfx-one/src/app/shared/components/metric-card/metric-card.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h5 class="text-sm font-medium flex-1">{{ title() }}</h5>
2929

3030
<!-- Body: Chart or Custom Content -->
3131
@if (customContentTemplate) {
32-
<ng-container *ngTemplateOutlet="customContentTemplate"></ng-container>
32+
<ng-container [ngTemplateOutlet]="customContentTemplate"></ng-container>
3333
} @else if (chartData()) {
3434
<div class="mt-3 w-full h-16">
3535
<lfx-chart [type]="chartType()" [data]="chartData()!" [options]="chartOptions()" height="100%"></lfx-chart>

apps/lfx-one/src/app/shared/components/metric-card/metric-card.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright The Linux Foundation and each contributor to LFX.
22
// SPDX-License-Identifier: MIT
33

4-
import { CommonModule } from '@angular/common';
4+
import { NgTemplateOutlet } from '@angular/common';
55
import { Component, ContentChild, input, TemplateRef } from '@angular/core';
66
import { ChartComponent } from '@components/chart/chart.component';
77
import { SkeletonModule } from 'primeng/skeleton';
@@ -12,7 +12,7 @@ import type { ChartData, ChartOptions, ChartType } from 'chart.js';
1212
@Component({
1313
selector: 'lfx-metric-card',
1414
standalone: true,
15-
imports: [CommonModule, ChartComponent, SkeletonModule, TooltipModule],
15+
imports: [NgTemplateOutlet, ChartComponent, SkeletonModule, TooltipModule],
1616
templateUrl: './metric-card.component.html',
1717
})
1818
export class MetricCardComponent {

0 commit comments

Comments
 (0)