Skip to content

Commit a7f8eda

Browse files
committed
refactor:bug [CMG-538] checkbox issue deu to mismatch of uid in group field and childItems in contentful
1 parent 0de6a9a commit a7f8eda

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

ui/src/components/ContentMapper/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
825825
}, [tableData]);
826826

827827
const getParentId = (uid: string) => {
828-
return tableData?.find(i => i?.uid === uid)?.id ?? ''
828+
return tableData?.find(i => i?.uid?.toLowerCase() === uid?.toLowerCase())?.id ?? ''
829829
}
830830

831831
const modifiedObj = (obj: FieldMapType) => {
@@ -940,8 +940,8 @@ const ContentMapper = forwardRef(({handleStepChange}: contentMapperProps, ref: R
940940
} else if(latestRow?.parentId && !["title", "url"]?.includes?.(latestRow?.uid?.toLowerCase())){
941941
// Extract the group UID if item is child of any group
942942
const uidBeforeDot = latestRow?.uid?.split?.('.')?.[0]?.toLowerCase();
943-
const groupItem = tableData?.find((entry) => entry?.uid === uidBeforeDot);
944-
const childItems = tableData?.filter((entry) => entry?.uid?.toLowerCase()?.startsWith(groupItem?.uid + '.'));
943+
const groupItem = tableData?.find((entry) => entry?.uid?.toLowerCase() === uidBeforeDot);
944+
const childItems = tableData?.filter((entry) => entry?.uid?.toLowerCase()?.startsWith(groupItem?.uid?.toLowerCase() + '.'));
945945

946946
if(latestRow?.checked) {
947947
if(!selectedObj[latestRow?.parentId]){

upload-api/migration-contentful/libs/contentTypeMapper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,27 +364,29 @@ const contentTypeMapper = (data) => {
364364
case 'Location': {
365365
acc.push(createFieldObject(item, 'group', 'group'));
366366
acc.push({
367-
uid: `${item.name}.lat`,
367+
uid: `${item.id}.lat`,
368368
otherCmsField: `${item.name} > lat`,
369369
otherCmsType: 'Number',
370370
contentstackField: `${item.name} > lat`,
371371
contentstackFieldUid: `${uidCorrector(item?.id, item?.prefix)}.lat`,
372372
contentstackFieldType: 'number',
373373
backupFieldType: 'number',
374+
backupFieldUid: `${uidCorrector(item?.id, item?.prefix)}.lat`,
374375
advanced: {
375376
mandatory: item?.required,
376377
unique: false,
377378
nonLocalizable: !(item?.localized === true) || false
378379
}
379380
});
380381
acc.push({
381-
uid: `${item.name}.lon`,
382+
uid: `${item.id}.lon`,
382383
otherCmsField: `${item.name} > lon`,
383384
otherCmsType: 'Number',
384385
contentstackField: `${item.name} > lon`,
385386
contentstackFieldUid: `${uidCorrector(item?.id, item?.prefix)}.lon`,
386387
contentstackFieldType: 'number',
387388
backupFieldType: 'number',
389+
backupFieldUid: `${uidCorrector(item?.id, item?.prefix)}.lon`,
388390
advanced: {
389391
mandatory: item?.required,
390392
unique: false,

0 commit comments

Comments
 (0)