From 52666b3013c124ce383b8ed7e0d826b2d1cc034d Mon Sep 17 00:00:00 2001 From: Chris Walsh Date: Sat, 4 Dec 2021 02:01:57 -0800 Subject: [PATCH] Pass required props to refresh button and chart --- components/common/RefreshButton.js | 3 ++- components/metrics/WebsiteChart.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/common/RefreshButton.js b/components/common/RefreshButton.js index 91a43ab8..343fa174 100644 --- a/components/common/RefreshButton.js +++ b/components/common/RefreshButton.js @@ -16,11 +16,12 @@ function RefreshButton({ websiteId }) { const [dateRange] = useDateRange(websiteId); const [loading, setLoading] = useState(false); const completed = useSelector(state => state.queries[`/api/website/${websiteId}/stats`]); + const createdAt = useSelector(state => state.websites[websiteId]?.createdAt); function handleClick() { if (dateRange) { setLoading(true); - dispatch(setDateRange(websiteId, getDateRange(dateRange.value, locale))); + dispatch(setDateRange(websiteId, getDateRange(dateRange.value, locale, createdAt))); } } diff --git a/components/metrics/WebsiteChart.js b/components/metrics/WebsiteChart.js index dea86ae6..242913a8 100644 --- a/components/metrics/WebsiteChart.js +++ b/components/metrics/WebsiteChart.js @@ -85,6 +85,7 @@ export default function WebsiteChart({ startDate={startDate} endDate={endDate} onChange={setDateRange} + websiteId={websiteId} />