From 1b2f14ec89ca817c32c6b5730068bdbf5ae6d30f Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Wed, 4 Sep 2024 16:22:30 +0300 Subject: [PATCH] RED-9962 - RM-163: Components values are not updated in the UI until page is refreshed --- .../structured-component-management.component.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/components/structured-component-management/structured-component-management.component.ts b/apps/red-ui/src/app/modules/file-preview/components/structured-component-management/structured-component-management.component.ts index 0ec8d38ea..20a3313e2 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/structured-component-management/structured-component-management.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/structured-component-management/structured-component-management.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit, signal, ViewChildren } from '@angular/core'; +import { Component, effect, Input, OnInit, signal, ViewChildren } from '@angular/core'; import { List } from '@common-ui/utils'; import { IconButtonTypes, LoadingService } from '@iqser/common-ui'; import { ComponentLogEntry, Dictionary, File, IComponentLogEntry, WorkflowFileStatuses } from '@red/domain'; @@ -11,6 +11,7 @@ import { map } from 'rxjs/operators'; import { toObservable } from '@angular/core/rxjs-interop'; import { AsyncPipe, NgForOf, NgIf } from '@angular/common'; import { TranslateModule } from '@ngx-translate/core'; +import { FilePreviewStateService } from '../../services/file-preview-state.service'; @Component({ selector: 'redaction-structured-component-management', @@ -33,7 +34,13 @@ export class StructuredComponentManagementComponent implements OnInit { private readonly _loadingService: LoadingService, private readonly _componentLogFilterService: ComponentLogFilterService, private readonly _filterService: FilterService, - ) {} + private readonly _state: FilePreviewStateService, + ) { + effect(async () => { + this._state.file(); + await this.#loadData(); + }); + } get canEdit() { return this.file.workflowStatus !== WorkflowFileStatuses.APPROVED; @@ -75,7 +82,6 @@ export class StructuredComponentManagementComponent implements OnInit { } async #loadData(): Promise { - this._loadingService.start(); const componentLogData = await firstValueFrom( this._componentLogService.getComponentLogData( this.file.dossierTemplateId, @@ -86,7 +92,6 @@ export class StructuredComponentManagementComponent implements OnInit { ); this.#computeFilters(componentLogData); this.componentLogData.set(componentLogData); - this._loadingService.stop(); } #computeFilters(componentLogs: ComponentLogEntry[]) {