Construct chat row contents only when slivers mount them

This commit is contained in:
2026-11-08 00:11:13 +00:00
parent 1af69c1bca
commit 78bb5dcd9b
3 changed files with 66 additions and 12 deletions
@@ -1094,17 +1094,24 @@ class _ChatThreadViewState extends State<ChatThreadView> {
Padding(
key: ValueKey<String>(keys[index]),
padding: const EdgeInsets.symmetric(horizontal: 16),
child: _entering(
rows[index],
_transcriptRow(
// Slivers mount only visible rows. Defer constructing
// their chips and checking cached widgets until then,
// rather than visiting the entire history per delta.
child: Builder(
builder: (_) => _entering(
rows[index],
keys[index],
onDismissCompaction:
compactionNotice != null &&
chatNoticeActivityCondition(rows[index]) ==
compactionNotice.condition
? () => _dismiss(compactionNotice)
: null,
_transcriptRow(
rows[index],
keys[index],
onDismissCompaction:
compactionNotice != null &&
chatNoticeActivityCondition(
rows[index],
) ==
compactionNotice.condition
? () => _dismiss(compactionNotice)
: null,
),
),
),
),