diff --git a/web/src/components/common/components/calendar/calendar.tsx b/web/src/components/common/components/calendar/calendar.tsx index f1aa4ee..461879c 100644 --- a/web/src/components/common/components/calendar/calendar.tsx +++ b/web/src/components/common/components/calendar/calendar.tsx @@ -32,9 +32,14 @@ const Calendar: React.FC> = ({ calendarUrl }) => { setIncludePast(value) } + // Function added to verify based on the local storage if the full calendar should be loaded or not + const shouldIncludePast = () => { + return window.localStorage.getItem("includePast") !== "false" + } + // Triggers on page load to update the includePast variable to the value last set by the user useEffect(() => { - setIncludePast(window.localStorage.getItem("includePast") === "true") + setIncludePast(shouldIncludePast) }, []); /** @@ -60,7 +65,7 @@ const Calendar: React.FC> = ({ calendarUrl }) => { setEvents(events); }; - getCalendarInfo(includePast); + getCalendarInfo(shouldIncludePast()); }, [calendarUrl, includePast]); /**