Skip to content

Commit f888fb8

Browse files
committed
refactor:undefined notification error in legacy cms
1 parent e7ea1cf commit f888fb8

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

ui/src/components/DestinationStack/Actions/LoadStacks.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,10 @@ const LoadStacks = (props: LoadFileFormatProps) => {
236236
dispatch(updateNewMigrationData(newMigrationDataObj));
237237
}
238238
const newMigrationDataObj: INewMigration = {
239-
// ...newMigrationDataRef?.current,
240-
...newMigrationData,
239+
...newMigrationDataRef?.current,
240+
//...newMigrationData,
241241
destination_stack: {
242-
...newMigrationData?.destination_stack,
242+
...newMigrationDataRef?.current?.destination_stack,
243243
csLocale: csLocales?.data?.locales
244244
}
245245
};

ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const LoadFileFormat = (props: LoadFileFormatProps) => {
112112
...newMigrationDataRef?.current,
113113
legacy_cms: {
114114
...newMigrationDataRef?.current?.legacy_cms,
115-
selectedFileFormat: selectedFileFormatObj
115+
selectedFileFormat: selectedFileFormatObj,
116116
}
117117
};
118118

@@ -131,7 +131,7 @@ const LoadFileFormat = (props: LoadFileFormatProps) => {
131131
/**** ALL USEEffects HERE ****/
132132
useEffect(()=>{
133133
handleFileFormat();
134-
handleBtnClick();
134+
//handleBtnClick();
135135
},[]);
136136

137137
useEffect(() => {

ui/src/components/LegacyCms/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ const LegacyCMSComponent = forwardRef(({ legacyCMSData, isCompleted, handleOnAll
132132
? selectedCmsData.allowed_file_formats?.find(
133133
(cms: ICardType) => cms?.fileformat_id === legacyCMSData?.file_format
134134
)
135-
: defaultCardType;
135+
: newMigrationData?.legacy_cms?.selectedFileFormat;
136136

137137
//Make Step 1 Complete
138138
if (!isEmptyString(selectedCmsData?.cms_id || newMigrationData?.legacy_cms?.selectedCms?.cms_id)) {

ui/src/context/app/app.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ export const DEFAULT_NEW_MIGRATION: INewMigration = {
372372
destination_stack: DEFAULT_DESTINATION_STACK,
373373
content_mapping: DEFAULT_CONTENT_MAPPER,
374374
test_migration: DEFAULT_TEST_MIGRATION,
375-
isprojectMapped: false,
375+
isprojectMapped: true,
376376
stackDetails: DEFAULT_DROPDOWN,
377377
testStacks: [],
378378
migration_execution: DEFAULT_MIGRATION_EXECUTION_STEP,

ui/src/pages/Migration/index.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ const Migration = () => {
9191

9292

9393
const saveRef = useRef<ContentTypeSaveHandles>(null);
94+
const newMigrationDataRef = useRef(newMigrationData);
9495

9596
useEffect(() => {
9697
fetchData();
@@ -99,14 +100,14 @@ const Migration = () => {
99100
/**
100101
* Dispatches the isprojectMapped key to redux
101102
*/
102-
useEffect(()=> {
103-
dispatch(updateNewMigrationData({
104-
...newMigrationData,
105-
isprojectMapped: isProjectMapper
103+
// useEffect(()=> {
104+
// dispatch(updateNewMigrationData({
105+
// ...newMigrationDataRef?.current,
106+
// isprojectMapped: isProjectMapper
106107

107-
}));
108+
// }));
108109

109-
},[isProjectMapper]);
110+
// },[isProjectMapper]);
110111

111112

112113
useBlockNavigation(isModalOpen);
@@ -238,11 +239,11 @@ const Migration = () => {
238239
const projectMapper = {
239240
...newMigrationData,
240241
legacy_cms: {
241-
...newMigrationData?.legacy_cms,
242+
...newMigrationDataRef?.current?.legacy_cms,
242243
selectedCms: selectedCmsData,
243-
selectedFileFormat: selectedFileFormatData,
244244
affix: projectData?.legacy_cms?.affix ,
245245
uploadedFile: {
246+
...newMigrationDataRef?.current?.legacy_cms,
246247
file_details: {
247248
localPath: projectData?.legacy_cms?.file_path,
248249
awsData: {
@@ -288,6 +289,7 @@ const Migration = () => {
288289
},
289290
stackDetails: projectData?.stackDetails,
290291
testStacks: projectData?.test_stacks,
292+
isprojectMapped: false,
291293
project_current_step: projectData?.current_step,
292294
};
293295

0 commit comments

Comments
 (0)