Skip to content

Commit

Permalink
Fixed Custom Events Loading Onto Map (#855)
Browse files Browse the repository at this point in the history
  • Loading branch information
adcockdalton authored Jan 24, 2024
1 parent 08a9bdc commit 3bd7386
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions apps/antalmanac/src/components/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,21 @@ export default function CourseMap() {
const [calendarEvents, setCalendarEvents] = useState(AppStore.getCourseEventsInCalendar());

useEffect(() => {
const updateMarkers = () => {
const updateAllMarkers = () => {
setMarkers(getCoursesPerBuilding());
setCustomEventMarkers(getCustomEventPerBuilding());
};

AppStore.on('addedCoursesChange', updateMarkers);
AppStore.on('currentScheduleIndexChange', updateMarkers);
AppStore.on('colorChange', updateMarkers);
AppStore.on('addedCoursesChange', updateAllMarkers);
AppStore.on('customEventsChange', updateAllMarkers);
AppStore.on('currentScheduleIndexChange', updateAllMarkers);
AppStore.on('colorChange', updateAllMarkers);

return () => {
AppStore.removeListener('addedCoursesChange', updateMarkers);
AppStore.removeListener('currentScheduleIndexChange', updateMarkers);
AppStore.removeListener('colorChange', updateMarkers);
AppStore.removeListener('addedCoursesChange', updateAllMarkers);
AppStore.removeListener('customEventsChange', updateAllMarkers);
AppStore.removeListener('currentScheduleIndexChange', updateAllMarkers);
AppStore.removeListener('colorChange', updateAllMarkers);
};
}, []);

Expand Down

0 comments on commit 3bd7386

Please sign in to comment.