Skip to content

Commit

Permalink
fix(addon-table): tr, thGroup fix hydration issues (#9460)
Browse files Browse the repository at this point in the history
Co-authored-by: taiga-family-bot <taiga-family-bot@users.noreply.github.com>
  • Loading branch information
vladimirpotekhin and taiga-family-bot authored Oct 11, 2024
1 parent 902e039 commit c5fd3f9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ import {TuiTableTh} from '../th/th.component';
templateUrl: './th-group.template.html',
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [TUI_TABLE_PROVIDER],
host: {
/**
* TODO: fix later
* Be careful and thoughtful about using this attribute.
* It is intended as a last resort workaround.
* Components that break hydration should be
* considered bugs that need to be fixed.
*/
ngSkipHydration: 'true',
},
})
export class TuiTableThGroup<T extends Partial<Record<keyof T, any>>>
implements AfterContentInit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
<ng-container
*ngFor="let key of table.columns"
[ngTemplateOutlet]="(headings[key] && headings[key].template) || plain"
[ngTemplateOutletContext]="{$implicit: key}"
/>
<ng-template
#plain
let-key
>
<ng-template #plain>
<th
*ngIf="!th && !heads.length"
tuiTh
>
{{ key.toString() }}
</th>
</ng-template>
</ng-container>
<th
*ngIf="!th && !heads.length"
tuiTh
>
{{ key.toString() }}
</th>
</ng-template>
</ng-container>
10 changes: 0 additions & 10 deletions projects/addon-table/components/table/tr/tr.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ import {TuiTableTd} from '../td/td.component';
templateUrl: './tr.template.html',
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [TUI_TABLE_PROVIDER],
host: {
/**
* TODO: fix later
* Be careful and thoughtful about using this attribute.
* It is intended as a last resort workaround.
* Components that break hydration should be
* considered bugs that need to be fixed.
*/
ngSkipHydration: 'true',
},
})
export class TuiTableTr<T extends Partial<Record<keyof T, any>>>
implements AfterContentInit
Expand Down
3 changes: 2 additions & 1 deletion projects/addon-table/components/table/tr/tr.template.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ng-container *ngIf="cells$ | async as items">
<ng-container *ngIf="cells$ | async as items; else dummy">
<ng-container
*ngFor="let key of table.columns"
[ngTemplateOutlet]="(items[key] && items[key].template) || plain"
Expand All @@ -13,3 +13,4 @@
</ng-template>
</ng-container>
</ng-container>
<ng-template #dummy><td></td></ng-template>

0 comments on commit c5fd3f9

Please sign in to comment.