Set key for chatMessage parent to get UX efficiently updated by react

By fixing the no key prop in ChatHistory error on web app
This commit is contained in:
Debanjum
2025-04-09 09:01:55 +05:30
parent 1ad7314fe6
commit 9ab5ead3ca

View File

@@ -28,10 +28,6 @@ interface ChatResponse {
response: ChatHistoryData;
}
interface ChatHistory {
[key: string]: string;
}
interface ChatHistoryProps {
conversationId: string;
setTitle: (title: string) => void;
@@ -368,7 +364,7 @@ export default function ChatHistory(props: ChatHistoryProps) {
{data &&
data.chat &&
data.chat.map((chatMessage, index) => (
<>
<React.Fragment key={`chatMessage-${index}`}>
{chatMessage.trainOfThought && chatMessage.by === "khoj" && (
<TrainOfThoughtComponent
trainOfThought={chatMessage.trainOfThought?.map(
@@ -403,7 +399,7 @@ export default function ChatHistory(props: ChatHistoryProps) {
onDeleteMessage={handleDeleteMessage}
conversationId={props.conversationId}
/>
</>
</React.Fragment>
))}
{props.incomingMessages &&
props.incomingMessages.map((message, index) => {