RED-6680: remove double ngzone run

This commit is contained in:
Dan Percic 2023-06-16 19:32:41 +03:00
parent bee3d1b76d
commit a942939af0

View File

@ -338,30 +338,28 @@ export class FilePreviewScreenComponent
} }
openManualAnnotationDialog(manualRedactionEntryWrapper: ManualRedactionEntryWrapper) { openManualAnnotationDialog(manualRedactionEntryWrapper: ManualRedactionEntryWrapper) {
return this._ngZone.run(() => { const file = this.state.file();
const file = this.state.file();
this._dialogService.openDialog( this._dialogService.openDialog(
'manualAnnotation', 'manualAnnotation',
{ manualRedactionEntryWrapper, dossierId: this.dossierId, file }, { manualRedactionEntryWrapper, dossierId: this.dossierId, file },
(result: { annotations: ManualRedactionEntryWrapper[]; dictionary?: Dictionary }) => { (result: { annotations: ManualRedactionEntryWrapper[]; dictionary?: Dictionary }) => {
const selectedAnnotations = this._annotationManager.selected; const selectedAnnotations = this._annotationManager.selected;
if (selectedAnnotations.length > 0) { if (selectedAnnotations.length > 0) {
this._annotationManager.delete([selectedAnnotations[0].Id]); this._annotationManager.delete([selectedAnnotations[0].Id]);
} }
const add$ = this._manualRedactionService.addAnnotation( const add$ = this._manualRedactionService.addAnnotation(
result.annotations.map(w => w.manualRedactionEntry).filter(e => e.positions[0].page <= file.numberOfPages), result.annotations.map(w => w.manualRedactionEntry).filter(e => e.positions[0].page <= file.numberOfPages),
this.dossierId, this.dossierId,
this.fileId, this.fileId,
result.dictionary?.label, result.dictionary?.label,
); );
const addAndReload$ = add$.pipe(switchMap(() => this._filesService.reload(this.dossierId, file))); const addAndReload$ = add$.pipe(switchMap(() => this._filesService.reload(this.dossierId, file)));
return firstValueFrom(addAndReload$.pipe(catchError(() => of(undefined)))); return firstValueFrom(addAndReload$.pipe(catchError(() => of(undefined))));
}, },
); );
});
} }
toggleFullScreen() { toggleFullScreen() {