From 8b5b9a96dc6f0ea3051df799debd60942ee5e782 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Mon, 24 Jun 2024 10:27:51 -0400 Subject: [PATCH] prevent auto-reload of analytics page when resizing screen, also resolved concurrent list modification error --- lib/config/routes.dart | 12 ++---------- lib/pangea/controllers/class_controller.dart | 7 +++---- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/config/routes.dart b/lib/config/routes.dart index d4eaa5d85..debc48968 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -220,11 +220,7 @@ abstract class AppRoutes { pageBuilder: (context, state) => defaultPageBuilder( context, state, - ClassAnalyticsPage( - // when going to sub-space from within a parent space's analytics, the - // analytics list tiles do not properly update. Adding a unique key to this page is the best fix - // I can find at the moment - key: UniqueKey(), + const ClassAnalyticsPage( selectedView: BarChartViewSelection.messages, ), ), @@ -234,11 +230,7 @@ abstract class AppRoutes { pageBuilder: (context, state) => defaultPageBuilder( context, state, - ClassAnalyticsPage( - // when going to sub-space from within a parent space's analytics, the - // analytics list tiles do not properly update. Adding a unique key to this page is the best fix - // I can find at the moment - key: UniqueKey(), + const ClassAnalyticsPage( selectedView: BarChartViewSelection.grammar, ), ), diff --git a/lib/pangea/controllers/class_controller.dart b/lib/pangea/controllers/class_controller.dart index 1e2febf21..a3f1aa268 100644 --- a/lib/pangea/controllers/class_controller.dart +++ b/lib/pangea/controllers/class_controller.dart @@ -34,12 +34,11 @@ class ClassController extends BaseController { Future fixClassPowerLevels() async { try { - final List> classFixes = []; final teacherSpaces = await _pangeaController .matrixState.client.classesAndExchangesImTeaching; - for (final room in teacherSpaces) { - classFixes.add(room.setClassPowerLevels()); - } + final List> classFixes = List.from(teacherSpaces) + .map((adminSpace) => adminSpace.setClassPowerLevels()) + .toList(); await Future.wait(classFixes); } catch (err, stack) { debugger(when: kDebugMode);