angular / angular/components

bug(MatCalendar): updating dateClass does not update calendar view

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

Descripción

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

We have displayed a calendar and when changing the month we load data from the backend to highlight certain cells.

We tried to update the `dateClass` using observables together with the async pipe which did not work since the calendar is not updating when the reference changes.

A workaround was to call `setLocale` of the date adapter which triggers a rerender.

I consider this a bug and not a feature because it is not mentioned anywhere that this cannot be done and `dateFilter` also can be updated asynchronously.

### Reproduction

StackBlitz link:
Steps to reproduce:
1.
2.

### Expected Behavior

Update calendar view on `dateClass` change

### Actual Behavior

calendar view does not update when `dateClass` changes.

### Environment

- Angular: 17.3.0
- CDK/Material: 17.3.0
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): MacOS

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en el punto de entrada MatCalendar y reproduce el caso reportado con un valor dateClass que cambia de forma asíncrona. Verifica que cambiar el valor actualice las celdas del calendario renderizadas sin depender de la solución alternativa setLocale del adaptador de fechas; el issue no menciona ningún archivo fuente ni prueba.

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
Error
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.