Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
noahlitvin committed Feb 5, 2025
1 parent fd7b121 commit b30c778
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/app/src/components/AdvancedView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const AdvancedView = ({
{chartType !== ChartType.LIQUIDITY && (
<WindowSelector
selectedWindow={selectedWindow}
setSelectedWindow={setSelectedWindow ?? TimeWindow.FD}
setSelectedWindow={setSelectedWindow}
/>
)}
{chartType === ChartType.PRICE && (
Expand Down
15 changes: 15 additions & 0 deletions packages/app/src/lib/hooks/useChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,21 @@ export const useChart = ({
updateResourcePriceData();
updateTrailingAverageData();
updateSeriesVisibility();

// Set initial time range if not already set
if (!hasSetTimeScale.current && marketPrices?.length) {
const timeRange = selectedWindow
? getTimeRangeFromWindow(selectedWindow)
: 86400;
const now = Math.floor(Date.now() / 1000);
const from = now - timeRange;

chartRef.current.timeScale().setVisibleRange({
from: from as UTCTimestamp,
to: now as UTCTimestamp,
});
hasSetTimeScale.current = true;
}
}, [
stEthPerToken,
useMarketUnits,
Expand Down

0 comments on commit b30c778

Please sign in to comment.