bug(datepicker): Date range picker emit repeated events after the first date is selected
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 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
When a date range picker is opened and the start date is selected, two consecutive valueChanges event are triggered, and after the end date is selected the final event is triggered, in total 3 events happens instead of only two.
Reproduction
StackBlitz link: https://stackblitz.com/edit/shrtut?
Steps to reproduce:
- Click on the
mat-datepicker-togglebutton. - Select a start date like: 6/18/2023
- Notice on the Changes section below that two events were triggered.
- Select the end date: 6/24/2023.
- A final event in logged on the Changes section.
Expected Behavior
After selecting the first date only a single valueChanges event should be triggered.
The expected behavior is show on the Workaround Changes section where a debounceTime(0) is forced in order to remove the spurious repeated event.
Actual Behavior
Two events are triggered after selecting the start date
Environment
- Angular: 16.1.1
- CDK/Material: 16.1.1
- Browser(s): Firefox, Chrome.
- Operating System: Linux (Fedora)
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的 StackBlitz 复现开始,并使用 mat-datepicker-toggle 和 valueChanges 测试 Angular Material date range picker 流程。在 Changes 部分复现先选择 6/18/2023、再选择 6/24/2023,然后将其与 debounceTime(0) 这一变通方案进行比较。完成的标准是:开始日期之后有一次 valueChanges 事件,结束日期之后也有一次。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100