Fix the key

The timestamp is seconds so you can easily have the same key if two
participants send a message at the same time.
This commit is contained in:
Franck Royer 2021-04-30 14:42:44 +10:00
parent e0be69a056
commit 0969d073ac
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 2 additions and 1 deletions

View File

@ -11,7 +11,8 @@ export default function ChatList(props: Props) {
const listItems = messages.map((currentMessage) => (
<Message
key={currentMessage.timestamp.toString()}
// We assume that the same user is not sending two messages in the same second
key={currentMessage.timestamp.toString() + currentMessage.nick}
authorName={currentMessage.nick}
date={formatDisplayDate(currentMessage)}
>