SSR / Pages that work without JavaScript

How GET, POST, and hydration share one owner map

Part of the pageOwnerBehavior without scripts
HTML documentfoldkit-ssr (SSR.render)Full page rendered from init
Server datafoldkit-remote (Data.satisfy, Remote.resume)Data already embedded in HTML
Search, filters, sort, pagefoldkit-mirror (Mirror.url)GET forms and links update the URL
Virtualized list windowfoldkit-mixins-ui (WindowList)One visible window paged by links
Mutations (such as add to cart)update via fallback: 'server'Form POST runs update on server
Scripted vs plain controlsStyle.media('(scripting: none)', …)Only plain HTML controls display
Cross-request stateYour app (cookie or database)Read in prepare, written in headers

Both scripted and unscripted paths share one Model, one update, and one view:

  1. GET /?q=acme&sort=PriceAscending: Mirror.reduce reads query params into init, prepare loads the cart cookie and runs Data.satisfy, and SSR.render emits HTML plus the resume envelope. When scripts boot, SSR.hydrate resumes that Model without re-fetching.
  2. POST /?q=acme (scripts off): SSR.entry verifies Origin, rebuilds the Model via init and prepare, decodes foldkit-plus-message, runs update(Message), writes the updated cookie header, and redirects (303) back to /?q=acme. With scripts on, the browser handles OnSubmit locally.

Six rules follow:

  1. Render every shown value in the HTML before sending the response.
  2. Keep GET state in the URL using Mirror.url and <form method="get">.
  3. Draw both scripted and plain controls and toggle them with CSS (scripting: none) rather than <noscript>.
  4. Page virtualized lists with links (WindowList.pageOf) so users can step through windows without JavaScript.
  5. Express mutations as rh.form submissions carrying a typed Message.
  6. Test both modes: verify the workflow with JavaScript disabled, and verify hydration produces zero warnings or form POSTs with JavaScript enabled.