Skip to content

Commit dd23f7e

Browse files
committed
Fix message flickering during streaming
- Use stable React keys in MessageList to prevent component remounting - Remove flex-1 constraint from markdown wrapper to allow natural height - Prevents user message from resizing while assistant response streams
1 parent 8f2319d commit dd23f7e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/components/chat/MessageBubble.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const MessageBubble: React.FC<MessageBubbleProps> = ({
103103
<StyledText className='text-base leading-5 font-semibold mb-3 mt-1.5' color='primary' textAlign='left'>
104104
{isOutgoing ? (isShare ? t('anonymous') : t('you')) : t('ansariChat')}
105105
</StyledText>
106-
<View className='flex-1 px-1'>
106+
<View className='px-1'>
107107
<Markdown
108108
style={{
109109
body: [styles.messageText, textStyle],

src/components/chat/MessageList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const MessageList = forwardRef<MessageListRef, MessageListProps>(
107107
}}
108108
>
109109
{filteredMessages.map((message: Message, index) => {
110-
const id = message.id || Helpers.generateUniqueId() + (isSending ? '-sending' : '')
110+
const id = message.id || `${index}-sending`
111111

112112
return (
113113
<MessageBubbleMemo

0 commit comments

Comments
 (0)