Skip to content

Commit eaae9e0

Browse files
committed
fix:populating master_locale on stack selection and deselection
1 parent 83b4479 commit eaae9e0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,22 @@ const LoadStacks = (props: LoadFileFormatProps) => {
8484
const [isError, setIsError] = useState<boolean>(false);
8585
const [errorMessage, setErrorMessage] = useState<string>('');
8686
const [placeholder] = useState<string>('Select a stack');
87+
const [localePlaceholder, setlocalePlaceholder ] = useState<string>('Master Locale will be set after stack selection');
8788
const newMigrationDataRef = useRef(newMigrationData);
8889

8990
useEffect(() => {
9091
newMigrationDataRef.current = newMigrationData;
9192
}, [newMigrationData]);
9293

94+
useEffect(()=>{
95+
if(selectedStack?.value !== undefined && selectedStack?.master_locale){
96+
setlocalePlaceholder('')
97+
}
98+
else{
99+
setlocalePlaceholder('Master Locale will be set after stack selection');
100+
}
101+
},[selectedStack])
102+
93103
useEffect(() => {
94104
if (!isEmptyString(newMigrationData?.destination_stack?.selectedStack?.value)) {
95105
setSelectedStack(newMigrationData?.destination_stack?.selectedStack);
@@ -336,12 +346,8 @@ const LoadStacks = (props: LoadFileFormatProps) => {
336346
id="master_locale"
337347
aria-label="master_locale"
338348
version={'v2'}
339-
placeholder={
340-
selectedStack?.master_locale
341-
? ''
342-
: 'Master Locale will be set after stack selection'
343-
}
344-
value={selectedStack?.master_locale}
349+
placeholder={localePlaceholder}
350+
value={selectedStack?.value !== undefined ? selectedStack?.master_locale : ''}
345351
width="600px"
346352
className="orgInput"
347353
isReadOnly

0 commit comments

Comments
 (0)