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.
This commit is contained in:
M57 authored and GitHub committed 2026-06-23 12:30:20 +03:00
1 parent 8ad3efecf4
commit fe46cb913c
1 file changed
+1 -1
@@ -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,