Repository navigation
Store prerendered calls as the live answer, so server components prerender - #11
Conversation
…s prerender The integration now replays each captured call's GET address through the crawl (new PrerenderContext.fetch) and stores the endpoint's response, headers included, instead of encoding the returned value itself. The client keeps the runtime's own reference and answers the send from the artifact through a transport fetch (staticFetch), so hydration adoption, server-component interception and decoding stay the runtime's. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkjGmX4hAoiU9VhXNt7j3E
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Artifacts lived at the same url in every build, so a CDN or browser cache
could serve the previous deploy's answer. The crawl now takes a buildId
(the Vite plugin mints one per process and defines it as
import.meta.env.PRERENDER_BUILD); integrations get it as context.buildId and
@solidjs/prerender writes _static/<build>/<label>.<key>.txt.
prerendered() installed staticFetch as the transport fetch, so it and an
app's own configureServerFunctionsClient({ fetch }) replaced each other by
order. On a runtime with wrapServerFunctionsFetch (solidjs/solid#4170) it now
installs a send layer instead, which composes in either order; older
runtimes keep the previous behavior.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NkjGmX4hAoiU9VhXNt7j3E
Instead of a global send layer, prerendered() declares the artifact send on
its reference (withMeta(fn, { fetch }), solidjs/solid#4170). The runtime
calls it for that function's requests with the app's transport fetch as
next, so the app's fetch is never displaced and carries the hybrid
fallback. Runtimes without reference sends wire staticFetch() by hand; on
current ones a wired staticFetch passes through, so artifacts are looked up
once.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NkjGmX4hAoiU9VhXNt7j3E
rc.16 ships reference sends (solidjs/solid#4170), so prerendered() serves artifacts on its own. The hand-wired staticFetch transport only existed for older runtimes; remove it along with its server stub and the test probe. Bump the SSG example and dev deps to rc.16 / router next.41. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkjGmX4hAoiU9VhXNt7j3E
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkjGmX4hAoiU9VhXNt7j3E
Requested by Ryan · project thread
Before: a server component wrapped in
prerendered()(return props => <jsx/>) was saved as anInternal Server Errorartifact, because the integration encoded the returned render function itself. Client navigation to it crashed in both static and hybrid builds. Hybrid never fell back to the server, since the bad artifact (or a host's 200 fallback page) didn't look like a miss. Page load also refetched every prerendered read the server had already rendered.After: the artifact is exactly what the app's server-function endpoint answers for the call's GET address, status and headers included. Server components, codec values and plain JSON all round-trip. Page load makes no request, and navigation fetches only the artifact. In hybrid mode, a missing artifact falls back to the live server through the app's own transport
fetch, even when the host answers with a 200 page. Artifacts are versioned by build, so a CDN never serves the previous deploy's answer. The app's transportfetchis never displaced.How:
prerender-crawlerPrerenderContext.fetch(input)sends a request through the crawl's own transport, paced like a page, and returns the raw response.buildIdoption reaches integrations ascontext.buildId. The Vite plugin mints one per process and defines it asimport.meta.env.PRERENDER_BUILD. It is per process rather than per plugin instance because a build can evaluate the config more than once.@solidjs/prerenderintegrationserverFunctionUrl, resolved in the app's realm).context.fetchand stores the response as_static/<build>/<label>.<key>.txt: a marker line with status and headers, followed by the body bytes.@solidjs/prerenderclientprerendered()returns the runtime's own GET reference and declares its own send:withMeta(fn, { fetch }), from feat(web): a server function reference can declare its own client send solid#4170 (released in rc.16). The send maps a prerendered call's GET address to its artifact and rebuilds the Response, and passes everything else tonext, the app's send.crypto.subtle), so the lookup reachesfetchin the same tick and hydration adoption keeps working.codecoption onserverFunctions()is removed.@solidjs/webmust be>=2.0.0-rc.16.Verified:
_static/<build>/artifacts, with no errors.next, checked earlier in this PR:/_server/datawhen the artifact is missing.Not covered: the hybrid server still runs
prerendered()functions live during SSR rather than reading the artifacts.Generated by Claude Code