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

Akmal / feat: remove unnecessary API calls while loading chart #7814

Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion packages/core/src/Stores/contract-replay-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export default class ContractReplayStore extends BaseStore {
this.contract_id = contract_id;
this.contract_store = new ContractStore(this.root_store, { contract_id });
this.subscribeProposalOpenContract();
WS.storage.activeSymbols('brief');
WS.setOnReconnect(() => {
if (!this.root_store.client.is_switching) {
this.subscribeProposalOpenContract();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const ContractDrawerCard = observer(
const { getContractById } = contract_trade;
const [hover_ref, should_hide_closed_overlay] = useHover();

const { profit, underlying: symbol } = contract_info;
const { profit, validation_error } = contract_info;
const is_sold = !!getEndTime(contract_info);
const display_name = getSymbolDisplayName(
active_symbols,
Expand Down Expand Up @@ -135,7 +135,7 @@ const ContractDrawerCard = observer(
'contract-card__market-closed--hidden': isDesktop() && should_hide_closed_overlay,
})}
>
<MarketClosedContractOverlay symbol={symbol} />
<MarketClosedContractOverlay validation_error={validation_error} />
</div>
)}
{contract_el}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,14 @@
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import { Text } from '@deriv/components';
import { Localize } from '@deriv/translations';
// eslint-disable-next-line import/no-useless-path-segments
import MarketCountdownTimer from '../market-countdown-timer.jsx';

const MarketClosedContractOverlay = ({ symbol }) => {
const [is_timer_loading, setIsTimerLoading] = React.useState(true);

return (
<div
className={classNames('contract-card__market-closed', {
akmal-deriv marked this conversation as resolved.
Show resolved Hide resolved
'contract-card__market-closed--loading': is_timer_loading,
})}
>
<Text
align='center'
as='p'
className='contract-card__market-closed__title'
styles={{ color: 'var(--brand-orange)' }}
weight='bold'
>
<Localize i18n_default_text='Market is closed' />
</Text>
<MarketCountdownTimer setIsTimerLoading={setIsTimerLoading} symbol={symbol} />
</div>
);
};
const MarketClosedContractOverlay = ({ validation_error }) => (
<div className='contract-card__market-closed'>
<Text align='center' as='p' className='contract-card__market-closed__title' weight='bold'>
{validation_error}
</Text>
</div>
);

MarketClosedContractOverlay.propTypes = {
symbol: PropTypes.string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ const ReplayChart = observer(({ is_accumulator_contract }) => {
// forcing chart reload when start_epoch changes to an earlier epoch for ACCU closed contract:
is_accumulator_contract && end_epoch && start_epoch < prev_start_epoch
}
shouldFetchTradingTimes={!end_epoch}
shouldFetchTradingTimes={false}
yAxisMargin={getChartYAxisMargin()}
anchorChartToLeft={isMobile()}
shouldFetchTickHistory={
Expand Down