fix: message overflow state preservation from previous messages

Using index is bad practice: https://react.dev/learn/rendering-lists#rules-of-keys

We don't recalculate the overflow state once the message is overflown.
When using the index as key, then when a new message is added at the top
of the array at index 0. The overflow state from the previous message at
index 0 is kept. The overflow state shouldn't be reused.
This commit is contained in:
Jannis Mattheis 2025-09-20 13:20:52 +02:00
parent f1bf24c10f
commit 9ff713c537
1 changed files with 2 additions and 2 deletions

View File

@ -33,9 +33,9 @@ const Messages = observer(() => {
}
}, [appId]);
const renderMessage = (index: number, message: IMessage) => (
const renderMessage = (_index: number, message: IMessage) => (
<Message
key={index}
key={message.id}
fDelete={deleteMessage(message)}
onExpand={(expanded) => (expandedState.current[message.id] = expanded)}
title={message.title}