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.
toast: multiple show()/hide() causes TypeError #10715
Copy link
Copy link
Closed
Labels
P2: requiredIssues that must be fixed.Issues that must be fixed.g3: reportedThe issue was reported by an internal or external product team.The issue was reported by an internal or external product team.has: Pull RequestA PR has been created to address this issueA PR has been created to address this issueresolution: fixedtype: bug
Milestone
Description
Actual Behavior:
What is the issue? *
When $mdToast.show() is called twice and then $mdToast.hide() is also called twice, all in quick succession, it results in "TypeError: Cannot read property 'remove' of undefined" and fails to hide the second toast.What is the expected behavior?
No TypeError should be thrown, and both toasts should be hidden.
CodePen (or steps to reproduce the issue): *
CodePen Demo which shows your issue:
https://codepen.io/anon/pen/XgrzxeDetails:
It looks like an issue with $$interimElement (see https://github.com/angular/material/blob/v1.1.4/src/core/services/interimElement/interimElement.js#L291). If you show() two interim at once, the second doesn't actually show until the first is hidden. But when hide() is called, it immediately remove the latest element of 'showingInterims' for it to hide. Thus, the second hide() finds an empty showingInterims list and so produces undefined, which it tries to hide as if it were an interim, resulting in the TypeError. Meanwhile, once the first interim is actually hidden, the second one shows, having been 'missed' by the second hide().
AngularJS Versions: *
AngularJS Version:
1.6.4AngularJS Material Version:
1.1.4
Additional Information:
Browser Type: *
Google ChromeBrowser Version: *
58OS: *
UbuntuStack Traces:
TypeError: Cannot read property 'remove' of undefined
at i (angular-material.min.js:8)
at Object.h (angular-material.min.js:8)
at angular-material.min.js:8
at handleCallback (angular.js:16999)
at angular.js:16812
at processQueue (angular.js:16832)
at angular.js:16876
at Scope.$digest (angular.js:17971)
at angular.js:18200
at completeOutstandingRequest (angular.js:6274) "Possibly unhandled rejection: {}"
(anonymous) @ console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1
(anonymous) @ angular.js:14525
(anonymous) @ angular.js:11008
processChecks @ angular.js:16858
$digest @ angular.js:17971
(anonymous) @ angular.js:18200
completeOutstandingRequest @ angular.js:6274
(anonymous) @ angular.js:6554
Shortcut to create a new CodePen Demo.
Note: *
indicates required information. Without this information, your issue may be auto-closed.
Do not modify the titles or questions. Simply add your responses to the ends of the questions.
Add more lines if needed.
Splaktar
Metadata
Metadata
Assignees
Labels
P2: requiredIssues that must be fixed.Issues that must be fixed.g3: reportedThe issue was reported by an internal or external product team.The issue was reported by an internal or external product team.has: Pull RequestA PR has been created to address this issueA PR has been created to address this issueresolution: fixedtype: bug