From 3507b29d706a49d93cac6510dc95797565916495 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Wed, 13 Nov 2024 16:17:27 +0000 Subject: [PATCH] Put filters back into switch statement --- .../events/providers/event_providers.dart | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/app/lib/features/events/providers/event_providers.dart b/app/lib/features/events/providers/event_providers.dart index c8c43bd078fa..3ff89d5aecf2 100644 --- a/app/lib/features/events/providers/event_providers.dart +++ b/app/lib/features/events/providers/event_providers.dart @@ -205,22 +205,23 @@ final eventListSearchedAndFilterProvider = FutureProvider.autoDispose .family, String?>((ref, spaceId) async { //Declare filtered event list - final bookmarkedEvents = - await ref.watch(bookmarkedEventListProvider(spaceId).future); - final ongoingEvents = - await ref.watch(allOngoingEventListProvider(spaceId).future); - final upcomingEvents = - await ref.watch(allUpcomingEventListProvider(spaceId).future); - final pastEvents = await ref.watch(allPastEventListProvider(spaceId).future); - final List filteredEventList = switch (ref.watch(eventListFilterProvider(spaceId))) { - EventFilters.bookmarked => bookmarkedEvents, - EventFilters.ongoing => ongoingEvents, - EventFilters.upcoming => upcomingEvents, - EventFilters.past => pastEvents, + EventFilters.bookmarked => + await ref.watch(bookmarkedEventListProvider(spaceId).future), + EventFilters.ongoing => + await ref.watch(allOngoingEventListProvider(spaceId).future), + EventFilters.upcoming => + await ref.watch(allUpcomingEventListProvider(spaceId).future), + EventFilters.past => + await ref.watch(allPastEventListProvider(spaceId).future), EventFilters.all => - ongoingEvents.followedBy(upcomingEvents).followedBy(pastEvents).toList(), + (await ref.watch(allOngoingEventListProvider(spaceId).future)) + .followedBy( + await ref.watch(allUpcomingEventListProvider(spaceId).future), + ) + .followedBy(await ref.watch(allPastEventListProvider(spaceId).future)) + .toList(), }; final priotizeBookmarkedEvents = await priotizeBookmarked(