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

Commit 71112a8

Browse files
hubert-derivHubert Koster
andauthored
Hubert / Have to refresh MT5 dashboard twice when a server is down, to see dashboard again. (#6657)
* awaiting variable change, so that double refresh is not needed. * account defaults to different one when server is unavailable * refactoring code * changing position of await Co-authored-by: Hubert Koster <hubertkoster@Huberts-MacBook-Pro.local>
1 parent 8897d34 commit 71112a8

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/javascript/app/pages/user/metatrader/metatrader.ui.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,17 @@ const MetaTraderUI = (() => {
338338
$container.find('#account_desc').html($el_to_clone.clone());
339339
};
340340

341-
const setCurrentAccount = (acc_type) => {
342-
if (Client.get('mt5_account') && Client.get('mt5_account') !== acc_type) return;
341+
const setCurrentAccount = async (account_type) => {
342+
let acc_type = await account_type;
343+
const current_account = await Client.get('mt5_account');
344+
345+
if (current_account && current_account !== acc_type) return;
346+
347+
if (current_account === 'real_unknown') {
348+
const default_to_other = Object.keys(accounts_info).find(account => getAccountsInfo(account).info);
349+
acc_type = default_to_other;
350+
$detail.find('.acc-info').setVisibility(1);
351+
}
343352

344353
if (current_action_ui !== 'new_account') {
345354
displayAccountDescription(acc_type);
@@ -362,7 +371,7 @@ const MetaTraderUI = (() => {
362371
broker : () => 'Deriv Limited',
363372
display_login: () => (`${info} (${is_demo ? localize('Demo Account') : localize('Real-Money Account')})`),
364373
leverage : () => `1:${info}`,
365-
server : () => `${server_info && server_info.environment}`,
374+
server : () => `${server_info === undefined ? 'Unavailable' : server_info && server_info.environment}`,
366375
...(
367376
is_synthetic &&
368377
server_info.geolocation.region &&

0 commit comments

Comments
 (0)