Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix(toast): remove the interim element from the list before closing e…
Browse files Browse the repository at this point in the history
…lement (#11427)
  • Loading branch information
marosoft authored and josephperrott committed Oct 20, 2018
1 parent 20fc2d8 commit f616b25
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/services/interimElement/interimElement.js
Expand Up @@ -358,18 +358,21 @@ function InterimElementProvider() {
}

// Hide the latest showing interim element.
return closeElement(showingInterims[showingInterims.length - 1]);
return closeElement(showingInterims.pop());

function closeElement(interim) {

if (!interim) {
return $q.when(reason);
}

var hideAction = interim
.remove(reason, false, options || { })
.catch(function(reason) { return reason; })
.finally(function() {
hidePromises.splice(hidePromises.indexOf(hideAction), 1);
});

showingInterims.splice(showingInterims.indexOf(interim), 1);
hidePromises.push(hideAction);

return interim.deferred.promise;
Expand Down

0 comments on commit f616b25

Please sign in to comment.