From 2bae7dc200d9160ac8ba33ceb7454b0670f37351 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Tue, 19 Jul 2022 02:54:05 -0700 Subject: [PATCH] Fix error on no portfolio history --- .../portfolio/portfolio-value-section.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/web/components/portfolio/portfolio-value-section.tsx b/web/components/portfolio/portfolio-value-section.tsx index 1fabbd06..fa50365b 100644 --- a/web/components/portfolio/portfolio-value-section.tsx +++ b/web/components/portfolio/portfolio-value-section.tsx @@ -15,17 +15,17 @@ export const PortfolioValueSection = memo( const lastPortfolioMetrics = last(portfolioHistory) const [portfolioPeriod, setPortfolioPeriod] = useState('allTime') - // PATCH: If portfolio history started on June 1st, then we label it as "Since June" - // instead of "All time" - const allTimeLabel = - portfolioHistory[0].timestamp < Date.parse('2022-06-20T00:00:00.000Z') - ? 'Since June' - : 'All time' - if (portfolioHistory.length === 0 || !lastPortfolioMetrics) { return <> } + // PATCH: If portfolio history started on June 1st, then we label it as "Since June" + // instead of "All time" + const allTimeLabel = + lastPortfolioMetrics.timestamp < Date.parse('2022-06-20T00:00:00.000Z') + ? 'Since June' + : 'All time' + return (