angular / angular/components

Needs improvement: MatTextColumn is calling dataAccessor method inside the template.

オープン
#28,208 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: cdk/table area: material/table P4 perf
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

### Description

Call of `dataAccessor` method is against Angular best practices and will be bad for performance in tables with large data sets.


{{dataAccessor(data, name)}}

See [line 30 inside `MatTextColumn` for reference](https://github.com/angular/components/blob/main/src/material/table/text-column.ts#L30C11-L30C35).

### Reproduction

See [the Stackblitz and the example for `mat-text-column` inside the documentation here for a working example](https://material.angular.io/components/table/examples#table-text-column).

### Expected Behavior

Set the data in a variable inside the component on initialization and bind that to the template instead.

### Actual Behavior

It gets the data inside the template by calling the `dataAccessor` method.

### Environment

- Angular:
- CDK/Material:

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start by reading src/material/table/text-column.ts around line 30, then run the mat-text-column documentation example and its linked Stackblitz to observe the current behavior. Done means the template no longer calls dataAccessor for each table render, while the example continues to display the expected cell values.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
リファクタリング
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。