Skip to content

Commit

Permalink
thisyahlen/chore: remove selected jurisdiction whenever modal is clos…
Browse files Browse the repository at this point in the history
…ed (deriv-com#14193)

* chore: remove selected jurisdiction whenever modal is closed

* chore: komen
  • Loading branch information
thisyahlen-deriv authored Mar 15, 2024
1 parent a6a23a8 commit 0ea8d71
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const JurisdictionScreen = ({ setIsCheckBoxChecked }: TJurisdictionScreenProps)
[marketType, mt5AccountsList]
);

useEffect(() => {
return () => setCfdState({ selectedJurisdiction: '' });
}, [setCfdState, setIsCheckBoxChecked]);

useEffect(() => {
setIsCheckBoxChecked(false);
}, [selectedJurisdiction, setIsCheckBoxChecked]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import useRegulationFlags from '../../../../hooks/useRegulationFlags';
import { MarketTypeDetails } from '../../constants';
import React, { useEffect } from 'react';
import { useRegulationFlags } from '@/hooks';
import { MarketTypeDetails } from '@cfd/constants';
import { MT5AccountTypeCard } from '../MT5AccountTypeCard';

type TMT5AccountTypeProps = {
onMarketTypeSelect: (marketType: keyof typeof MarketTypeDetails) => void;
onMarketTypeSelect: (marketType?: keyof typeof MarketTypeDetails) => void;
selectedMarketType?: keyof typeof MarketTypeDetails;
};

Expand All @@ -16,6 +16,10 @@ const MT5AccountType = ({ onMarketTypeSelect, selectedMarketType }: TMT5AccountT
return order.indexOf(keyA) - order.indexOf(keyB);
});

useEffect(() => {
return () => onMarketTypeSelect(undefined);
}, [onMarketTypeSelect]);

return (
<div className='flex items-center flex-shrink-0 bg-system-light-primary-background rounded-xl h-[70vh] w-[80vw] justify-center p-24 flex-1 gap-24'>
{sortedMarketTypeEntries.map(([key, value]) => (
Expand Down

0 comments on commit 0ea8d71

Please sign in to comment.