diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index 35c00a0c1..8d04f6e6c 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -68,7 +68,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni readonly canPerformAnnotationActions$: Observable; readonly fileId = this.state.fileId; readonly dossierId = this.state.dossierId; - readonly file$ = this.state.file$.pipe(tap(() => this._fileDataService.loadAnnotations())); + readonly file$ = this.state.file$.pipe(tap(file => this._fileDataService.loadAnnotations(file))); ready = false; private _lastPage: string; @@ -390,7 +390,10 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni async annotationsChangedByReviewAction() { this.multiSelectService.deactivate(); const file = await this.state.file; - await firstValueFrom(this._filesService.reload(this.dossierId, file)); + const fileReloaded = await firstValueFrom(this._filesService.reload(this.dossierId, file)); + if (!fileReloaded) { + await this._fileDataService.loadAnnotations(file); + } } closeFullScreen() { diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts index a0d727cb7..dfb010854 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts @@ -491,12 +491,8 @@ export class AnnotationActionsService { annotationsChanged: EventEmitter, ) { obs.subscribe({ - next: () => { - annotationsChanged.emit(annotations); - }, - error: () => { - annotationsChanged.emit(); - }, + next: () => annotationsChanged.emit(annotations), + error: () => annotationsChanged.emit(), }); } diff --git a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts index be96222e0..63e03e35b 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts @@ -95,9 +95,7 @@ export class FileDataService { ); } - async loadAnnotations() { - const file = await this._state.file; - + async loadAnnotations(file: File) { if (!file || file.isUnprocessed) { return; }