[Tabs] Toggling quickly can cause content to be duplicated
- Lingua principale
- TypeScript
- Stelle
- 25k
- Fork
- 6.8k
- Merge medio
- 1g 8h
- PR unite (30g)
- 91
Descrizione
#### Bug, feature request, or proposal:
I have had some trouble reproducing this one reliably (it seems to occur more often on my app than in reproductions) but there seems to be a race condition related to the rendering of tab content when it is lazy-loaded.
#### What is the expected behavior?
Tab content should only be displayed once.
#### What is the current behavior?
Toggling tabs very quickly (using arrow keys + space bar) can cause tab content to be drawn multiple times.
#### What are the steps to reproduce?
StackBlitz: https://stackblitz.com/edit/angular-material2-issue-h6pgut?file=app%2Fapp.component.ts
I am intentionally trying to be awkward in terms of timing (ie. setting the `selectedTabIndex` in a timeout), but this behaviour still should not happen.
I have recorded a reproduction in this video: https://gfycat.com/ReadyFairBasil
Note that at the start there is only one instance of each tab's content but by the end the second tab's content is duplicated.
#### What is the use-case or motivation for changing an existing behavior?
Bug
#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Latest StackBlitz (Angular 6-rc2, Material 6-rc1)
#### Is there anything else we should know?
I could only reproduce by using lazy-loaded tabs + NgForTrackBy + OnPush + window.setTimeout, but these may not be necessary. I also had to use keyboard selection to toggle fast enough to trigger the issue.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia eseguendo la riproduzione StackBlitz in app/app.component.ts e provando una selezione rapida da tastiera con schede caricate lazy, NgForTrackBy, OnPush e setTimeout. Segui il percorso di rendering del contenuto delle schede per identificare il motivo per cui il contenuto appare più di una volta; il lavoro è completato quando la riproduzione mantiene esattamente un’istanza durante alternanze rapide ripetute.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, typescript
- Ambito
- frontend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100