Fix: prevent saving changes to stale cached document object (#14065)

This commit is contained in:
shamoon authored and GitHub committed 2026-09-10 19:16:51 -07:00
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: () => {