Skip to content

Commit af6a221

Browse files
Merge pull request #74 from contentstack/fix/dx-3187-sync-locale-data
Fix/dx 3187 sync locale data
2 parents df7370f + ec0724e commit af6a221

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/datasync-manager",
33
"author": "Contentstack LLC <[email protected]>",
4-
"version": "2.0.10",
4+
"version": "2.0.11",
55
"description": "The primary module of Contentstack DataSync. Syncs Contentstack data with your server using Contentstack Sync API",
66
"main": "dist/index.js",
77
"dependencies": {

src/util/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ export const formatItems = (items, config) => {
149149
items[i]._type = config.contentstack.actions.publish
150150
// extra keys
151151
items[i]._synced_at = time
152-
items[i].locale = items[i].data.publish_details.locale
153-
items[i] = merge(items[i], items[i].data)
152+
const assetLocale = items[i].data.publish_details.locale
153+
items[i] = merge(cloneDeep(items[i]), items[i].data)
154+
items[i].locale = assetLocale
154155
break
155156
case 'asset_unpublished':
156157
delete items[i].type
@@ -170,8 +171,9 @@ export const formatItems = (items, config) => {
170171
items[i]._content_type_uid = items[i].content_type_uid
171172
// extra keys
172173
items[i]._synced_at = time
173-
items[i].locale = items[i].data.publish_details.locale
174-
items[i] = merge(items[i], items[i].data)
174+
const entryLocale = items[i].data.publish_details.locale
175+
items[i] = merge(cloneDeep(items[i]), items[i].data)
176+
items[i].locale = entryLocale
175177
break
176178
case 'entry_unpublished':
177179
delete items[i].type

0 commit comments

Comments
 (0)