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(core): fix React rendering null chars in HTML output - Use renderToReadableStream #10562

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Oct 7, 2024

Motivation

Fix #9985

Replace renderToPipeableStream with renderToReadableStream because the former emit NULL chars unexpectedly, which might be a React bug.

Note: the setup is not super clean in terms of TS/exports, but it should work for all versions of Node we cover or the CI would report it.

Note: I benchmarked this locally and I doubt this has a significant impact on Docusaurus build times: it's approximately the same. The app rendering phase is not our main bottleneck currently, even with the new Docusaurus Faster options.

Related links:

Test Plan

CI

Test links

https://deploy-preview-10562--docusaurus-2.netlify.app/

@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Oct 7, 2024
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Oct 7, 2024
@slorber slorber changed the title fix(core): Fix React rendering null chars in HTML output - Use renderToReadableStream fix(core): fix React rendering null chars in HTML output - Use renderToReadableStream Oct 7, 2024
Copy link

netlify bot commented Oct 7, 2024

[V2]

Name Link
🔨 Latest commit 9e57720
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6703d796f718730008fde549
😎 Deploy Preview https://deploy-preview-10562--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Oct 7, 2024

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO Report
/ 🟠 70 🟢 98 🟢 96 🟢 100 Report
/docs/installation 🟠 50 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 72 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 61 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🔴 48 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 64 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 73 🟢 100 🟢 100 🟠 86 Report

Copy link

github-actions bot commented Oct 7, 2024

Size Change: +238 B (0%)

Total Size: 11.1 MB

