mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-26 01:16:16 +00:00
Try to hunt down some more unguarded subscriptions
This commit is contained in:
@@ -397,7 +397,14 @@ export class DocumentDetailComponent
|
|||||||
|
|
||||||
private loadDocument(documentId: number): void {
|
private loadDocument(documentId: number): void {
|
||||||
this.previewUrl = this.documentsService.getPreviewUrl(documentId)
|
this.previewUrl = this.documentsService.getPreviewUrl(documentId)
|
||||||
this.http.get(this.previewUrl, { responseType: 'text' }).subscribe({
|
this.http
|
||||||
|
.get(this.previewUrl, { responseType: 'text' })
|
||||||
|
.pipe(
|
||||||
|
first(),
|
||||||
|
takeUntil(this.unsubscribeNotifier),
|
||||||
|
takeUntil(this.docChangeNotifier)
|
||||||
|
)
|
||||||
|
.subscribe({
|
||||||
next: (res) => (this.previewText = res.toString()),
|
next: (res) => (this.previewText = res.toString()),
|
||||||
error: (err) =>
|
error: (err) =>
|
||||||
(this.previewText = $localize`An error occurred loading content: ${
|
(this.previewText = $localize`An error occurred loading content: ${
|
||||||
@@ -412,7 +419,9 @@ export class DocumentDetailComponent
|
|||||||
// 404 is handled in the subscribe below
|
// 404 is handled in the subscribe below
|
||||||
return of(null)
|
return of(null)
|
||||||
}),
|
}),
|
||||||
first()
|
first(),
|
||||||
|
takeUntil(this.unsubscribeNotifier),
|
||||||
|
takeUntil(this.docChangeNotifier)
|
||||||
)
|
)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (doc) => {
|
next: (doc) => {
|
||||||
@@ -442,7 +451,14 @@ export class DocumentDetailComponent
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.openDocumentService.openDocument(doc).pipe(first()).subscribe()
|
this.openDocumentService
|
||||||
|
.openDocument(doc)
|
||||||
|
.pipe(
|
||||||
|
first(),
|
||||||
|
takeUntil(this.unsubscribeNotifier),
|
||||||
|
takeUntil(this.docChangeNotifier)
|
||||||
|
)
|
||||||
|
.subscribe()
|
||||||
}
|
}
|
||||||
this.updateComponent(useDoc)
|
this.updateComponent(useDoc)
|
||||||
this.titleSubject
|
this.titleSubject
|
||||||
@@ -533,7 +549,9 @@ export class DocumentDetailComponent
|
|||||||
this.loadDocument(documentId)
|
this.loadDocument(documentId)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.route.paramMap.subscribe((paramMap) => {
|
this.route.paramMap
|
||||||
|
.pipe(takeUntil(this.unsubscribeNotifier))
|
||||||
|
.subscribe((paramMap) => {
|
||||||
const section = paramMap.get('section')
|
const section = paramMap.get('section')
|
||||||
if (section) {
|
if (section) {
|
||||||
const navIDKey: string = Object.keys(DocumentDetailNavIDs).find(
|
const navIDKey: string = Object.keys(DocumentDetailNavIDs).find(
|
||||||
@@ -777,7 +795,11 @@ export class DocumentDetailComponent
|
|||||||
discard() {
|
discard() {
|
||||||
this.documentsService
|
this.documentsService
|
||||||
.get(this.documentId)
|
.get(this.documentId)
|
||||||
.pipe(first())
|
.pipe(
|
||||||
|
first(),
|
||||||
|
takeUntil(this.unsubscribeNotifier),
|
||||||
|
takeUntil(this.docChangeNotifier)
|
||||||
|
)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (doc) => {
|
next: (doc) => {
|
||||||
Object.assign(this.document, doc)
|
Object.assign(this.document, doc)
|
||||||
@@ -880,9 +902,10 @@ export class DocumentDetailComponent
|
|||||||
.patch(this.getChangedFields())
|
.patch(this.getChangedFields())
|
||||||
.pipe(
|
.pipe(
|
||||||
switchMap((updateResult) => {
|
switchMap((updateResult) => {
|
||||||
return this.documentListViewService
|
return this.documentListViewService.getNext(this.documentId).pipe(
|
||||||
.getNext(this.documentId)
|
map((nextDocId) => ({ nextDocId, updateResult })),
|
||||||
.pipe(map((nextDocId) => ({ nextDocId, updateResult })))
|
takeUntil(this.unsubscribeNotifier)
|
||||||
|
)
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.pipe(
|
.pipe(
|
||||||
@@ -892,7 +915,10 @@ export class DocumentDetailComponent
|
|||||||
return this.openDocumentService
|
return this.openDocumentService
|
||||||
.closeDocument(this.document)
|
.closeDocument(this.document)
|
||||||
.pipe(
|
.pipe(
|
||||||
map((closeResult) => ({ updateResult, nextDocId, closeResult }))
|
map(
|
||||||
|
(closeResult) => ({ updateResult, nextDocId, closeResult }),
|
||||||
|
takeUntil(this.unsubscribeNotifier)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1412,7 +1438,14 @@ export class DocumentDetailComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
private tryRenderTiff() {
|
private tryRenderTiff() {
|
||||||
this.http.get(this.previewUrl, { responseType: 'arraybuffer' }).subscribe({
|
this.http
|
||||||
|
.get(this.previewUrl, { responseType: 'arraybuffer' })
|
||||||
|
.pipe(
|
||||||
|
first(),
|
||||||
|
takeUntil(this.unsubscribeNotifier),
|
||||||
|
takeUntil(this.docChangeNotifier)
|
||||||
|
)
|
||||||
|
.subscribe({
|
||||||
next: (res) => {
|
next: (res) => {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user