This repository was archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
race condition in $mdToast show/hide #9166
Copy link
Copy link
Closed
Labels
P1: urgentUrgent issues that should be addressed in the next minor or patch release.Urgent issues that should be addressed in the next minor or patch release.g3: reportedThe issue was reported by an internal or external product team.The issue was reported by an internal or external product team.
Milestone
Description
Actual Behavior:
What is the issue? *
- There seems to a race condition in $mdToast. If $mdToast.show() is called, and then $mdToast.hide() is called a sufficiently short time later, then hide() will execute before show() has actually generated the toast DOM, and thus will fail to actually hide the toast.
- This issue is exacerbated if show() is called while a previous toast is still being displayed, because the time taken to hide the previous toast further delays the generation of the new toast DOM.
- The issue seems to be the result of this line:
hideExisting.finally(function() { - Moreover, because this line is in interimElement.js, it's possible that it affects other services than just $mdToast (e.g. $mdDialog), although I haven't tested for that.
What is the expected behavior?
hide() should hide the toast as long as it's called after show(), even if immediately after.
CodePen (or steps to reproduce the issue): *
CodePen Demo which shows your issue:
http://codepen.io/anon/pen/jAKgEZDetails:
See the CodePen for information about what specific circumstances do and do not run afoul of the race condition.
Angular Versions: *
Angular Version:
1.4.8Angular Material Version:
1.0.0
Additional Information:
Browser Type: *
ChromeBrowser Version: *
52.0OS: *
Linux
kelchm and devversion
Metadata
Metadata
Assignees
Labels
P1: urgentUrgent issues that should be addressed in the next minor or patch release.Urgent issues that should be addressed in the next minor or patch release.g3: reportedThe issue was reported by an internal or external product team.The issue was reported by an internal or external product team.