Skip to content

Commit 9d2325e

Browse files
authored
Merge pull request #608 from contentstack/feature/dropdown-field-choices
refactor:bug [CMG-538] checkbox issue deu to mismatch of uid in group…
2 parents 727a735 + 1349704 commit 9d2325e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
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: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const extractAdvancedFields = (
7070
return {
7171
default_value: defaultText,
7272
validationRegex: regrexValue,
73-
mandatory: ["title", "url"].includes(item.id) ? true : item?.required,
73+
mandatory: item?.required,
7474
multiple: singleRef,
7575
unique: uniqueValue,
7676
nonLocalizable: !(item?.localized === true),
@@ -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)