microsoftgraph / microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒
https://docs.microsoft.com/graph/toolkit/overview
Other
964 stars 309 forks source link

[REFACTOR] update `UnsupportedContent` rendering #2819

Open musale opened 1 year ago

musale commented 1 year ago

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:

  1. Go to https://github.com/microsoftgraph/microsoft-graph-toolkit/blob/2a61bd76058d9e7c5602f737ff8fe126162269e2/packages/mgt-chat/src/utils/chat.tsx#L15-L24

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

gavinbarron commented 1 year ago

Good call @musale

sebastienlevert commented 9 months ago

In a case where we want developers to provide their own logic to render the content (replace an adaptive card, for instance), we should provide a onUnsupportedContentRender callback that developers can use to return a JSX element if required.

musale commented 9 months ago

In a case where we want developers to provide their own logic to render the content (replace an adaptive card, for instance), we should provide a onUnsupportedContentRender callback that developers can use to return a JSX element if required.

~Good idea, we should make this its own issue.~ Update: https://github.com/microsoftgraph/microsoft-graph-toolkit/issues/3122