From fe46cb913ca5292f643edb90381694e235b74525 Mon Sep 17 00:00:00 2001 From: M57 <41645758+Hy4ri@users.noreply.github.com> Date: Tue, 23 Jun 2026 12:30:20 +0300 Subject: [PATCH] Fix: Conditionally apply animateContentSize on AssistantBubble (#317) Resolves #272 Changes made: - Modified the modifier chain in `AssistantBubble` inside `ChatBubble.kt`. - Applied `animateContentSize()` conditionally via `let { if (!message.isStreaming) it.animateContentSize() else it }`. Reason: - Unconditionally using `animateContentSize()` on a streaming chat bubble caused Jetpack Compose to trigger a layout animation for every single token appended. This wasted GPU cycles and contributed to streaming jank. Impact: - Eliminates performance issues (PERF-04) during active message streaming in the chat screen. The layout animation will now only occur once when the final (non-streaming) message state is reached. No regressions expected as this modifier change applies exclusively to the `isStreaming` state toggle. --- app/src/main/java/com/m57/hermescontrol/ui/chat/ChatBubble.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/m57/hermescontrol/ui/chat/ChatBubble.kt b/app/src/main/java/com/m57/hermescontrol/ui/chat/ChatBubble.kt index 01355b81..6cc70260 100644 --- a/app/src/main/java/com/m57/hermescontrol/ui/chat/ChatBubble.kt +++ b/app/src/main/java/com/m57/hermescontrol/ui/chat/ChatBubble.kt @@ -316,7 +316,7 @@ private fun AssistantBubble( modifier = Modifier .widthIn(max = maxWidth) - .animateContentSize() + .let { if (!message.isStreaming) it.animateContentSize() else it } .clip( RoundedCornerShape( topStart = 4.dp,