Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Hubert / Have to refresh MT5 dashboard twice when a server is down, to see dashboard again. #6657

Merged
merged 11 commits into from
Jul 13, 2021
Merged
15 changes: 12 additions & 3 deletions src/javascript/app/pages/user/metatrader/metatrader.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,17 @@ const MetaTraderUI = (() => {
$container.find('#account_desc').html($el_to_clone.clone());
};

const setCurrentAccount = (acc_type) => {
if (Client.get('mt5_account') && Client.get('mt5_account') !== acc_type) return;
const setCurrentAccount = async (account_type) => {
let acc_type = await account_type;
const current_account = await Client.get('mt5_account');

if (current_account && current_account !== acc_type) return;

if (current_account === 'real_unknown') {
const default_to_other = Object.keys(accounts_info).find(account => getAccountsInfo(account).info);
acc_type = default_to_other;
$detail.find('.acc-info').setVisibility(1);
}

if (current_action_ui !== 'new_account') {
displayAccountDescription(acc_type);
Expand All @@ -362,7 +371,7 @@ const MetaTraderUI = (() => {
broker : () => 'Deriv Limited',
display_login: () => (`${info} (${is_demo ? localize('Demo Account') : localize('Real-Money Account')})`),
leverage : () => `1:${info}`,
server : () => `${server_info && server_info.environment}`,
server : () => `${server_info === undefined ? 'Unavailable' : server_info && server_info.environment}`,
...(
is_synthetic &&
server_info.geolocation.region &&
Expand Down