Skip to content

Commit

Permalink
[DTRA] henry/dtra-1708/fix: resolve console errors in dtrader v2 (#16666
Browse files Browse the repository at this point in the history
)

* fix: resolve console errors in dtrader v2

* fix: resolve comment
  • Loading branch information
henry-deriv committed Aug 29, 2024
1 parent af088c6 commit 55b27b6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/trader/src/AppV2/Components/Guide/guide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Guide = observer(({ has_label, show_guide_for_selected_contract }: TGuide)
ui: { is_dark_mode_on },
} = useStore();
const { contract_type, is_vanilla } = useTraderStore();
const contract_type_title = is_vanilla ? CONTRACT_LIST.VANILLAS : getContractTypesConfig()[contract_type].title;
const contract_type_title = is_vanilla ? CONTRACT_LIST.VANILLAS : getContractTypesConfig()[contract_type]?.title;

const [is_description_opened, setIsDescriptionOpened] = React.useState(false);
const [selected_contract_type, setSelectedContractType] = React.useState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ const Stake = observer(({ is_minimized }: TStakeProps) => {
const is_loading_proposal = !id_1 || (!!contract_types[1] && !id_2);
const proposal_error_message_1 = has_error_1 ? message_1 : '';
const proposal_error_message_2 = has_error_2 ? message_2 : '';
const proposal_error_message = proposal_error_message_1 || proposal_error_message_2 || validation_errors?.amount[0];
const proposal_error_message =
proposal_error_message_1 || proposal_error_message_2 || validation_errors?.amount?.[0];
/* TODO: stop using Max payout from error text as a default max payout and stop using error text for is_max_payout_exceeded after validation_params are added to proposal API (both success & error response):
E.g., for is_max_payout_exceeded, we have to temporarily check the error text: Max payout error always contains 3 numbers, the check will work for any languages: */
const float_number_search_regex = /\d+(\.\d+)?/g;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type TTradeParametersProps = {
const TradeParameters = observer(({ is_minimized }: TTradeParametersProps) => {
const { contract_type, symbol } = useTraderStore();
const isVisible = (component_key: string) => {
const params = getTradeParams(symbol)[contract_type];
const params = getTradeParams(symbol)?.[contract_type] ?? {};
return component_key in params;
};

Expand Down

0 comments on commit 55b27b6

Please sign in to comment.