diff --git a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts index eae606c2f..626a46c9e 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts @@ -8,6 +8,7 @@ import { HostListener, OnDestroy, OnInit, + signal, TemplateRef, untracked, viewChild, @@ -108,13 +109,17 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On return this.isDocumine && file.excludedFromAutomaticAnalysis && file.workflowStatus !== WorkflowFileStatuses.APPROVED; }); protected displayedAnnotations = new Map(); - readonly activeAnnotations = computed(() => this.displayedAnnotations.get(this.pdf.currentPage()) || []); + readonly activeAnnotations = computed(() => { + this.#displayedAnnotationsUpdated(); + return this.displayedAnnotations.get(this.pdf.currentPage()) || []; + }); protected displayedPages: number[] = []; protected pagesPanelActive = true; protected enabledFilters = []; private readonly _annotationsElement = viewChild('annotationsElement'); private readonly _quickNavigationElement = viewChild('quickNavigation'); readonly #isIqserDevMode = this._userPreferenceService.isIqserDevMode; + readonly #displayedAnnotationsUpdated = signal(false); #displayedPagesChanged = false; constructor( @@ -452,6 +457,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On } this.displayedAnnotations = this._annotationProcessingService.filterAndGroupAnnotations(annotations, primary, secondary); + this.#displayedAnnotationsUpdated.set(true); const pagesThatDisplayAnnotations = [...this.displayedAnnotations.keys()]; this.enabledFilters = this.filterService.enabledFlatFilters; if (this.enabledFilters.some(f => f.id === 'pages-without-annotations')) {