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

Expose prerender() for SSG in stable #31298

Merged
merged 1 commit into from
Oct 20, 2024
Merged

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Oct 19, 2024

When we added renderToReadableStream we added the allReady helper to make it easier to do SSG rendering but it's kind of awkward to wire up that way. Since we're also discouraging renderToString in React 19 the cliff is kind of awkward. (As noted by Docusaurus.)

The idea of the react-dom/static prerender API was that this would be the replacement for SSG rendering. Awkwardly this entry point actually already exists in stable but it has only undefined exports.

Since then we've also added other useful heuristics into the prerender branch that makes this really the favored and easiest to use API for the prerender (SSG/ISR) use case.

prerender is also used for Partial Prerendering but that part is still experimental.

However, we can expose only the prerender API on react-dom/static without it returning the postponeState. Instead the stream is on prelude. The naming is a bit awkward if you don't consider resuming but it's the same thing.

It's really just renderToReadable stream with automatic allReady and better heuristics for prerendering.

Copy link

vercel bot commented Oct 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 19, 2024 6:30pm

@react-sizebot
Copy link

react-sizebot commented Oct 19, 2024

Comparing: 1839e14...c4c40ea

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 506.86 kB 506.86 kB = 90.71 kB 90.70 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 511.79 kB 511.79 kB = 91.42 kB 91.42 kB
facebook-www/ReactDOM-prod.classic.js = 604.26 kB 604.26 kB = 106.92 kB 106.92 kB
facebook-www/ReactDOM-prod.modern.js = 580.48 kB 580.48 kB = 103.01 kB 103.01 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-rc/react-dom/cjs/react-dom-server.node.production.js +1.71% 218.32 kB 222.06 kB +1.42% 40.19 kB 40.76 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.js +1.71% 218.32 kB 222.06 kB +1.42% 40.19 kB 40.76 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.js +1.71% 218.38 kB 222.12 kB +1.42% 40.21 kB 40.78 kB
oss-stable-rc/react-dom/cjs/react-dom-server.node.development.js +1.32% 353.62 kB 358.28 kB +1.37% 64.07 kB 64.95 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js +1.32% 353.62 kB 358.28 kB +1.37% 64.07 kB 64.95 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js +1.32% 353.68 kB 358.35 kB +1.41% 64.09 kB 64.99 kB
oss-stable-rc/react-dom/cjs/react-dom-server.browser.production.js +1.24% 217.99 kB 220.70 kB +0.45% 39.67 kB 39.85 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.js +1.24% 217.99 kB 220.70 kB +0.45% 39.67 kB 39.85 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.js +1.24% 218.06 kB 220.77 kB +0.45% 39.69 kB 39.87 kB
oss-stable-rc/react-dom/cjs/react-dom-server.edge.production.js +1.21% 222.81 kB 225.52 kB +0.45% 41.54 kB 41.73 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.production.js +1.21% 222.81 kB 225.52 kB +0.45% 41.54 kB 41.73 kB
oss-stable/react-dom/cjs/react-dom-server.edge.production.js +1.21% 222.88 kB 225.58 kB +0.44% 41.57 kB 41.75 kB
oss-stable-rc/react-dom/cjs/react-dom-server.browser.development.js +0.85% 359.00 kB 362.04 kB +0.25% 65.51 kB 65.68 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js +0.85% 359.00 kB 362.04 kB +0.25% 65.51 kB 65.68 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js +0.84% 359.07 kB 362.10 kB +0.28% 65.54 kB 65.72 kB
oss-stable-rc/react-dom/cjs/react-dom-server.edge.development.js +0.84% 359.48 kB 362.51 kB +0.25% 65.61 kB 65.77 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.development.js +0.84% 359.48 kB 362.51 kB +0.25% 65.61 kB 65.77 kB
oss-stable/react-dom/cjs/react-dom-server.edge.development.js +0.84% 359.54 kB 362.57 kB +0.28% 65.63 kB 65.82 kB

Generated by 🚫 dangerJS against 9b2632c

@sebmarkbage sebmarkbage merged commit d49123f into facebook:main Oct 20, 2024
184 checks passed
gnoff added a commit that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants