fix: prevent typing effect replay on finalized messages (blink fix) (#398)
Root cause: when MessageComplete fires, the reducer atomically moves the streaming message to the messages list and clears streamingMessage. The messages list's typing effect condition (lastAnimatedMessageId check) didn't account for the fact that this message was already rendered with a typing effect in the streaming slot. The animation replayed from scratch on the already-complete message, causing a visible blink. Fix: add message.isStreaming to the condition. Messages finalized via MessageComplete/MessageDone always have isStreaming=false, so they skip the replay naturally. The streaming slot's StreamingBubbleWithTypingEffect continues to handle the animation during active streaming. Closes #374 Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
cac15147f4
commit
979877eed3
1 file changed
+1
-1
@@ -1102,7 +1102,7 @@ private fun ChatMessageList(
|
||||
val isLastMessage = index == messages.lastIndex
|
||||
val isAssistant = message.role == MessageRole.ASSISTANT
|
||||
|
||||
if (typingEffectEnabled && isLastMessage && isAssistant &&
|
||||
if (typingEffectEnabled && isLastMessage && isAssistant && message.isStreaming &&
|
||||
lastAnimatedMessageId != message.id
|
||||
) {
|
||||
StreamingBubbleWithTypingEffect(
|
||||
|
||||
Reference in new issue
Block a user