Skip to content

Commit

Permalink
[TRAH] Sergei / TRAH - 3858 / Blank screen shown for accounts with no…
Browse files Browse the repository at this point in the history
… currency (deriv-com#16472)

* feat: add check for currency

* fix: add check for optional function from props
  • Loading branch information
sergei-deriv authored Sep 16, 2024
1 parent 451bc1b commit 099d968
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type TCurrencySelectorExtend = {
has_wallet_account: boolean;
is_virtual: boolean;
onCancel: (current_step: number, goToPreviousStep: () => void) => void;
onSave: (current_step: number, values: TCurrencySelectorFormProps) => void;
onSave?: (current_step: number, values: TCurrencySelectorFormProps) => void;
onSubmit: (
current_step: number | null,
values: TCurrencySelectorFormProps,
Expand Down Expand Up @@ -105,13 +105,13 @@ const CurrencySelector = observer(

const handleCancel = (values: TCurrencySelectorFormProps) => {
const current_step = getCurrentStep() - 1;
onSave(current_step, values);
onSave?.(current_step, values);
onCancel(current_step, goToPreviousStep);
};

const handleValidate = (values: TCurrencySelectorFormProps) => {
const current_step = (getCurrentStep?.() || 1) - 1;
onSave(current_step, values);
onSave?.(current_step, values);

const { errors } = splitValidationResultTypes(validate(values));
return errors;
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/Services/socket-general.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ const BinarySocketGeneral = (() => {

const subscribeBalances = () => {
WS.subscribeBalanceAll(ResponseHandlers.balanceOtherAccounts);
WS.subscribeBalanceActiveAccount(ResponseHandlers.balanceActiveAccount, client_store.loginid);
if (client_store.currency)
WS.subscribeBalanceActiveAccount(ResponseHandlers.balanceActiveAccount, client_store.loginid);
};

const authorizeAccount = response => {
Expand Down

0 comments on commit 099d968

Please sign in to comment.