Fix duplicate keys in CombinedSystemMessage component (#23507)

This commit is contained in:
Harrison Healey 2023-05-29 17:20:33 -04:00 committed by GitHub
parent fa1ba4717b
commit eaa190acf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -322,14 +322,15 @@ export class CombinedSystemMessage extends React.PureComponent<Props> {
); );
} }
renderMessage(postType: string, userIds: string[], actorId?: string): JSX.Element { renderMessage(index: number, postType: string, userIds: string[], actorId?: string): JSX.Element {
return ( return (
<React.Fragment key={postType + actorId}> <React.Fragment key={index}>
{this.renderFormattedMessage(postType, userIds, actorId)} {this.renderFormattedMessage(postType, userIds, actorId)}
<br/> <br/>
</React.Fragment> </React.Fragment>
); );
} }
render(): JSX.Element { render(): JSX.Element {
const { const {
currentUserId, currentUserId,
@ -337,7 +338,8 @@ export class CombinedSystemMessage extends React.PureComponent<Props> {
} = this.props; } = this.props;
const content = []; const content = [];
for (const message of messageData) { for (let i = 0; i < messageData.length; i++) {
const message = messageData[i];
const { const {
postType, postType,
actorId, actorId,
@ -356,7 +358,7 @@ export class CombinedSystemMessage extends React.PureComponent<Props> {
} }
} }
content.push(this.renderMessage(postType, userIds, actorId)); content.push(this.renderMessage(i, postType, userIds, actorId));
} }
return ( return (