fix: Fix Mario
This commit is contained in:
committed by
Khaled Garbaya
parent
1ef4d1c51a
commit
e772281fca
@@ -15,7 +15,7 @@ module.exports = async function attachEntryState (entry) {
|
||||
entry.pendingChanges = false
|
||||
if (!publishedEntry) {
|
||||
entry.draft = true
|
||||
return
|
||||
return entry
|
||||
}
|
||||
// We group fields of type link (i.e. Only objects/array) from the same entry in preview and delivery
|
||||
const entriesToCompare = Object.keys(entry.fields).map((key) => {
|
||||
@@ -39,11 +39,11 @@ module.exports = async function attachEntryState (entry) {
|
||||
// If the field is a single reference we just check if it has pending changes
|
||||
} else if (isLinkDraft(item[0], item[1])) {
|
||||
entry.pendingChanges = true
|
||||
return
|
||||
return entry
|
||||
}
|
||||
})
|
||||
// We check if the root element has pending changes
|
||||
if (entry && publishedEntry && (!isDateEqual(entry.sys.updatedAt !== publishedEntry.sys.updatedAt))) {
|
||||
if (entry && publishedEntry && (entry.sys.updatedAt !== publishedEntry.sys.updatedAt)) {
|
||||
entry.pendingChanges = true
|
||||
}
|
||||
|
||||
@@ -51,7 +51,10 @@ module.exports = async function attachEntryState (entry) {
|
||||
}
|
||||
|
||||
function isLinkDraft (previewLink, deliveryLink) {
|
||||
return isObject(previewLink) && (!previewLink.fields || !isDateEqual(previewLink.sys.updatedAt !== previewLink.sys.updatedAt))
|
||||
if (isObject(previewLink)) {
|
||||
return !previewLink.fields || !isDateEqual(previewLink.sys.updatedAt, previewLink.sys.updatedAt)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function isDateEqual (lhs, rhs) {
|
||||
|
||||
Reference in New Issue
Block a user