fix(ui): main popup now shows 0 for empty schedule (#395)

This commit is contained in:
Rishthegreat
2024-10-27 17:11:51 -05:00
committed by GitHub
parent 2d0804f90e
commit 8de88d6ad7
2 changed files with 3 additions and 7 deletions

View File

@@ -59,15 +59,11 @@ messageListener.listen();
UserScheduleStore.listen('schedules', async schedules => {
const index = await UserScheduleStore.get('activeIndex');
const numCourses = schedules.newValue[index]?.courses?.length;
if (!numCourses) return;
updateBadgeText(numCourses);
updateBadgeText(numCourses || 0);
});
UserScheduleStore.listen('activeIndex', async ({ newValue }) => {
const schedules = await UserScheduleStore.get('schedules');
const numCourses = schedules[newValue]?.courses?.length;
if (!numCourses) return;
updateBadgeText(numCourses);
updateBadgeText(numCourses || 0);
});