angular / angular/components

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

Đang mở
#28,601 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
area: material/snack-bar P5
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

### 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):

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với bản tái hiện StackBlitz được liên kết, đặc biệt là src/main.ts, và tải lại trong Firefox hoặc Safari để xác nhận các trạng thái snackbar trùng lặp. Theo dõi hành vi khởi động của component gốc và so sánh với việc hiển thị snackbar sau đó. Hoàn tất khi snackbar chỉ xuất hiện một lần cùng với animation fade-in của nó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.