Skip to content

Commit

Permalink
fix: add key to mentions (#3102)
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinbarron authored Feb 29, 2024
1 parent 0610757 commit f78d197
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/mgt-chat/src/utils/mentions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { ChatMessageMention, User } from '@microsoft/microsoft-graph-types';
import { GraphChatClient } from 'src/statefulClient/StatefulGraphChatClient';
import { Mention } from '@azure/communication-react';

const buildKey = (mention: Mention) => `${mention?.id}-${mention?.displayText}`;

export const renderMGTMention = (chatState: GraphChatClient) => {
return (mention: Mention, defaultRenderer: (mention: Mention) => JSX.Element): JSX.Element => {
let render: JSX.Element = defaultRenderer(mention);
Expand All @@ -30,7 +32,7 @@ export const renderMGTMention = (chatState: GraphChatClient) => {
</Person>
);
}
render = <>{render}&nbsp;</>;
render = <span key={buildKey(mention)}>{render}&nbsp;</span>;
return render;
};
};

0 comments on commit f78d197

Please sign in to comment.