angular / angular/components

bug(Datepicker): setting value inside valueChanges doesn't update the UI

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

説明

### Is this a regression?

I don't know if this was working at some point or not

### Description

I am using reactive forms to get/set values from a datepicker and I noticed that if I set a date manually, inside the valueChanges event based on some condition, the value of the form control updates, but not the UI.

The UI changes however if you remove the input and manually set a value inside valueChanges.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/qpu5ns
Steps to reproduce (1):
(1*. Select any date - optional)
1. Select the 10th of any month
2. Check date displayed in input vs date printed under the input

### Expected Behavior

We have the same date in the input as printed below the input

### Actual Behavior

The date in the input is the date selected using the datepicker, the date below the input is the date set inside valueChanges

### Environment

Browser: Chrome
(From the stackblitz environment)
Angular CLI: 16.1.0
Node: 18.18.0
Package Manager: yarn 1.22.19
OS: linux x64

Angular: 16.1.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

| Package | Version |
|--------|--------|
| @angular-devkit/architect | 0.1601.0 |
| @angular-devkit/build-angular | 16.1.0 |
| @angular-devkit/core | 16.1.0 |
| @angular-devkit/schematics | 16.1.0 |
| @angular/cdk | 16.2.9 |
| @angular/cli | 16.1.0 |
| @angular/material | 16.2.9 |
| @angular/material-moment-adapter | 16.2.9 |
| @schematics/angular | 16.1.0 |
| rxjs | 7.4.0 |
| typescript | 5.0.3 |

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

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

調査の方向性

リンクされた StackBlitz の再現手順から始め、Angular Material components repository で reactive-forms による datepicker の値の更新経路を追跡します。valueChanges 内で値を設定した場合の動作を確認し、input UI が更新された form-control の値と一致することを示すリグレッションテストを追加します。

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

評価

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

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

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