Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Enhancement: dont wait to get preview (#7894)

shamoon073c42984afc
diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts
index c971870da..084efefe7 100644
--- a/src-ui/src/app/components/document-detail/document-detail.component.ts
+++ b/src-ui/src/app/components/document-detail/document-detail.component.ts
@@ -327,13 +327,8 @@ export class DocumentDetailComponent
switchMap((paramMap) => {
const documentId = +paramMap.get('id')
this.docChangeNotifier.next(documentId)
- return this.documentsService.get(documentId)
- })
- )
- .pipe(
- switchMap((doc) => {
- this.documentId = doc.id
- this.previewUrl = this.documentsService.getPreviewUrl(this.documentId)
+ // Dont wait to get the preview
+ this.previewUrl = this.documentsService.getPreviewUrl(documentId)
this.http.get(this.previewUrl, { responseType: 'text' }).subscribe({
next: (res) => {
this.previewText = res.toString()
@@ -344,6 +339,12 @@ export class DocumentDetailComponent
}`
},
})
+ return this.documentsService.get(documentId)
+ })
+ )
+ .pipe(
+ switchMap((doc) => {
+ this.documentId = doc.id
this.downloadUrl = this.documentsService.getDownloadUrl(
this.documentId
)