diff --git a/ui/lib/providers/activity.dart b/ui/lib/providers/activity.dart index 79874cd4..c29693b5 100644 --- a/ui/lib/providers/activity.dart +++ b/ui/lib/providers/activity.dart @@ -27,12 +27,6 @@ class ActivityData extends AutoDisposeFamilyAsyncNotifier, String> { @override FutureOr> build(String arg) async { - if (arg == "active") { - //refresh active downloads - Timer(const Duration(seconds: 5), - ref.invalidateSelf); //Periodically Refresh - } - final dio = await APIs.getDio(); var resp = await dio.get(APIs.activityUrl, queryParameters: {"status": arg}); @@ -44,6 +38,12 @@ class ActivityData for (final a in sp.data as List) { activities.add(Activity.fromJson(a)); } + + if (arg == "active") { + //refresh active downloads + Timer(const Duration(seconds: 5), + () => ref.invalidateSelf()); //Periodically Refresh + } return activities; }