Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit f616b25

Browse files
marosoftjosephperrott
authored andcommitted
fix(toast): remove the interim element from the list before closing element (#11427)
1 parent 20fc2d8 commit f616b25

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/core/services/interimElement/interimElement.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,18 +358,21 @@ function InterimElementProvider() {
358358
}
359359

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

363363
function closeElement(interim) {
364364

365+
if (!interim) {
366+
return $q.when(reason);
367+
}
368+
365369
var hideAction = interim
366370
.remove(reason, false, options || { })
367371
.catch(function(reason) { return reason; })
368372
.finally(function() {
369373
hidePromises.splice(hidePromises.indexOf(hideAction), 1);
370374
});
371375

372-
showingInterims.splice(showingInterims.indexOf(interim), 1);
373376
hidePromises.push(hideAction);
374377

375378
return interim.deferred.promise;

0 commit comments

Comments
 (0)