Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Expose registerMarkdownParser function instead of registering during the component lifecycle #38

Merged
merged 3 commits into from
Nov 16, 2022

Conversation

pawelgrimm
Copy link
Contributor

@pawelgrimm pawelgrimm commented Nov 15, 2022

Overview

In this PR, we are changing how we are setting up the AdaptiveCardRenderer. In the past, we would register the custom markdown parser in a useEffect. However, since the AdaptiveCards library only allows you to register a single markdown parser globally, it makes more sense to do so in the global scope instead of in a useEffect.

The main reason for this change is that in the initial render of AdaptiveCardRenderer, the markdown parser wasn't registered (because useEffect runs after the first render) and so markdown was not parsed and was rendered as plain text. This lead to a poor UX with UI Extensions in the first time a markdown-containing Adaptive Card response was rendered.

Test plan

@pawelgrimm pawelgrimm requested review from a team and rfgamaral and removed request for a team November 15, 2022 23:41
@pawelgrimm
Copy link
Contributor Author

@scottlovegrove I'd also appreciate your feedback since you have historical context.

@pawelgrimm pawelgrimm self-assigned this Nov 15, 2022
@pawelgrimm pawelgrimm marked this pull request as ready for review November 15, 2022 23:42
@pawelgrimm pawelgrimm requested review from a team and scottlovegrove and removed request for a team November 15, 2022 23:42
@scottlovegrove
Copy link
Contributor

Good spot on this fix 👍🏻 The changes make sense to me.

Copy link
Member

@rfgamaral rfgamaral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🚀 (sorry for the delay)

@pawelgrimm pawelgrimm marked this pull request as draft November 16, 2022 21:10
@pawelgrimm pawelgrimm marked this pull request as ready for review November 16, 2022 21:10
@pawelgrimm pawelgrimm merged commit 716a7bc into main Nov 16, 2022
@pawelgrimm pawelgrimm deleted the pawel/expose-register-markdown-parser-function branch November 16, 2022 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants