angular / angular/components

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

Abierto
#28,208 0 comentarios 0 reacciones 0 asignados Ver en GitHub
area: cdk/table area: material/table P4 perf
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

### 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:

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Refactorización
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.