angular / angular/components

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

Ouverte
#28,737 2 commentaires 3 réactions 0 personnes assignées Voir sur GitHub
area: material/datepicker P4
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez au point d’entrée MatCalendar et reproduisez le cas signalé avec une valeur dateClass qui change de manière asynchrone. Vérifiez que la modification de la valeur met à jour les cellules de calendrier rendues sans dépendre du contournement setLocale de l’adaptateur de dates ; l’issue ne nomme aucun fichier source ni test.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.