Repository navigation
The landing page, the templates gallery and the Angular page are sent as static HTML, and the browser takes each over as it was sent (0243) - #360
Merged
Conversation
… as static HTML, and the browser takes each over as it was sent (0243) The site's build now renders every page it builds into its root, using 0242's prerender step from one render module, src/render.tsx. Every entry takes the markup over through one mount(): hydrateRoot over the markup, createRoot on the dev server. ?og replaces the page with the share card. A crawler or link preview that runs no script now reads each page's words, links and modules' terms, not only its head. build:web refuses a page whose root holds no page, or whose markup carries a style attribute, which the site's policy refuses and hydration would not write again. render.test.tsx renders each page as Node does, without browser globals and at another time and zone, then hydrates it in React's development build. The browser gate reads the pages from the build and fails one that React drew again instead of taking it over.
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The landing page, the templates gallery and the Angular page were each an empty
<div id="root">that a script drew into. A crawler or link preview that runs no script read only the head. It missed the landing page's argument, its section on the paid modules with their terms, its footer links, every template and the Angular page's code. 0242 rendered only the product pages and listed these three as debt.What changes:
apps/site/src/render.tsxreplacesproduct-render.tsxand lists every page of the site's build inSTATIC_PAGES.prerender.mjs, the step 0242 added, writes each page into its root.mount(src/mount.tsx). It useshydrateRootover the markup with the same<StrictMode>tree, andcreateRooton the dev server, where the root is empty.?ogempties the root and draws the card.<noscript>line says what needs the script.Constraint: the site's policy admits no style attribute. A style in a page's first render is therefore refused when the page is parsed, and hydration does not write it again. Such a style has to be a class.
Guards, each watched failing on a planted fault:
pnpm build:webrefuses a page whose root holds no page, or whose markup carries a style attribute.apps/site/src/render.test.tsxrenders each page as Node does: no browser globals, at another time and in another time zone. It then hydrates the page in React's development build with a media query and observers present, and fails on anything React reports.pnpm test:browserreads the pages from the build. It fails a page whose top-level elements are not the ones the server sent, or that threw or logged an error, and checks that the examples, the journey and?ogstill work.Cost, measured 2026-11-26 (gzip level 9):
Not covered: React's production build silently keeps an attribute that differs between markup and first render for a reason none of the tests models, for example ICU or the visitor's language (§11). No
@formancy/*package changes.