Skip to content

Commit e7316ba

Browse files
committed
refactor:resolved language mapper bugs
1 parent d65df99 commit e7316ba

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ const Mapper = ({
163163
setSelectedMappings(updatedSelectedMappings);
164164

165165
}
166+
else if(!isLabelMismatch && !isStackChanged){
167+
updatedSelectedMappings = {
168+
[`${locale?.label}-master_locale`]: updatedSelectedMappings?.[`${locale?.label}-master_locale`] ? updatedSelectedMappings?.[`${locale?.label}-master_locale`]: '',
169+
};
170+
setSelectedMappings(updatedSelectedMappings);
171+
}
166172
}
167173
})
168174

@@ -513,7 +519,7 @@ const LanguageMapper = ({stack, uid} :{ stack : IDropDown, uid : string}) => {
513519
const [options, setoptions] = useState<{ label: string; value: string }[]>([]);
514520
const [cmsLocaleOptions, setcmsLocaleOptions] = useState<{ label: string; value: string }[]>([]);
515521
const [sourceLocales, setsourceLocales] = useState<{ label: string; value: string }[]>([]);
516-
const [isLoading, setisLoading] = useState<boolean>(false);
522+
const [isLoading, setisLoading] = useState<boolean>(true);
517523
const [currentStack, setCurrentStack] = useState<IDropDown>(stack);
518524
const [previousStack, setPreviousStack] = useState<IDropDown>();
519525
const [isStackChanged, setisStackChanged] = useState<boolean>(false);
@@ -618,6 +624,7 @@ const LanguageMapper = ({stack, uid} :{ stack : IDropDown, uid : string}) => {
618624
// return await getStackLocales(newMigrationData?.destination_stack?.selectedOrg?.value);
619625
// };
620626
const addRowComp = () => {
627+
setisStackChanged(false);
621628
setcmsLocaleOptions((prevList: { label: string; value: string }[]) => [
622629
...prevList, // Keep existing elements
623630
{
@@ -628,6 +635,7 @@ const LanguageMapper = ({stack, uid} :{ stack : IDropDown, uid : string}) => {
628635
};
629636

630637
const handleDeleteLocale = (id: number, locale: { label: string; value: string }) => {
638+
setisStackChanged(false);
631639
setcmsLocaleOptions((prevList) => {
632640
return prevList?.filter(
633641
(item: { label: string; value: string }) => item?.label !== locale?.label

ui/src/pages/Login/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FC, useEffect, useState } from 'react';
33
import { useNavigate, useLocation } from 'react-router-dom';
44
import { useDispatch, useSelector } from 'react-redux';
55

6-
import { getUserDetails, setAuthToken, setUser, clearOrganisationData } from '../../store/slice/authSlice';
6+
import { clearOrganisationData, getUserDetails, setAuthToken, setUser } from '../../store/slice/authSlice';
77
import {
88
Button,
99
Field,

0 commit comments

Comments
 (0)