diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts index f538eba51a..e771d64dad 100644 --- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts +++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts @@ -86,6 +86,8 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements } ngOnInit():void { + let initialized = false; + this .apiV3Service .work_packages @@ -97,17 +99,25 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements void this.wpActivity.require(this.workPackage).then((activities:HalResource[]) => { this.updateActivities(activities); this.cdRef.detectChanges(); - this.storeService.query.hasNotifications$ - .pipe(take(1)) - .subscribe((hasNotification) => { - if (hasNotification) { - this.scrollToUnreadNotification(); - } - }); + + if (!initialized) { + initialized = true; + this.scrollIfNotificationPresent(); + } }); }); } + private scrollIfNotificationPresent() { + this.storeService.query.hasNotifications$ + .pipe(take(1)) + .subscribe((hasNotification) => { + if (hasNotification) { + this.scrollToUnreadNotification(); + } + }); + } + protected updateActivities(activities:HalResource[]) { this.unfilteredActivities = activities;