Rebuild only changed list rows and lay out big artifact sections lazily
Runs and chat session rows are memoized on their own data (MemoSubtree), so a run event or a chat's running change rebuilds one row instead of every built row. The artifact gallery's open sections are lazy slivers revealed by a sliver open/close animation, and thumbnails decode at display size. Benches in test/perf measure both.
This commit is contained in:
@@ -80,6 +80,9 @@ List<JsonMap> _runs(int count, DateTime now) => [
|
||||
},
|
||||
];
|
||||
|
||||
// The app passes a stable tear-off (`_select`), never a fresh closure.
|
||||
void _open(num _) {}
|
||||
|
||||
void main() {
|
||||
late _Gateway gateway;
|
||||
late RunsController controller;
|
||||
@@ -105,7 +108,7 @@ void main() {
|
||||
AppDestination.runs: (_) => AnimatedBuilder(
|
||||
animation: controller,
|
||||
builder: (_, _) =>
|
||||
RunsList(controller: controller, onSelected: (_) {}),
|
||||
RunsList(controller: controller, onSelected: _open),
|
||||
),
|
||||
AppDestination.pipelines: (_) => const Center(child: Text('pipelines')),
|
||||
},
|
||||
@@ -234,6 +237,9 @@ void main() {
|
||||
);
|
||||
// Only the ten frames that advance a step change anything visible.
|
||||
expect(notifications, lessThanOrEqualTo(10));
|
||||
// Each notification rebuilds the one row whose run changed, not every
|
||||
// built row (16 rows rebuilt per notification before memoized rows).
|
||||
expect(rebuilds.of(RunListRow), lessThanOrEqualTo(notifications));
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user