angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.23k stars 6.7k forks source link

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

Open karmasakshi opened 4 months ago

karmasakshi commented 4 months ago

Is this a regression?

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

LazarKrmpot commented 1 month ago

+1