Merge main
This commit is contained in:
@@ -271,6 +271,7 @@ class RunsController extends ChangeNotifier {
|
||||
void _event(JsonMap frame) {
|
||||
if (_removed.contains(frame['run_id'])) return;
|
||||
final folded = foldRunEvent(runs, frame);
|
||||
final before = (runs: runs, detail: detail);
|
||||
runs = folded.runs;
|
||||
selection.retain(runs);
|
||||
if (detail?['id'] == frame['run_id']) {
|
||||
@@ -285,6 +286,11 @@ class RunsController extends ChangeNotifier {
|
||||
(folded.needsResync || runDetailNeedsFullSync(frame))) {
|
||||
_scheduleDetailRefresh(selected);
|
||||
}
|
||||
// A frame that changed neither the list nor the open detail shows
|
||||
// nothing new; the refreshes above notify for themselves.
|
||||
if (identical(before.runs, runs) && identical(before.detail, detail)) {
|
||||
return;
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/layout/memo_subtree.dart';
|
||||
import '../../attention/notify/notification_controller.dart';
|
||||
import '../../attention/runtime/attention_controller.dart';
|
||||
import '../../attention/runtime/attention_store.dart';
|
||||
@@ -146,7 +147,9 @@ class RunsList extends StatelessWidget {
|
||||
RunsDeleteReport(controller: controller),
|
||||
RunsFilters(controller: controller),
|
||||
];
|
||||
if (controller.visibleRuns.isNotEmpty) return _groupedRuns(context, header);
|
||||
// Filtered and sorted once per build: the getter recomputes every read.
|
||||
final visible = controller.visibleRuns;
|
||||
if (visible.isNotEmpty) return _groupedRuns(context, header, visible);
|
||||
return BelowTopBar(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
@@ -169,15 +172,17 @@ class RunsList extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _groupedRuns(BuildContext context, List<Widget> header) {
|
||||
Widget _groupedRuns(
|
||||
BuildContext context,
|
||||
List<Widget> header,
|
||||
List<JsonMap> visible,
|
||||
) {
|
||||
final entries = <_Entry>[];
|
||||
if (flatRunSorts.contains(controller.sort)) {
|
||||
// An order by size is one flat list: day headings would split it.
|
||||
entries.addAll(
|
||||
controller.visibleRuns.map((run) => (day: null, run: run)),
|
||||
);
|
||||
entries.addAll(visible.map((run) => (day: null, run: run)));
|
||||
} else {
|
||||
final groups = groupRunsByDay(controller.visibleRuns, DateTime.now());
|
||||
final groups = groupRunsByDay(visible, DateTime.now());
|
||||
for (final group in groups) {
|
||||
entries.add((day: group, run: null));
|
||||
entries.addAll(group.runs.map((run) => (day: null, run: run)));
|
||||
@@ -185,7 +190,7 @@ class RunsList extends StatelessWidget {
|
||||
}
|
||||
// Runs that start while the list is open enter with a short fade.
|
||||
return ArrivalScope(
|
||||
ids: [for (final run in controller.visibleRuns) '${run['id']}'],
|
||||
ids: [for (final run in visible) '${run['id']}'],
|
||||
child: _entriesList(entries, header),
|
||||
);
|
||||
}
|
||||
@@ -296,6 +301,27 @@ class RunsList extends StatelessWidget {
|
||||
|
||||
Widget _runTile(BuildContext context, JsonMap run, {bool divider = true}) {
|
||||
final id = run['id'];
|
||||
final selection = controller.selection;
|
||||
final now = DateTime.now();
|
||||
// A run event for one run rebuilds only that run's row: the others keep
|
||||
// their built subtree (their menu, ripple and tooltip included).
|
||||
return MemoSubtree(
|
||||
memo: (
|
||||
MemoMap(run),
|
||||
divider,
|
||||
selection.active,
|
||||
selection.contains(id),
|
||||
id == controller.selectedRunId,
|
||||
controller,
|
||||
onSelected,
|
||||
// An executing run's duration reads the clock, as before.
|
||||
run['executing'] == true ? runRowFacts(run, now).duration : null,
|
||||
),
|
||||
builder: (context) => _runRow(run, id, now, divider: divider),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _runRow(JsonMap run, Object? id, DateTime now, {bool divider = true}) {
|
||||
final selection = controller.selection;
|
||||
return RunListRow(
|
||||
selecting: selection.active,
|
||||
@@ -307,7 +333,7 @@ class RunsList extends StatelessWidget {
|
||||
run: run,
|
||||
divider: divider,
|
||||
selected: id == controller.selectedRunId,
|
||||
now: DateTime.now(),
|
||||
now: now,
|
||||
onTap: id is num ? () => onSelected(id) : null,
|
||||
gateway: controller.repository.gateway,
|
||||
onRunChanged: controller.acceptRunDetail,
|
||||
|
||||
Reference in New Issue
Block a user