From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 29 Apr 2023 07:05:05 +0000 (-0700) Subject: Retain doc changes on tab switch after refresh doc X-Git-Tag: v1.14.3~1^2~11^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3243%2Fhead;p=thirdparty%2Fpaperless-ngx.git Retain doc changes on tab switch after refresh doc --- 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 9b23aa0476..bcce59441c 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 @@ -236,10 +236,21 @@ export class DocumentDetailComponent true ) this.suggestions = null - if (this.openDocumentService.getOpenDocument(this.documentId)) { - this.updateComponent( - this.openDocumentService.getOpenDocument(this.documentId) - ) + const openDocument = this.openDocumentService.getOpenDocument( + this.documentId + ) + if (openDocument) { + if (this.documentForm.dirty) { + Object.assign(openDocument, this.documentForm.value) + openDocument['owner'] = + this.documentForm.get('permissions_form').value['owner'] + openDocument['permissions'] = + this.documentForm.get('permissions_form').value[ + 'set_permissions' + ] + delete openDocument['permissions_form'] + } + this.updateComponent(openDocument) } else { this.openDocumentService.openDocument(doc) this.updateComponent(doc)