Skip to content

Commit

Permalink
Fix displaying a loading indicator for loading holidays (#643)
Browse files Browse the repository at this point in the history
Fixes #566
  • Loading branch information
nilsreichardt authored May 5, 2023
1 parent 41c48af commit aee3c82
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/lib/blocs/dashbord_widgets_blocs/holiday_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down

0 comments on commit aee3c82

Please sign in to comment.