diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts index c387b3130..ed84d72ab 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts @@ -466,7 +466,16 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni } private async _reloadFile(file: File): Promise { + const previousFile = this.fileData?.file; await this._loadFileData(file); + + const fileHasBeenExcludedOrIncluded = previousFile?.excluded !== this.fileData?.file?.excluded; + const excludedPagesHaveChanged = JSON.stringify(previousFile?.excludedPages) !== JSON.stringify(this.fileData?.file?.excludedPages); + if (fileHasBeenExcludedOrIncluded || excludedPagesHaveChanged) { + await this._deleteAnnotations(); + await this._cleanupAndRedrawAnnotations(); + } + await this._stampPDF(); }