ℹ️ View Unchanged
Filename Size Change
website/.docusaurus/codeTranslations.json 2 B 0 B
website/.docusaurus/docusaurus.config.mjs 28 kB 0 B
website/.docusaurus/globalData.json 30.2 kB 0 B
website/.docusaurus/i18n.json 930 B 0 B
website/.docusaurus/registry.js 155 kB 0 B
website/.docusaurus/routes.js 74.3 kB 0 B
website/.docusaurus/routesChunkNames.json 81.7 kB 0 B
website/.docusaurus/site-metadata.json 2.17 kB 0 B
website/build/assets/css/styles.********.css 119 kB 0 B
website/build/assets/js/main.********.js 667 kB 0 B
website/build/assets/js/runtime~main.********.js 35.1 kB 0 B
website/build/blog.html 58.1 kB 0 B
website/build/blog/2017/12/14/introducing-docusaurus.html 72.2 kB -1 B (0%)
website/build/blog/2018/04/30/How-I-Converted-Profilo-To-Docusaurus.html 45.1 kB +11 B (+0.02%)
website/build/blog/2018/09/11/Towards-Docusaurus-2.html 49.4 kB -1 B (0%)
website/build/blog/2018/12/14/Happy-First-Birthday-Slash.html 28.6 kB -1 B (0%)
website/build/blog/2019/12/30/docusaurus-2019-recap.html 37.5 kB -2 B (-0.01%)
website/build/blog/2020/01/07/tribute-to-endi.html 32.1 kB -1 B (0%)
website/build/blog/2021/01/19/docusaurus-2020-recap.html 46.5 kB -1 B (0%)
website/build/blog/2021/03/09/releasing-docusaurus-i18n.html 42.9 kB -2 B (0%)
website/build/blog/2021/05/12/announcing-docusaurus-two-beta.html 45.2 kB -1 B (0%)
website/build/blog/2021/11/21/algolia-docsearch-migration.html 50.3 kB +11 B (+0.02%)
website/build/blog/2022/01/24/docusaurus-2021-recap.html 42.4 kB -1 B (0%)
website/build/blog/2022/08/01/announcing-docusaurus-2.0.html 134 kB -1 B (0%)
website/build/blog/2022/09/01/docusaurus-2.1.html 48.2 kB -2 B (0%)
website/build/blog/archive.html 23.1 kB 0 B
website/build/blog/authors.html 43.9 kB 0 B
website/build/blog/authors/j-marcey.html 61.9 kB 0 B
website/build/blog/authors/josh-cena.html 40.7 kB 0 B
website/build/blog/authors/lex-111.html 47.6 kB 0 B
website/build/blog/authors/slorber.html 58 kB 0 B
website/build/blog/authors/slorber/authors/2.html 61.8 kB 0 B
website/build/blog/authors/slorber/authors/3.html 73.6 kB 0 B
website/build/blog/authors/slorber/authors/4.html 42.1 kB 0 B
website/build/blog/authors/yangshun.html 54.8 kB 0 B
website/build/blog/authors/zpao.html 41.1 kB 0 B
website/build/blog/page/2.html 62.6 kB 0 B
website/build/blog/page/3.html 68.3 kB 0 B
website/build/blog/page/4.html 61.1 kB 0 B
website/build/blog/page/5.html 39.8 kB 0 B
website/build/blog/preparing-your-site-for-docusaurus-v3.html 132 kB +3 B (0%)
website/build/blog/releases/2.2.html 47.1 kB -1 B (0%)
website/build/blog/releases/2.3.html 57.9 kB -1 B (0%)
website/build/blog/releases/2.4.html 62.1 kB -1 B (0%)
website/build/blog/releases/3.0.html 107 kB +11 B (+0.01%)
website/build/blog/releases/3.1.html 49.5 kB 0 B
website/build/blog/releases/3.2.html 46.3 kB -1 B (0%)
website/build/blog/releases/3.3.html 52.9 kB -1 B (0%)
website/build/blog/releases/3.4.html 53.1 kB +6 B (+0.01%)
website/build/blog/releases/3.5.html 55.3 kB 0 B
website/build/blog/tags.html 26.7 kB 0 B
website/build/blog/upgrading-frontend-dependencies-with-confidence-using-visual-regression-testing.html 123 kB -1 B (0%)
website/build/docs.html 47 kB -1 B (0%)
website/build/docs/advanced.html 29.4 kB -1 B (0%)
website/build/docs/advanced/architecture.html 28.9 kB +3 B (+0.01%)
website/build/docs/advanced/client.html 72.7 kB -1 B (0%)
website/build/docs/advanced/plugins.html 56 kB -1 B (0%)
website/build/docs/advanced/routing.html 70.8 kB +7 B (+0.01%)
website/build/docs/advanced/ssg.html 77.8 kB -1 B (0%)
website/build/docs/api/docusaurus-config.html 194 kB -1 B (0%)
website/build/docs/api/misc/@docusaurus/eslint-plugin.html 45.7 kB +3 B (+0.01%)
website/build/docs/api/misc/@docusaurus/eslint-plugin/no-html-links.html 36 kB -1 B (0%)
website/build/docs/api/misc/@docusaurus/eslint-plugin/no-untranslated-text.html 34.9 kB -1 B (0%)
website/build/docs/api/misc/@docusaurus/eslint-plugin/prefer-docusaurus-heading.html 36.2 kB +3 B (+0.01%)
website/build/docs/api/misc/@docusaurus/eslint-plugin/string-literal-i18n-messages.html 39.8 kB -1 B (0%)
website/build/docs/api/misc/@docusaurus/logger.html 37.9 kB -1 B (0%)
website/build/docs/api/misc/create-docusaurus.html 33 kB -1 B (0%)
website/build/docs/api/plugin-methods.html 64.6 kB +3 B (0%)
website/build/docs/api/plugin-methods/extend-infrastructure.html 60.2 kB +3 B (0%)
website/build/docs/api/plugin-methods/i18n-lifecycles.html 58.1 kB +3 B (+0.01%)
website/build/docs/api/plugin-methods/lifecycle-apis.html 164 kB -1 B (0%)
website/build/docs/api/plugin-methods/static-methods.html 44.4 kB +3 B (+0.01%)
website/build/docs/api/plugins.html 29.9 kB -1 B (0%)
website/build/docs/api/plugins/@docusaurus/plugin-client-redirects.html 59.5 kB +12 B (+0.02%)
website/build/docs/api/plugins/@docusaurus/plugin-content-blog.html 189 kB -1 B (0%)
website/build/docs/api/plugins/@docusaurus/plugin-content-docs.html 194 kB +8 B (0%)
website/build/docs/api/plugins/@docusaurus/plugin-content-pages.html 74 kB -1 B (0%)
website/build/docs/api/plugins/@docusaurus/plugin-debug.html 48 kB -1 B (0%)
website/build/docs/api/plugins/@docusaurus/plugin-google-analytics.html 48.9 kB -1 B (0%)
website/build/docs/api/plugins/@docusaurus/plugin-google-gtag.html 48.5 kB -5 B (-0.01%)
website/build/docs/api/plugins/@docusaurus/plugin-google-tag-manager.html 47.3 kB -1 B (0%)
website/build/docs/api/plugins/@docusaurus/plugin-ideal-image.html 48.4 kB +3 B (+0.01%)
website/build/docs/api/plugins/@docusaurus/plugin-pwa.html 116 kB +3 B (0%)
website/build/docs/api/plugins/@docusaurus/plugin-sitemap.html 65.3 kB +5 B (+0.01%)
website/build/docs/api/plugins/@docusaurus/plugin-vercel-analytics.html 39.9 kB +11 B (+0.03%)
website/build/docs/api/themes.html 28.7 kB -1 B (0%)
website/build/docs/api/themes/@docusaurus/theme-classic.html 44 kB +3 B (+0.01%)
website/build/docs/api/themes/@docusaurus/theme-live-codeblock.html 36.6 kB +3 B (+0.01%)
website/build/docs/api/themes/@docusaurus/theme-mermaid.html 35.5 kB +3 B (+0.01%)
website/build/docs/api/themes/@docusaurus/theme-search-algolia.html 32.8 kB -1 B (0%)
website/build/docs/api/themes/configuration.html 243 kB -1 B (0%)
website/build/docs/blog.html 211 kB +5 B (0%)
website/build/docs/browser-support.html 48.4 kB -1 B (0%)
website/build/docs/category/getting-started.html 26.6 kB 0 B
website/build/docs/category/guides.html 34.5 kB 0 B
website/build/docs/cli.html 59.9 kB 0 B
website/build/docs/configuration.html 98.7 kB +7 B (+0.01%)
website/build/docs/create-doc.html 62.3 kB +11 B (+0.02%)
website/build/docs/creating-pages.html 56.4 kB 0 B
website/build/docs/deployment.html 203 kB +7 B (0%)
website/build/docs/docs-introduction.html 50.9 kB -1 B (0%)
website/build/docs/docs-multi-instance.html 75 kB +3 B (0%)
website/build/docs/docusaurus-core.html 236 kB -1 B (0%)
website/build/docs/guides/whats-next.html 30.9 kB -1 B (0%)
website/build/docs/i18n/crowdin.html 145 kB +11 B (+0.01%)
website/build/docs/i18n/git.html 78.8 kB +3 B (0%)
website/build/docs/i18n/introduction.html 48.3 kB -1 B (0%)
website/build/docs/i18n/tutorial.html 164 kB +12 B (+0.01%)
website/build/docs/installation.html 70.7 kB +4 B (+0.01%)
website/build/docs/introduction/index.html 280 B 0 B
website/build/docs/markdown-features.html 79.9 kB 0 B
website/build/docs/markdown-features/admonitions.html 113 kB +3 B (0%)
website/build/docs/markdown-features/assets.html 89.2 kB +1 B (0%)
website/build/docs/markdown-features/code-blocks.html 235 kB +3 B (0%)
website/build/docs/markdown-features/diagrams.html 53.1 kB +13 B (+0.02%)
website/build/docs/markdown-features/head-metadata.html 50.1 kB -1 B (0%)
website/build/docs/markdown-features/links.html 40.8 kB -1 B (0%)
website/build/docs/markdown-features/math-equations.html 90.5 kB +10 B (+0.01%)
website/build/docs/markdown-features/plugins.html 96.6 kB +7 B (+0.01%)
website/build/docs/markdown-features/react.html 138 kB +4 B (0%)
website/build/docs/markdown-features/tabs.html 142 kB -1 B (0%)
website/build/docs/markdown-features/toc.html 84.8 kB +3 B (0%)
website/build/docs/migration.html 40.7 kB +3 B (+0.01%)
website/build/docs/migration/v2.html 39.1 kB -1 B (0%)
website/build/docs/migration/v2/automated.html 40.4 kB -1 B (0%)
website/build/docs/migration/v2/manual.html 198 kB -1 B (0%)
website/build/docs/migration/v2/translated-sites.html 50.3 kB -1 B (0%)
website/build/docs/migration/v2/versioned-sites.html 64.2 kB -1 B (0%)
website/build/docs/migration/v3.html 209 kB 0 B
website/build/docs/playground.html 30.7 kB -1 B (0%)
website/build/docs/resources/index.html 325 B 0 B
website/build/docs/search.html 116 kB 0 B
website/build/docs/seo.html 88.7 kB +12 B (+0.01%)
website/build/docs/sidebar.html 130 kB +3 B (0%)
website/build/docs/sidebar/autogenerated.html 150 kB +12 B (+0.01%)
website/build/docs/sidebar/items.html 180 kB -1 B (0%)
website/build/docs/sidebar/multiple-sidebars.html 63.7 kB +3 B (0%)
website/build/docs/static-assets.html 53.4 kB +3 B (+0.01%)
website/build/docs/styling-layout.html 135 kB -1 B (0%)
website/build/docs/support/index.html 319 B 0 B
website/build/docs/swizzling.html 115 kB +13 B (+0.01%)
website/build/docs/team/index.html 310 B 0 B
website/build/docs/typescript-support.html 62.3 kB -1 B (0%)
website/build/docs/using-plugins.html 110 kB +12 B (+0.01%)
website/build/docs/versioning.html 83.1 kB +12 B (+0.01%)
website/build/index.html 35.8 kB 0 B

compressed-size-action

@slorber slorber marked this pull request as draft October 7, 2024 15:42
@slorber
Copy link
Collaborator Author

slorber commented Oct 7, 2024

Although it seems to work and fix the bug, we might not want to merge it.

See https://x.com/sebmarkbage/status/1843307069912543501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output HTML contains NULL chracters in at least CJK languages
2 participants