@@ -19,6 +19,15 @@ class TaskHandler extends ChangeNotifier {
1919
2020 List <IssueLabel > _repoLabels = [];
2121
22+ bool _tasksLoading = false ;
23+ bool _labelsLoading = false ;
24+
25+ /// Whether the task handler is currently loading task data.
26+ bool get tasksLoading => _tasksLoading;
27+
28+ /// Whether the task handler is currently loading label data.
29+ bool get labelsLoading => _labelsLoading;
30+
2231 /// The list of all tasks available in the repository.
2332 List <Task > get tasks => List .unmodifiable (_tasks);
2433
@@ -28,11 +37,14 @@ class TaskHandler extends ChangeNotifier {
2837 /// The list of all tasks available in the repository.
2938 /// After the notification the current list of task is stored in [tasks] .
3039 Future <void > loadTasks () async {
40+ _tasksLoading = true ;
41+ notifyListeners ();
3142 try {
3243 final RepositoryDetails ? repo = await SettingsHandler ()
3344 .getSelectedRepository ();
3445 if (repo == null ) {
3546 Logger .logWarning ("No repository selected" , _classId);
47+ _tasksLoading = false ;
3648 return ;
3749 }
3850 final List <Task > issues = await _fetchIssuesForRepository (repo);
@@ -49,13 +61,16 @@ class TaskHandler extends ChangeNotifier {
4961 Logger .logError ("Failed to load tasks" , _classId, e);
5062 } finally {
5163 Logger .logInfo ("Loaded ${_tasks .length } tasks from repository" , _classId);
64+ _tasksLoading = false ;
5265 notifyListeners ();
5366 }
5467 }
5568
5669 /// The list of all labels available in the repository.
5770 /// After the notification the current list of labels is stored in [repoLabels] .
5871 Future <void > loadLabels () async {
72+ _labelsLoading = true ;
73+ notifyListeners ();
5974 try {
6075 _repoLabels.clear ();
6176 final RepositoryDetails ? repo = await SettingsHandler ()
@@ -71,9 +86,11 @@ class TaskHandler extends ChangeNotifier {
7186 "Loaded ${_repoLabels .length } labels from repository ${repo .toSlug ()}" ,
7287 _classId,
7388 );
74- notifyListeners ();
7589 } on Exception catch (e) {
7690 Logger .logError ("Failed to load labels" , _classId, e);
91+ } finally {
92+ _labelsLoading = false ;
93+ notifyListeners ();
7794 }
7895 }
7996
0 commit comments