mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-10-08 00:57:14 +00:00
Fix: prevent saving changes to stale cached document object (#14065)
This commit is contained in:
1 parent
95944a553d
commit
df8e95cbd4
2 files changed
+28
-1
No files matched your search
@@ -50,7 +50,15 @@ export class OpenDocumentsService {
|
||||
if (index > -1) {
|
||||
this.documentService.get(id).subscribe({
|
||||
next: (doc) => {
|
||||
this.openDocuments[index] = doc
|
||||
const openDoc = this.openDocuments.find((d) => d.id == id)
|
||||
if (!openDoc) return
|
||||
const unsavedEdits = Object.fromEntries(
|
||||
(openDoc.__changedFields ?? []).map((field) => [
|
||||
field,
|
||||
openDoc[field],
|
||||
])
|
||||
)
|
||||
Object.assign(openDoc, doc, unsavedEdits)
|
||||
this.save()
|
||||
},
|
||||
error: () => {
|
||||
|
||||
Reference in new issue
Block a user