fix: apply locale specific status to draft if available

This commit is contained in:
Jessica Chowdhury
2025-08-12 14:29:19 +01:00
parent d885f074bf
commit 35471fcee4

View File

@@ -93,7 +93,7 @@ export const replaceWithDraftIfAvailable = async <T extends TypeWithID>({
}
let draft = versionDocs[0]
console.log('replaceWithDraftIfAvailable', versionDocs[0])
if (!draft) {
return doc
}
@@ -111,6 +111,12 @@ export const replaceWithDraftIfAvailable = async <T extends TypeWithID>({
draft.version = {} as T
}
// Lift locale status from version data if available
const localeStatus = draft.localeStatus || {}
if (locale && localeStatus[locale]) {
;(draft.version as { _status?: string })['_status'] = localeStatus[locale]
}
// Disregard all other draft content at this point,
// Only interested in the version itself.
// Operations will handle firing hooks, etc.