Attach the restore hook only while there is a restore

`onPlaced` on the transcript content is the one callback left that would
run every frame, and on all but the two frames of a restore it looks at
a null and returns. Attaching it only while a position is waiting says
that in the modifier chain rather than in a branch inside it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
irisandClaude Opus 5 committed 2026-08-31 02:04:06 -04:00
1 parent 19072a7e96
commit fd250378a0
1 file changed
+4 -1
@@ -262,7 +262,10 @@ fun TranscriptColumn(
.fillMaxWidth() .fillMaxWidth()
// Once for the whole list, not once per row: this is where a saved position is put // Once for the whole list, not once per row: this is where a saved position is put
// back, and by placement the scroll container's own measurements describe this layout. // back, and by placement the scroll container's own measurements describe this layout.
.onPlaced { state.placed() } // Only while there is a position waiting to be put back. `onPlaced` is the one hook
// here that would otherwise run on every frame, and it has nothing to do on all but
// the two frames of a restore.
.then(if (state.settling) Modifier.onPlaced { state.placed() } else Modifier)
// One gesture detector for the whole list; see [TranscriptScroll.tappedHigh]. On the // One gesture detector for the whole list; see [TranscriptScroll.tappedHigh]. On the
// initial pass and consuming nothing, so every control inside still gets the gesture // initial pass and consuming nothing, so every control inside still gets the gesture
// exactly as it would have. // exactly as it would have.