Skip to content

Refactor MarkdownViewer to make it SSR-friendly - #3207

Merged
colebemis merged 8 commits into
mainfrom
markdownviewer-ssr
Apr 27, 2023
Merged

Refactor MarkdownViewer to make it SSR-friendly#3207
colebemis merged 8 commits into
mainfrom
markdownviewer-ssr

Conversation

@colebemis

@colebemiscolebemis commented Apr 21, 2023

Copy link
Copy Markdown
Contributor

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

changeset-botBot commented Apr 21, 2023

Copy link
Copy Markdown

🦋 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
NameType
@primer/reactPatch

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

github-actionsBot commented Apr 21, 2023

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
dist/browser.esm.js121.18 KB (0%)
dist/browser.umd.js121.47 KB (0%)

@colebemis
colebemis temporarily deployed to github-pages April 21, 2023 16:52 — with GitHub Actions Inactive
@github-actions
github-actionsBot 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 langermankApril 21, 2023 17:02
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3207 April 21, 2023 17:02 Inactive
@colebemis
colebemis requested review from iansan5653 and joshblack and removed request for langermankApril 21, 2023 17:02
@colebemis
colebemis temporarily deployed to github-pages April 21, 2023 17:07 — with GitHub Actions Inactive
@github-actions
github-actionsBot temporarily deployed to storybook-preview-3207 April 21, 2023 17:08 Inactive
Comment threadsrc/drafts/MarkdownViewer/MarkdownViewer.tsx
Comment threadsrc/drafts/MarkdownViewer/MarkdownViewer.tsx
Comment threadsrc/drafts/MarkdownViewer/_useListInteraction.ts Outdated
@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-actionsBot 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-actionsBot temporarily deployed to storybook-preview-3207 April 25, 2023 22:59 Inactive
@colebemis
colebemis added this pull request to the merge queueApr 27, 2023
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Apr 27, 2023
@colebemis
colebemis merged commit 6773b90 into mainApr 27, 2023
@colebemis
colebemis deleted the markdownviewer-ssr branch April 27, 2023 16:46
This was referenced Apr 27, 2023
Sign up for freeto 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

@colebemis@iansan5653@joshblack