From 0a1024983d2829cbe174e26cd18bb6d08489ce73 Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Thu, 3 Aug 2023 10:04:05 +0300 Subject: [PATCH] Refactor Calendar component to update month details only when year or month changes --- web/src/components/Calendar.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/web/src/components/Calendar.jsx b/web/src/components/Calendar.jsx index faaf5544b..789237d76 100644 --- a/web/src/components/Calendar.jsx +++ b/web/src/components/Calendar.jsx @@ -101,10 +101,9 @@ const Calendar = ({ onChange, calendarRef, close, dateRange, children }) => { setState((prev) => ({ ...prev, selectedDay: todayTimestamp, - monthDetails: getMonthDetails(year, month), - timeRange: { ...dateRange }, + monthDetails: getMonthDetails(year, month) })); - }, [year, month, getMonthDetails, dateRange]); + }, [year, month, getMonthDetails]); useEffect(() => { // add refs for keyboard navigation