1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-22 10:22:30 +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( const renderAttachment = React.useCallback(
(attachment: APIAttachment) => { (attachment: APIAttachment, index: number) => {
return <MessageAttachment attachment={attachment} contextMenuItems={contextMenuItems} />; return <MessageAttachment key={index} attachment={attachment} contextMenuItems={contextMenuItems} />;
}, },
[contextMenuItems], [contextMenuItems],
); );
const renderEmbed = React.useCallback((embed: APIEmbed) => { const renderEmbed = React.useCallback((embed: APIEmbed, index: number) => {
return <MessageEmbed embed={embed} contextMenuItems={contextMenuItems} />; return <MessageEmbed key={index} embed={embed} contextMenuItems={contextMenuItems} />;
}, []); }, []);
// construct the context menu options // construct the context menu options
@ -156,9 +156,9 @@ function Message({ message, isHeader, isSending, isFailed }: Props) {
<MessageContent sending={isSending} failed={isFailed}> <MessageContent sending={isSending} failed={isFailed}>
{message.content ? <Linkify>{message.content}</Linkify> : null} {message.content ? <Linkify>{message.content}</Linkify> : null}
{"attachments" in message {"attachments" in message
? message.attachments.map((attachment) => renderAttachment(attachment)) ? message.attachments.map((attachment, index) => renderAttachment(attachment, index))
: null} : null}
{"embeds" in message ? message.embeds.map((embed) => renderEmbed(embed)) : null} {"embeds" in message ? message.embeds.map((embed, index) => renderEmbed(embed, index)) : null}
</MessageContent> </MessageContent>
); );
case MessageType.UserJoin: { case MessageType.UserJoin: {