diff --git a/lib/views/components/filter_popup_menu_button.dart b/lib/views/components/filter_popup_menu_button.dart index 7e22ce1..8931099 100644 --- a/lib/views/components/filter_popup_menu_button.dart +++ b/lib/views/components/filter_popup_menu_button.dart @@ -21,9 +21,6 @@ class FilterPopupMenuButton extends ConsumerWidget { return PopupMenuButton( onSelected: (choice) { - // When an item is selected, update both providers to ensure they stay in sync - ref.read(userViewModelProvider.notifier).setSelectedSemester(choice); - ref.read(pinnedCourseViewModelProvider.notifier).setSelectedSemester(choice); onClick(choice); }, itemBuilder: (BuildContext context) { diff --git a/lib/views/course_view/list_courses_view/my_courses_view.dart b/lib/views/course_view/list_courses_view/my_courses_view.dart index 933fcc6..01b77c1 100644 --- a/lib/views/course_view/list_courses_view/my_courses_view.dart +++ b/lib/views/course_view/list_courses_view/my_courses_view.dart @@ -40,6 +40,9 @@ class MyCoursesState extends ConsumerState { void filterCoursesBySemester(String selectedSemester) { var allUserCourses = ref.watch(userViewModelProvider).userCourses ?? []; + ref + .read(pinnedCourseViewModelProvider.notifier) + .setSelectedSemester(selectedSemester); ref .read(userViewModelProvider.notifier) .updateSelectedSemester(selectedSemester, allUserCourses); diff --git a/lib/views/course_view/list_courses_view/public_courses_view.dart b/lib/views/course_view/list_courses_view/public_courses_view.dart index 7139b46..a636cb5 100644 --- a/lib/views/course_view/list_courses_view/public_courses_view.dart +++ b/lib/views/course_view/list_courses_view/public_courses_view.dart @@ -41,6 +41,9 @@ class PublicCoursesState extends ConsumerState { void filterCoursesBySemester(String selectedSemester) { var allUserCourses = ref.watch(userViewModelProvider).publicCourses ?? []; + ref + .read(pinnedCourseViewModelProvider.notifier) + .setSelectedSemester(selectedSemester); ref .read(userViewModelProvider.notifier) .updateSelectedSemester(selectedSemester, allUserCourses); diff --git a/lib/views/course_view/pinned_courses_view/pinned_courses_view.dart b/lib/views/course_view/pinned_courses_view/pinned_courses_view.dart index 5f3cc0a..1b73f3e 100644 --- a/lib/views/course_view/pinned_courses_view/pinned_courses_view.dart +++ b/lib/views/course_view/pinned_courses_view/pinned_courses_view.dart @@ -42,6 +42,9 @@ class PinnedCoursesState extends ConsumerState { } void filterCoursesBySemester(String selectedSemester) { + ref + .read(userViewModelProvider.notifier) + .setSelectedSemester(selectedSemester); var userPinned = ref.watch(pinnedCourseViewModelProvider).userPinned ?? []; ref .read(pinnedCourseViewModelProvider.notifier)