We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1dd6c1a commit e56a367Copy full SHA for e56a367
.changeset/twenty-tips-leave.md
@@ -0,0 +1,5 @@
1
+---
2
+'@blinkk/root-cms': patch
3
4
+
5
+fix: preserve sys when copying a doc
packages/root-cms/ui/utils/doc.ts
@@ -488,6 +488,17 @@ export async function cmsCreateDoc(
488
},
489
fields: options?.fields ?? {},
490
};
491
492
+ // Preserve "sys" values when copying and overwriting a doc.
493
+ if (doc.exists() && !options?.overwrite) {
494
+ const oldData = doc.data();
495
+ data.sys = {
496
+ ...oldData.sys,
497
+ modifiedAt: serverTimestamp(),
498
+ modifiedBy: window.firebase.user.email,
499
+ };
500
+ }
501
502
await setDoc(docRef, data);
503
logAction('doc.create', {metadata: {docId}});
504
}
0 commit comments