Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dante291 committed Sep 21, 2024
1 parent 9485047 commit 14a40ff
Show file tree
Hide file tree
Showing 6 changed files with 202 additions and 145 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,11 @@ class EventInfoViewModel extends BaseModel {
/// None
Future<void> fetchVolunteerGroups(String eventId) async {
try {
setState(ViewState.busy);
final result =
await locator<EventService>().fetchVolunteerGroupsByEvent(eventId);

_volunteerGroups.clear();
_volunteerGroups.addAll(result);

setState(ViewState.idle);
notifyListeners();
} catch (e) {
print('Error fetching volunteer groups: $e');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ class _VolunteerGroupsScreenState extends State<VolunteerGroupsScreen> {
/// None
Future<void> _fetchVolunteerGroupsAndDisplay() async {
await widget.model.fetchVolunteerGroups(widget.event.id!);
setState(() {});
// Ensure setState is called after the widget is built
if (mounted) {
WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() {});
});
}
}

@override
Expand Down
Loading

0 comments on commit 14a40ff

Please sign in to comment.