Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DTRA] henry/dtra-1645/remove-extra-and-invalid-contractsfor-calls-trader-v2 #16506

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions packages/trader/src/AppV2/Hooks/useActiveSymbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
isTurbosContract,
isVanillaContract,
pickDefaultSymbol,
setTradeURLParams,
} from '@deriv/shared';
import { useStore } from '@deriv/stores';
import { localize } from '@deriv/translations';
Expand Down Expand Up @@ -82,10 +83,8 @@ const useActiveSymbols = () => {
setActiveSymbols(active_symbols);
setActiveSymbolsV2(active_symbols);
default_symbol_ref.current = symbol || (await pickDefaultSymbol(active_symbols)) || '1HZ100V';

if (symbol !== default_symbol_ref.current) {
onChange({ target: { name: 'symbol', value: default_symbol_ref.current } });
}
onChange({ target: { name: 'symbol', value: default_symbol_ref.current } });
setTradeURLParams({ symbol: default_symbol_ref.current, contractType: contract_type });
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
12 changes: 7 additions & 5 deletions packages/trader/src/Stores/Modules/Trading/trade-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,12 +685,15 @@ export default class TradeStore extends BaseStore {
};

async loadActiveSymbols(should_set_default_symbol = true, should_show_loading = true) {
if (this.is_dtrader_v2_enabled) {
await when(() => this.has_symbols_for_v2);
henry-deriv marked this conversation as resolved.
Show resolved Hide resolved
return;
}

this.should_show_active_symbols_loading = should_show_loading;

if (!this.is_dtrader_v2_enabled) {
await this.setActiveSymbols();
await this.root_store.active_symbols.setActiveSymbols();
}
await this.setActiveSymbols();
await this.root_store.active_symbols.setActiveSymbols();

const { symbol, showModal } = getTradeURLParams({ active_symbols: this.active_symbols });
if (showModal && should_show_loading && !this.root_store.client.is_logging_in) {
Expand Down Expand Up @@ -1860,7 +1863,6 @@ export default class TradeStore extends BaseStore {
});
}
if ('active_symbols' in req) {
if (this.is_dtrader_v2_enabled) return;
if (this.root_store.client.is_logged_in) {
return WS.authorized.activeSymbols('brief');
}
Expand Down
Loading