Fix: In order to distinguish the keys of a pair of messages, add a prefix to the id when rendering the message. #4409 (#4451)

### What problem does this PR solve?

Fix: In order to distinguish the keys of a pair of messages, add a
prefix to the id when rendering the message. #4409

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2025-01-13 10:51:59 +08:00
committed by GitHub
parent 95261f17f6
commit 2c7ba90cb4
6 changed files with 23 additions and 26 deletions

View File

@ -18,6 +18,7 @@ import {
useGetChatSearchParams,
} from '@/hooks/chat-hooks';
import { useFetchUserInfo } from '@/hooks/user-setting-hooks';
import { buildMessageUuidWithRole } from '@/utils/chat';
import { memo } from 'react';
import styles from './index.less';
@ -64,7 +65,7 @@ const ChatContainer = ({ controller }: IProps) => {
sendLoading &&
derivedMessages.length - 1 === i
}
key={message.id}
key={buildMessageUuidWithRole(message)}
item={message}
nickname={userInfo.nickname}
avatar={userInfo.avatar}