1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-22 02:12:38 +01:00

add missing key for message elements

This commit is contained in:
Puyodead1 2023-09-10 21:38:49 -04:00
parent a196288848
commit f5d4b1e5f1
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC

View File

@ -111,14 +111,14 @@ function Message({ message, isHeader, isSending, isFailed }: Props) {
]);
const renderAttachment = React.useCallback(
(attachment: APIAttachment) => {
return <MessageAttachment attachment={attachment} contextMenuItems={contextMenuItems} />;
(attachment: APIAttachment, index: number) => {
return <MessageAttachment key={index} attachment={attachment} contextMenuItems={contextMenuItems} />;
},
[contextMenuItems],
);
const renderEmbed = React.useCallback((embed: APIEmbed) => {
return <MessageEmbed embed={embed} contextMenuItems={contextMenuItems} />;
const renderEmbed = React.useCallback((embed: APIEmbed, index: number) => {
return <MessageEmbed key={index} embed={embed} contextMenuItems={contextMenuItems} />;
}, []);
// construct the context menu options
@ -156,9 +156,9 @@ function Message({ message, isHeader, isSending, isFailed }: Props) {
<MessageContent sending={isSending} failed={isFailed}>
{message.content ? <Linkify>{message.content}</Linkify> : null}
{"attachments" in message
? message.attachments.map((attachment) => renderAttachment(attachment))
? message.attachments.map((attachment, index) => renderAttachment(attachment, index))
: null}
{"embeds" in message ? message.embeds.map((embed) => renderEmbed(embed)) : null}
{"embeds" in message ? message.embeds.map((embed, index) => renderEmbed(embed, index)) : null}
</MessageContent>
);
case MessageType.UserJoin: {