diff --git a/client/src/app/site/agenda/components/list-of-speakers/list-of-speakers.component.ts b/client/src/app/site/agenda/components/list-of-speakers/list-of-speakers.component.ts index 9d89ff605..6acaff039 100644 --- a/client/src/app/site/agenda/components/list-of-speakers/list-of-speakers.component.ts +++ b/client/src/app/site/agenda/components/list-of-speakers/list-of-speakers.component.ts @@ -164,10 +164,12 @@ export class ListOfSpeakersComponent extends BaseViewComponent implements OnInit if (this.isCurrentListOfSpeakers) { this.projectors = this.projectorRepo.getViewModelList(); this.updateClosProjector(); - this.projectorRepo.getViewModelListObservable().subscribe(newProjectors => { - this.projectors = newProjectors; - this.updateClosProjector(); - }); + this.subscriptions.push( + this.projectorRepo.getViewModelListObservable().subscribe(newProjectors => { + this.projectors = newProjectors; + this.updateClosProjector(); + }) + ); } else { const id = +this.route.snapshot.url[this.route.snapshot.url.length - 1].path; this.setListOfSpeakersId(id); @@ -226,6 +228,7 @@ export class ListOfSpeakersComponent extends BaseViewComponent implements OnInit this.setListOfSpeakersId(listOfSpeakers.id); } }); + this.subscriptions.push(this.projectorSubscription); } /** @@ -247,7 +250,10 @@ export class ListOfSpeakersComponent extends BaseViewComponent implements OnInit this.closSubscription = this.listOfSpeakersRepo.getViewModelObservable(id).subscribe(listOfSpeakers => { if (listOfSpeakers) { - super.setTitle(listOfSpeakers.getTitle() + ` - ${this.translate.instant('List of speakers')}`); + const title = this.isCurrentListOfSpeakers + ? 'Current list of speakers' + : listOfSpeakers.getTitle() + ` - ${this.translate.instant('List of speakers')}`; + super.setTitle(title); this.viewListOfSpeakers = listOfSpeakers; const allSpeakers = this.viewListOfSpeakers.speakers.sort((a, b) => a.weight - b.weight); this.speakers = allSpeakers.filter(speaker => speaker.state === SpeakerState.WAITING); diff --git a/client/src/app/site/base/base-view.ts b/client/src/app/site/base/base-view.ts index cf7b2c338..4b7e4a115 100644 --- a/client/src/app/site/base/base-view.ts +++ b/client/src/app/site/base/base-view.ts @@ -24,7 +24,8 @@ export abstract class BaseViewComponent extends BaseComponent implements OnDestr protected subscriptions: Subscription[]; /** - * Constructor for bas elist views + * Constructor for base list views + * * @param titleService the title serivce, passed to the base component * @param translate the translate service, passed to the base component * @param matSnackBar the snack bar service. Needed for showing errors. @@ -96,12 +97,10 @@ export abstract class BaseViewComponent extends BaseComponent implements OnDestr * executes the life cycle again */ protected cleanSubjects(): void { - if (this.subscriptions.length > 0) { - for (const sub of this.subscriptions) { - sub.unsubscribe(); - } - this.subscriptions = []; + for (const sub of this.subscriptions) { + sub.unsubscribe(); } + this.subscriptions = []; } /**