Skip to content

Commit

Permalink
Fix the calendar not displaying the specified amount of data dependin…
Browse files Browse the repository at this point in the history
…g on the includePast variable
  • Loading branch information
WinterWolfSV committed Sep 20, 2024
1 parent 17c6015 commit 1f67537
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions web/src/components/common/components/calendar/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ const Calendar: React.FC<Content<'content.calendar'>> = ({ 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)
}, []);

/**
Expand All @@ -60,7 +65,7 @@ const Calendar: React.FC<Content<'content.calendar'>> = ({ calendarUrl }) => {
setEvents(events);
};

getCalendarInfo(includePast);
getCalendarInfo(shouldIncludePast());
}, [calendarUrl, includePast]);

/**
Expand Down

0 comments on commit 1f67537

Please sign in to comment.