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

Refactor MarkdownViewer to make it SSR-friendly #3207

Merged
merged 8 commits into from
Apr 27, 2023
Merged

Conversation

colebemis
Copy link
Contributor

@colebemis colebemis commented Apr 21, 2023

Problem

MarkdownViewer cannot be rendered on the server

Solution

This PR refactors MarkdownView to be SSR-friendly:

  • Renders HTML with dangerouslySetInnerHTML instead of setting innerHTML inside an effect.
  • Replaces useLayoutEffect with useEffect. useLayoutEffect throws an error on server-side.

Addresses https://github.com/github/primer/issues/2090

@changeset-bot
Copy link

changeset-bot bot commented Apr 21, 2023

🦋 Changeset detected

Latest commit: 8b8b825

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Apr 21, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 121.18 KB (0%)
dist/browser.umd.js 121.47 KB (0%)

@colebemis colebemis temporarily deployed to github-pages April 21, 2023 16:52 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3207 April 21, 2023 16:52 Inactive
@colebemis colebemis marked this pull request as ready for review April 21, 2023 17:02
@colebemis colebemis requested review from a team and langermank April 21, 2023 17:02
@github-actions github-actions bot temporarily deployed to storybook-preview-3207 April 21, 2023 17:02 Inactive
@colebemis colebemis requested review from iansan5653 and joshblack and removed request for langermank April 21, 2023 17:02
@colebemis colebemis temporarily deployed to github-pages April 21, 2023 17:07 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3207 April 21, 2023 17:08 Inactive
@colebemis colebemis marked this pull request as draft April 21, 2023 18:03
@colebemis colebemis marked this pull request as ready for review April 25, 2023 22:52
@github-actions github-actions bot temporarily deployed to storybook-preview-3207 April 25, 2023 22:57 Inactive
@colebemis colebemis temporarily deployed to github-pages April 25, 2023 22:58 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3207 April 25, 2023 22:59 Inactive
@colebemis colebemis added this pull request to the merge queue Apr 27, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 27, 2023
@colebemis colebemis merged commit 6773b90 into main Apr 27, 2023
@colebemis colebemis deleted the markdownviewer-ssr branch April 27, 2023 16:46
This was referenced Apr 27, 2023
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.

3 participants