Skip to content

Commit

Permalink
prevent auto-reload of analytics page when resizing screen, also reso…
Browse files Browse the repository at this point in the history
…lved concurrent list modification error
  • Loading branch information
ggurdin committed Jun 24, 2024
1 parent 27504ee commit 8b5b9a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
12 changes: 2 additions & 10 deletions lib/config/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
),
Expand All @@ -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,
),
),
Expand Down
7 changes: 3 additions & 4 deletions lib/pangea/controllers/class_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ class ClassController extends BaseController {

Future<void> fixClassPowerLevels() async {
try {
final List<Future<void>> classFixes = [];
final teacherSpaces = await _pangeaController
.matrixState.client.classesAndExchangesImTeaching;
for (final room in teacherSpaces) {
classFixes.add(room.setClassPowerLevels());
}
final List<Future<void>> classFixes = List<Room>.from(teacherSpaces)
.map((adminSpace) => adminSpace.setClassPowerLevels())
.toList();
await Future.wait(classFixes);
} catch (err, stack) {
debugger(when: kDebugMode);
Expand Down

0 comments on commit 8b5b9a9

Please sign in to comment.