From d157eeae6ab8e84f0d5b348bb8a6cc4aab42462f Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 13 Jan 2024 00:11:57 -0800 Subject: [PATCH] Cancel some http calls on doc change --- .../document-detail/document-detail.component.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 4e648ef74..09c64d1a3 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 @@ -421,7 +421,11 @@ export class DocumentDetailComponent this.updateFormForCustomFields() this.documentsService .getMetadata(doc.id) - .pipe(first()) + .pipe( + first(), + takeUntil(this.unsubscribeNotifier), + takeUntil(this.docChangeNotifier) + ) .subscribe({ next: (result) => { this.metadata = result @@ -442,7 +446,11 @@ export class DocumentDetailComponent ) { this.documentsService .getSuggestions(doc.id) - .pipe(first(), takeUntil(this.unsubscribeNotifier)) + .pipe( + first(), + takeUntil(this.unsubscribeNotifier), + takeUntil(this.docChangeNotifier) + ) .subscribe({ next: (result) => { this.suggestions = result