chore: cleans up duplicative versions
This commit is contained in:
@@ -42,6 +42,13 @@ export const saveCollectionVersion = async ({
|
||||
});
|
||||
|
||||
if (latestVersion) {
|
||||
// If the latest version is a draft, no need to re-save it
|
||||
// Example: when "promoting" a draft to published, the draft already exists.
|
||||
// Instead, return null
|
||||
if (latestVersion?.version?._status === 'draft') {
|
||||
return null;
|
||||
}
|
||||
|
||||
version = latestVersion.version;
|
||||
version = JSON.parse(JSON.stringify(version));
|
||||
version = sanitizeInternalFields(version);
|
||||
|
||||
@@ -37,6 +37,13 @@ export const saveGlobalVersion = async ({
|
||||
});
|
||||
|
||||
if (latestVersion) {
|
||||
// If the latest version is a draft, no need to re-save it
|
||||
// Example: when "promoting" a draft to published, the draft already exists.
|
||||
// Instead, return null
|
||||
if (latestVersion?.version?._status === 'draft') {
|
||||
return null;
|
||||
}
|
||||
|
||||
version = latestVersion.version;
|
||||
version = JSON.parse(JSON.stringify(version));
|
||||
version = sanitizeInternalFields(version);
|
||||
|
||||
Reference in New Issue
Block a user