From 4ce01ca4f80e537f78ab53996e16b51b588c6a41 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Wed, 13 Sep 2023 12:37:58 +0530 Subject: [PATCH] fix: calendar issues display filters loop fix (#2167) --- .../core/views/calendar-view/calendar.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/web/components/core/views/calendar-view/calendar.tsx b/web/components/core/views/calendar-view/calendar.tsx index db7d7dc84..839aaba93 100644 --- a/web/components/core/views/calendar-view/calendar.tsx +++ b/web/components/core/views/calendar-view/calendar.tsx @@ -60,7 +60,7 @@ export const CalendarView: React.FC = ({ const router = useRouter(); const { workspaceSlug, projectId, cycleId, moduleId, viewId } = router.query; - const { calendarIssues, params, setDisplayFilters } = useCalendarIssuesView(); + const { calendarIssues, params, displayFilters, setDisplayFilters } = useCalendarIssuesView(); const totalDate = eachDayOfInterval({ start: calendarDates.startDate, @@ -160,12 +160,13 @@ export const CalendarView: React.FC = ({ }; useEffect(() => { - setDisplayFilters({ - calendar_date_range: `${renderDateFormat(startOfWeek(currentDate))};after,${renderDateFormat( - lastDayOfWeek(currentDate) - )};before`, - }); - }, [currentDate, setDisplayFilters]); + if (!displayFilters || displayFilters.calendar_date_range === "") + setDisplayFilters({ + calendar_date_range: `${renderDateFormat( + startOfWeek(currentDate) + )};after,${renderDateFormat(lastDayOfWeek(currentDate))};before`, + }); + }, [currentDate, displayFilters, setDisplayFilters]); const isNotAllowed = userAuth.isGuest || userAuth.isViewer || disableUserActions;