angular / angular/components

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

Aperta
#28,737 2 commenti 3 reazioni 0 assegnatari Vedi su GitHub
area: material/datepicker P4
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dal punto di ingresso MatCalendar e riproduci il caso segnalato con un valore dateClass che cambia in modo asincrono. Verifica che la modifica del valore aggiorni le celle del calendario sottoposte a rendering senza dipendere dal workaround setLocale dell’adattatore delle date; l’issue non indica alcun file sorgente né alcun test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.