bug(datepicker): Date range picker emit repeated events after the first date is selected
- 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
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:
1. Click on the `mat-datepicker-toggle` button.
2. Select a start date like: 6/18/2023
3. Notice on the _Changes_ section below that two events were triggered.
4. Select the end date: 6/24/2023.
5. 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)
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con la riproduzione StackBlitz collegata e il flusso del date range picker di Angular Material che utilizza mat-datepicker-toggle e valueChanges. Riproduci la selezione di 6/18/2023 seguita da 6/24/2023 nella sezione Changes, quindi confrontala con la soluzione alternativa debounceTime(0). Il lavoro è completato quando si verifica un evento valueChanges dopo la data di inizio e uno dopo la data di fine.
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
- 45/100