angular / angular/components

bug(snackbar): Snackbar appears twice when loading on app start

オープン
#28,601 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: material/snack-bar P5
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
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

Snackbar appears twice - once without animation, and once with. I could only see this when showing the snackbar in my root component. Please manually scrub the videos to see the two states.

https://github.com/angular/components/assets/4698762/1a0fe6a8-2c2b-4489-b18e-97208b79d1b9

https://github.com/angular/components/assets/4698762/f71b3034-6fbe-4e61-aea2-b99e8a49b47d

Showing snackbar later works fine, as seen on docs: https://material.angular.io/components/snack-bar/examples.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-shuyqd?file=src%2Fmain.ts

Steps to reproduce:

1. Load snackbar in root component
2. Reload

### Expected Behavior

Snackbar should appear once, gracefully with fade-in animation. It does so when not loading in root component.

### Actual Behavior

Snackbar appears once without animation and then fade-in animation kicks in.

### Environment

- Angular: 17.2.1
- CDK/Material: 17.2.0
- Browser(s): Consistently on Firefox and Safari, sometimes on Chrome
- Operating System (e.g. Windows, macOS, Ubuntu):

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

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

調査の方向性

リンクされている StackBlitz の再現コードから始め、特に src/main.ts を確認し、Firefox または Safari で再読み込みして snackbar の重複した状態を確認します。ルートコンポーネントの起動時の動作を追跡し、後から snackbar を表示する場合と比較します。snackbar が fade-in アニメーション付きで一度だけ表示されれば完了です。

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

評価

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

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

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