@@ -84,13 +84,14 @@ const Migration = () => {
8484 const [ isLoading , setIsLoading ] = useState ( false ) ;
8585 const [ currentStepIndex , setCurrentStepIndex ] = useState ( 0 ) ;
8686 const [ isCompleted , setIsCompleted ] = useState < boolean > ( false ) ;
87- const [ isProjectMapper , setIsProjectMapper ] = useState < boolean > ( false ) ;
87+ const [ isProjectMapper , setIsProjectMapper ] = useState < boolean > ( true ) ;
8888
8989 const [ disableMigration , setDisableMigration ] = useState ( false ) ;
9090 const [ isModalOpen , setIsModalOpen ] = useState ( false ) ;
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 ) ;
@@ -182,15 +183,14 @@ const Migration = () => {
182183 */
183184 const fetchProjectData = async ( ) => {
184185 if ( isEmptyString ( selectedOrganisation ?. value ) || isEmptyString ( params ?. projectId ) ) return ;
185-
186+ setIsProjectMapper ( true ) ;
186187 const data = await getMigrationData ( selectedOrganisation ?. value , params ?. projectId ?? '' ) ;
187188 const migratedstacks = await getMigratedStacks ( selectedOrganisation ?. value , projectId ) ;
188189
189190 if ( data ) {
190191 setIsLoading ( false ) ;
191192 setProjectData ( data ?. data ) ;
192193 }
193- setIsProjectMapper ( true ) ;
194194 const projectData = data ?. data ;
195195
196196 const legacyCmsData :ILegacyCMSComponent = await getCMSDataFromFile ( CS_ENTRIES . LEGACY_CMS ) ;
@@ -239,11 +239,11 @@ const Migration = () => {
239239 const projectMapper = {
240240 ...newMigrationData ,
241241 legacy_cms : {
242- ...newMigrationData ?. legacy_cms ,
242+ ...newMigrationDataRef ?. current ?. legacy_cms ,
243243 selectedCms : selectedCmsData ,
244- selectedFileFormat : selectedFileFormatData ,
245244 affix : projectData ?. legacy_cms ?. affix ,
246245 uploadedFile : {
246+ ...newMigrationDataRef ?. current ?. legacy_cms ,
247247 file_details : {
248248 localPath : projectData ?. legacy_cms ?. file_path ,
249249 awsData : {
@@ -289,6 +289,7 @@ const Migration = () => {
289289 } ,
290290 stackDetails : projectData ?. stackDetails ,
291291 testStacks : projectData ?. test_stacks ,
292+ isprojectMapped : false ,
292293 project_current_step : projectData ?. current_step ,
293294 } ;
294295
@@ -502,7 +503,7 @@ const Migration = () => {
502503 } else if ( ! hasNonEmptyMapping ) {
503504 setIsLoading ( false ) ;
504505 Notification ( {
505- notificationContent : { text : 'Please complete the language mapping to preceed futher' } ,
506+ notificationContent : { text : 'Please complete the language mapping to proceed futher' } ,
506507 type : 'warning'
507508 } ) ;
508509 }
0 commit comments