Skip to content

Commit

Permalink
fix: course[sem] is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJustChew committed Aug 5, 2024
1 parent 0e0d558 commit 49f2e1a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hooks/contexts/useUserTimetable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const useUserTimetableProvider = (loadCourse = true) => {
const [courses, setCourses] = useSyncedStorage<CourseLocalStorage>("courses", {});
const [colorMap, setColorMap] = useSyncedStorage<{ [courseID: string]: string }>("course_color_map", {}); //map from courseID to color
const [timetableTheme, _setTimetableTheme] = useSyncedStorage<string>("timetable_theme", "pastelColors");
const [userDefinedColors, setUserDefinedColors] = useLocalStorage<{ [theme_name: string]: string[] }>("user_defined_colors", {});
const [userDefinedColors, setUserDefinedColors] = useSyncedStorage<{ [theme_name: string]: string[] }>("user_defined_colors", {});
const [preferences, setPreferences] = useSyncedStorage<TimetableDisplayPreferences>("timetable_display_preferences", {
language: 'app',
align: 'center',
Expand All @@ -87,7 +87,7 @@ const useUserTimetableProvider = (loadCourse = true) => {
const newColorMap: { [courseID: string]: string } = {};

Object.keys(courses).forEach(sem => {
courses[sem].forEach((courseID, i) => {
(courses[sem] ?? []).forEach((courseID, i) => {
newColorMap[courseID] = newColors[i % newColors.length];
});
});
Expand Down Expand Up @@ -284,7 +284,7 @@ const useUserTimetableProvider = (loadCourse = true) => {
return {
getSemesterCourses,
colorMap,
semester,
semester,
timetableTheme,
currentColors,
userDefinedColors,
Expand Down

0 comments on commit 49f2e1a

Please sign in to comment.