angular / angular/components

bug(Mat-Tabs): Mat-tabs on mat-dialog not working when selectedIndex change asynchronously

Offen
#19,814 8 Kommentare 7 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/tabs P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

#### Reproduction
https://stackblitz.com/edit/mat-tabs-on-mat-dialog-problem

Steps to reproduce:
1. Use mat-dialog for dialog
2. Use mat-tabs for multiple tabs
3. Use selectedIndex to select tabs dynamically
4. Initialize selectedIndex value
4. Change selectedIndex asynchronously


#### Expected Behavior

I will initially see the tab of the index that I initialize first. But when I change the selectedIndex, it will switch to the new tab of that index.

#### Actual Behavior

Asynchronously changed tabs contents will go blank. The tab contains blank content. But if I add 500ms with setTimeout it works. But without this setTimeout, it dosn't work

#### Environment

- Angular: 8 or 9
- CDK/Material: 8, 10
- Chrome, Firefox
- Ubuntu, Windows

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der verknüpften StackBlitz-Reproduktion und untersuche das Zusammenspiel zwischen MatTabs und MatDialog, wenn sich selectedIndex asynchron ändert. Reproduziere den leeren Tab-Inhalt ohne die Verzögerung von 500ms und überprüfe anschließend, dass sowohl der anfänglich ausgewählte Tab als auch der asynchron ausgewählte Tab korrekt gerendert werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.