diff --git a/packages/appstore/src/components/account-transfer-modal/account-transfer-modal.tsx b/packages/appstore/src/components/account-transfer-modal/account-transfer-modal.tsx
index 5dd8a7c24f4a..bc5b0d1955c7 100644
--- a/packages/appstore/src/components/account-transfer-modal/account-transfer-modal.tsx
+++ b/packages/appstore/src/components/account-transfer-modal/account-transfer-modal.tsx
@@ -15,7 +15,7 @@ const AccountTransferModal = observer(({ is_modal_open, toggleModal }: TAccountT
const {
modules: {
cashier: {
- account_transfer: { is_transfer_confirm, should_switch_account },
+ account_transfer: { is_transfer_confirm, should_switch_account, setShouldSwitchAccount },
},
},
traders_hub: { closeModal, setSelectedAccount },
@@ -25,6 +25,7 @@ const AccountTransferModal = observer(({ is_modal_open, toggleModal }: TAccountT
React.useEffect(() => {
return () => {
+ setShouldSwitchAccount(false);
setSelectedAccount({});
closeModal();
};
diff --git a/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.scss b/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.scss
index d80ff88994c9..f157aa3755c4 100644
--- a/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.scss
+++ b/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.scss
@@ -207,6 +207,7 @@
}
.dc-modal__container_account_transfer {
&_switch_modal {
+ transition: none;
.dc-modal {
@include mobile() {
&-header__close {
diff --git a/packages/cashier/src/pages/account-transfer/account-transfer-receipt/__tests__/account-transfer-receipt.spec.tsx b/packages/cashier/src/pages/account-transfer/account-transfer-receipt/__tests__/account-transfer-receipt.spec.tsx
index 840558c2321c..db44c936df2f 100644
--- a/packages/cashier/src/pages/account-transfer/account-transfer-receipt/__tests__/account-transfer-receipt.spec.tsx
+++ b/packages/cashier/src/pages/account-transfer/account-transfer-receipt/__tests__/account-transfer-receipt.spec.tsx
@@ -23,6 +23,9 @@ describe('', () => {
common: {
is_from_derivgo: false,
},
+ traders_hub: {
+ closeAccountTransferModal: jest.fn(),
+ },
modules: {
cashier: {
account_transfer: {
diff --git a/packages/cashier/src/pages/account-transfer/account-transfer-receipt/account-transfer-receipt.tsx b/packages/cashier/src/pages/account-transfer/account-transfer-receipt/account-transfer-receipt.tsx
index 745cffe93011..255346fa58ae 100644
--- a/packages/cashier/src/pages/account-transfer/account-transfer-receipt/account-transfer-receipt.tsx
+++ b/packages/cashier/src/pages/account-transfer/account-transfer-receipt/account-transfer-receipt.tsx
@@ -15,14 +15,15 @@ type TSwitch = {
};
type TAccountTransferReceipt = RouteComponentProps & {
- onClose?: () => void;
+ onClose: () => void;
};
const AccountTransferReceipt = observer(({ onClose, history }: TAccountTransferReceipt) => {
- const { common, client } = useStore();
+ const { common, client, traders_hub } = useStore();
const { account_transfer } = useCashierStore();
const { is_from_derivgo } = common;
const { loginid, switchAccount } = client;
+ const { closeAccountTransferModal } = traders_hub;
const { receipt, resetAccountTransfer, selected_from, selected_to, setShouldSwitchAccount } = account_transfer;
const is_from_outside_cashier = !location.pathname.startsWith(routes.cashier);
@@ -33,6 +34,7 @@ const AccountTransferReceipt = observer(({ onClose, history }: TAccountTransferR
React.useEffect(() => {
return () => {
resetAccountTransfer();
+ closeAccountTransferModal();
};
}, [resetAccountTransfer]);
@@ -62,13 +64,10 @@ const AccountTransferReceipt = observer(({ onClose, history }: TAccountTransferR
} else {
// if the account transferred to is a Deriv MT5 account that can't be switched to, switch to from account instead
// otherwise switch to the account transferred to
- setShouldSwitchAccount();
+ setShouldSwitchAccount(true);
setSwitchTo(selected_to.is_mt ? selected_from : selected_to);
toggleSwitchAlert();
}
- // close modal only when the user try to transfer money from traders-hub, not from cashier
- // because in cashier this component is not a modal
- if (is_from_outside_cashier) onClose?.();
};
return (
@@ -156,7 +155,16 @@ const AccountTransferReceipt = observer(({ onClose, history }: TAccountTransferR
/>
-
+