fix RED-3757

This commit is contained in:
Dan Percic 2022-04-04 17:55:35 +03:00
parent 99a904b48d
commit fe2c880978
3 changed files with 8 additions and 11 deletions

View File

@ -68,7 +68,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
readonly canPerformAnnotationActions$: Observable<boolean>;
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() {

View File

@ -491,12 +491,8 @@ export class AnnotationActionsService {
annotationsChanged: EventEmitter<AnnotationWrapper[]>,
) {
obs.subscribe({
next: () => {
annotationsChanged.emit(annotations);
},
error: () => {
annotationsChanged.emit();
},
next: () => annotationsChanged.emit(annotations),
error: () => annotationsChanged.emit(),
});
}

View File

@ -95,9 +95,7 @@ export class FileDataService {
);
}
async loadAnnotations() {
const file = await this._state.file;
async loadAnnotations(file: File) {
if (!file || file.isUnprocessed) {
return;
}