angular / angular/components

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

オープン
#28,737 コメント 2 件 リアクション 3 件 担当者 0 名 GitHub で見る
area: material/datepicker P4
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

MatCalendar のエントリポイントから開始し、dateClass の値が非同期に変化する、報告されたケースを再現します。値を変更すると、Date Adapter の setLocale ワークアラウンドに依存せずに、レンダリングされたカレンダーセルが更新されることを確認します。この issue ではソースファイルもテストも指定されていません。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。