Describe the bug
Currently, rendering the UnsupportedContent component is done by stringifying the component and appending it as a string in the content property. This brings in state mutation of the props that is not advised.
To Reproduce
Steps to reproduce the behavior:
- Go to
|
const onRenderMessage = (messageProps: MessageProps, defaultOnRender?: MessageRenderer) => { |
|
const message = messageProps?.message; |
|
if (isGraphChatMessage(message) && message?.hasUnsupportedContent) { |
|
const unsupportedContentComponent = <UnsupportedContent targetUrl={message.rawChatUrl} />; |
|
messageProps = produce(messageProps, (draft: MessageProps) => { |
|
if (isChatMessage(draft.message)) { |
|
draft.message.content = renderToString(unsupportedContentComponent); |
|
} |
|
}); |
|
} |
Expected behavior
Rendered UnsupportedContent component as a react component. Wrap it in ChatMessage or ChatMyMessage components from @fluentui/react-components. Add the chat message header customizations for a similar look to the rest of the messages. Remove any state mutations on the props passed in onRenderMessage.
Additional Context
Describe the bug
Currently, rendering the
UnsupportedContentcomponent is done by stringifying the component and appending it as a string in the content property. This brings in state mutation of the props that is not advised.To Reproduce
Steps to reproduce the behavior:
microsoft-graph-toolkit/packages/mgt-chat/src/utils/chat.tsx
Lines 15 to 24 in 2a61bd7
Expected behavior
Rendered
UnsupportedContentcomponent as a react component. Wrap it inChatMessageorChatMyMessagecomponents from@fluentui/react-components. Add the chat message header customizations for a similar look to the rest of the messages. Remove any state mutations on the props passed inonRenderMessage.Additional Context
ChatMessageandChatMyMessage