From e29a39374365b9f69e78cf10972019579da62d41 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun, 8 Feb 2026 23:17:40 -0800 Subject: [PATCH] Fix ExpressionChangedAfterItHasBeenCheckedError --- .../document-attributes.component.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src-ui/src/app/components/manage/document-attributes/document-attributes.component.ts b/src-ui/src/app/components/manage/document-attributes/document-attributes.component.ts index 780b81369..6d3ec763c 100644 --- a/src-ui/src/app/components/manage/document-attributes/document-attributes.component.ts +++ b/src-ui/src/app/components/manage/document-attributes/document-attributes.component.ts @@ -1,5 +1,7 @@ import { NgComponentOutlet } from '@angular/common' import { + AfterViewChecked, + ChangeDetectorRef, Component, inject, OnDestroy, @@ -65,10 +67,13 @@ interface DocumentAttributesSection { ClearableBadgeComponent, ], }) -export class DocumentAttributesComponent implements OnInit, OnDestroy { +export class DocumentAttributesComponent + implements OnInit, OnDestroy, AfterViewChecked +{ private readonly permissionsService = inject(PermissionsService) private readonly activatedRoute = inject(ActivatedRoute) private readonly router = inject(Router) + private readonly cdr = inject(ChangeDetectorRef) private readonly unsubscribeNotifier = new Subject() protected readonly PermissionAction = PermissionAction @@ -130,6 +135,8 @@ export class DocumentAttributesComponent implements OnInit, OnDestroy { @ViewChild('activeOutlet', { read: NgComponentOutlet }) private activeOutlet?: NgComponentOutlet + private lastHeaderLoading: boolean + activeNavID: number = null get visibleSections(): DocumentAttributesSection[] { @@ -207,6 +214,14 @@ export class DocumentAttributesComponent implements OnInit, OnDestroy { this.unsubscribeNotifier.complete() } + ngAfterViewChecked(): void { + const current = this.activeHeaderLoading + if (this.lastHeaderLoading !== current) { + this.lastHeaderLoading = current + this.cdr.detectChanges() + } + } + onNavChange(navChangeEvent: NgbNavChangeEvent): void { const nextSection = this.getSectionForNavID(navChangeEvent.nextId) if (!nextSection) {