Skip to content

Commit

Permalink
Revert "Akmal / feat: remove unnecessary API calls while loading chart (
Browse files Browse the repository at this point in the history
#7814)"

This reverts commit 2e54d5e.
  • Loading branch information
maryia-deriv committed Jul 6, 2023
1 parent 3a8dab9 commit a0c5268
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
1 change: 1 addition & 0 deletions packages/core/src/Stores/contract-replay-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ 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, validation_error } = contract_info;
const { profit, underlying: symbol } = 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 validation_error={validation_error} />
<MarketClosedContractOverlay symbol={symbol} />
</div>
)}
{contract_el}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
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 = ({ 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>
);
const MarketClosedContractOverlay = ({ symbol }) => {
const [is_timer_loading, setIsTimerLoading] = React.useState(true);

return (
<div
className={classNames('contract-card__market-closed', {
'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>
);
};

MarketClosedContractOverlay.propTypes = {
symbol: PropTypes.string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,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={false}
shouldFetchTradingTimes={!end_epoch}
yAxisMargin={getChartYAxisMargin()}
anchorChartToLeft={isMobile()}
shouldFetchTickHistory={
Expand Down

0 comments on commit a0c5268

Please sign in to comment.