fix(android): stop asking a turn card for intrinsic height
android / debug (push) Successful in 2m52s
ci / test (push) Successful in 1m7s
ci / chart (push) Successful in 6s
ci / docker (push) Successful in 2m1s
ci / web (push) Successful in 13s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Successful in 2m4s
android / release (push) Successful in 2m25s
ci / checks (push) Successful in 2m44s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Successful in 9s
ci / publish-edge-chart (push) Successful in 5s
android / debug (push) Successful in 2m52s
ci / test (push) Successful in 1m7s
ci / chart (push) Successful in 6s
ci / docker (push) Successful in 2m1s
ci / web (push) Successful in 13s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Successful in 2m4s
android / release (push) Successful in 2m25s
ci / checks (push) Successful in 2m44s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Successful in 9s
ci / publish-edge-chart (push) Successful in 5s
An agent reply carrying a markdown table killed the chat screen: the agent turn's Row was measured at IntrinsicSize.Min so its accent bar could span the card, and the table renderer's wide variant is a SubcomposeLayout, which throws when asked for intrinsics. Draw the 2 dp bar behind the row instead and let the card take its height from its content. The web session's transcript carries such a table, so opening it crashed before the first frame.
This commit is contained in:
1 parent
57569b6b56
commit
13da540ce5
1 file changed
+13
-4
@@ -65,6 +65,8 @@ import androidx.compose.runtime.snapshotFlow
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
import androidx.compose.ui.geometry.Size
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.graphics.asImageBitmap
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
@@ -497,6 +499,7 @@ private fun TurnGroupRow(
|
||||
stringResource(R.string.chat_user_dispatch)
|
||||
}
|
||||
val avatar = if (you) userFace.image else null
|
||||
val accent = TogetherAccent
|
||||
|
||||
when (group) {
|
||||
is TurnGroup.User -> Row(
|
||||
@@ -557,7 +560,6 @@ private fun TurnGroupRow(
|
||||
is TurnGroup.Agent -> Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(IntrinsicSize.Min)
|
||||
.background(
|
||||
TogetherSurface,
|
||||
RoundedCornerShape(
|
||||
@@ -566,12 +568,19 @@ private fun TurnGroupRow(
|
||||
bottomEnd = 10.dp,
|
||||
bottomStart = 0.dp,
|
||||
),
|
||||
),
|
||||
)
|
||||
// The accent bar is drawn, not a child measured against
|
||||
// the row's intrinsic height: a markdown table renders
|
||||
// through a SubcomposeLayout (its wide variant scrolls),
|
||||
// and asking that for intrinsics throws on the main
|
||||
// thread. The bar spans whatever height the content takes.
|
||||
.drawBehind {
|
||||
drawRect(accent, size = Size(2.dp.toPx(), size.height))
|
||||
},
|
||||
) {
|
||||
AccentBar(TogetherAccent, width = 2.dp)
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(12.dp)
|
||||
.padding(start = 14.dp, top = 12.dp, end = 12.dp, bottom = 12.dp)
|
||||
.weight(1f),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
|
||||
Reference in new issue
Block a user