From aee3c829db92f2e641e558c36c5f21ff3d8e385a Mon Sep 17 00:00:00 2001 From: Nils Reichardt Date: Fri, 5 May 2023 18:46:17 +0200 Subject: [PATCH] Fix displaying a loading indicator for loading holidays (#643) Fixes #566 --- app/lib/blocs/dashbord_widgets_blocs/holiday_bloc.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/lib/blocs/dashbord_widgets_blocs/holiday_bloc.dart b/app/lib/blocs/dashbord_widgets_blocs/holiday_bloc.dart index e5d67013c..70db92de4 100644 --- a/app/lib/blocs/dashbord_widgets_blocs/holiday_bloc.dart +++ b/app/lib/blocs/dashbord_widgets_blocs/holiday_bloc.dart @@ -36,7 +36,12 @@ class HolidayBloc extends BlocBase { this.getCurrentTime}) { getCurrentTime ??= () => DateTime.now(); - final holidaysStream = userState.asyncMap((stateEnum) async { + final holidaysStream = userState + // StateEnum.notSelected would result into an UnsupportedStateException + // while loading the holidays, which would lead to an error in the UI + // (see https://github.com/SharezoneApp/sharezone-app/issues/566). + .where((state) => state != StateEnum.notSelected) + .asyncMap((stateEnum) async { final state = toStateOrThrow(stateEnum); return await holidayManager.load(state); });