Skip to content

Commit

Permalink
Merge pull request #1019 from andrew-frueh/toast-cleanup
Browse files Browse the repository at this point in the history
fix(toasts): closing multiple toasts
  • Loading branch information
andrew-frueh committed Oct 8, 2019
2 parents 701c45f + 704b13e commit 2811014
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

.progress-row {
display: flex;
align-items: end;
width: 100%;
}

Expand Down
4 changes: 0 additions & 4 deletions projects/cashmere/src/lib/toaster/hc-toaster.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export type ToastContentType<T> = Type<T> | TemplateRef<any>;
@Injectable()
export class HcToasterService {
_toasts: HcToastRef[] = [];
endedToastAnim = new Subject<void>();
private get endedToastAnim$(): Observable<void> { return this.endedToastAnim.asObservable(); }

// Inject overlay service
constructor(private injector: Injector, private _overlay: Overlay) {}
Expand Down Expand Up @@ -122,14 +120,12 @@ export class HcToasterService {
filter(event => event.phaseName === 'done' && event.toState === 'leave'),
take(1)
)
.pipe(takeUntil(this.endedToastAnim$))
.subscribe(() => {
this._removeToastPointer(_toastRef);
if (options.toastClosed) {
options.toastClosed();
}
this._updateToastPositions();
this.endedToastAnim.next();
_toastRef.componentInstance._closeClick.unsubscribe();
});

Expand Down

0 comments on commit 2811014

Please sign in to comment.