Needs improvement: MatTextColumn is calling dataAccessor method inside the template.
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
### 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:
Contributor guide
Research direction
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.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100