Skip to content

Commit

Permalink
fix: handling loading case as no data case (#435)
Browse files Browse the repository at this point in the history
Prevent the Email modification popup to be display until the user data
are loaded, preventing it to flash while loading the main page
  • Loading branch information
maximeroucher authored Sep 25, 2024
1 parent 35d9afa commit 9c2fe02
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/tools/providers/should_notify_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import 'package:myecl/tools/functions.dart';
import 'package:myecl/user/providers/user_provider.dart';

final shouldNotifyProvider = Provider((ref) {
final user = ref.watch(userProvider);
return !isStudent(user.email) && isNotStaff(user.email);
final asyncUser = ref.watch(asyncUserProvider);
return asyncUser.maybeWhen(
data: (user) => !isStudent(user.email) && isNotStaff(user.email),
orElse: () => false,
);
});

0 comments on commit 9c2fe02

Please sign in to comment.