]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix: intermittent save & close warnings in v2.5.3 (#5838)
authorshamoon <4887959+shamoon@users.noreply.github.com>
Mon, 26 Feb 2024 00:59:29 +0000 (16:59 -0800)
committerGitHub <noreply@github.com>
Mon, 26 Feb 2024 00:59:29 +0000 (00:59 +0000)
src-ui/src/app/components/document-detail/document-detail.component.ts

index 6630f0ad69130a9baa240a816ad8df19ca5821c8..4eae476150fa1beafd7bb2f0642dcbb1c80ad9f8 100644 (file)
@@ -634,11 +634,14 @@ export class DocumentDetailComponent
           // in case data changed while saving eg removing inbox_tags
           this.documentForm.patchValue(docValues)
           this.store.next(this.documentForm.value)
+          this.openDocumentService.setDirty(this.document, false)
           this.toastService.showInfo($localize`Document saved successfully.`)
-          close && this.close()
           this.networkActive = false
           this.error = null
-          this.openDocumentService.refreshDocument(this.documentId)
+          close &&
+            this.close(() =>
+              this.openDocumentService.refreshDocument(this.documentId)
+            )
         },
         error: (error) => {
           this.networkActive = false
@@ -693,12 +696,13 @@ export class DocumentDetailComponent
       })
   }
 
-  close() {
+  close(closedCallback: () => void = null) {
     this.openDocumentService
       .closeDocument(this.document)
       .pipe(first())
       .subscribe((closed) => {
         if (!closed) return
+        if (closedCallback) closedCallback()
         if (this.documentListViewService.activeSavedViewId) {
           this.router.navigate([
             'view',