[Content]: Prerender recipe bakes `Loading` fallbacks into static HTML unless `renderMode: "async"` is set
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
阅读渲染模式指南中的“Prerendered at build time”部分,以及 Vite 插件参考中的 renderMode 类型。更新 prerender 配方,使用 renderMode: "async",并解释为什么数据仍在加载时它会影响静态 HTML。配方和说明反映 issue 中描述的行为后,即视为完成。
由索引模型根据 Issue 内容生成。
描述
📚 Subject area/topic
Guides (Choose a rendering mode)
📋 Page(s) affected (or suggested, for new content)
https://docs.solidjs.com/guides/choose-a-rendering-mode (section "Prerendered at build time")
Related: https://docs.solidjs.com/reference/vite-plugin-solid/start lists renderMode?: "stream" | "async" in its type but has no section for it.
📋 Description of content that is out-of-date or incorrect
The prerender recipe configures solid({ start: true, ssr: true, serverFunctions: true }), so pages are prerendered with the default renderMode: "stream". The guide then says "What the user sees first is the complete page, as with SSR."
That only holds when a page's data settles before the shell is ready. When the data is still loading at that point, the static file is written with the Loading fallback in place and the content in a <template> plus a swap script. A crawler or a browser with scripts disabled sees the fallback instead of the content. With start: { renderMode: "async" } the same file contains the content and no fallback.
The @solidjs/vite-plugin README describes this under renderMode ("a client that never runs JavaScript — a crawler, curl, a browser with scripts disabled — is left looking at the fallbacks forever", solidjs/solid#3280), but the docs site doesn't.
Measured on solid-js / @solidjs/web 2.0.3, @solidjs/vite-plugin 3.0.1, prerender-crawler 0.3.0, vite 8.3.8, Node 24.21.0:
start.renderMode |
visible text of dist/client/users/1/index.html without JS |
<template id="pl-…"> |
|---|---|---|
default ("stream") |
Home Users Loading… |
1 |
"async" |
Home Users Users Ada Lovelace First programmer Next user |
0 |
Proposed fix: set renderMode: "async" in the recipe and add a few lines explaining why. I have a PR ready.
A possible alternative in code: the crawl could ask for a complete document per call (start mode's handleRequest(request, { renderMode: 'async' }) already supports that), but the crawler calls the handler with the request only today.
🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)
Steps (local, not StackBlitz):
pnpm create solid@latest -t basic --solid --ts --ssr --no-devtools, thenpnpm add -D prerender-crawler. (With create-solid 0.13.0 you also need to rename the generatedstart: { node: true }tonodeServer: true.)- In
vite.config.ts, addprerender({ mode: 'static', pages: ['/users/1'], crawlLinks: false })fromprerender-crawler/vite. - In
src/routes/users/[id].tsx, addawait new Promise((r) => setTimeout(r, 50));at the top ofgetUser, standing in for a real fetch. pnpm buildand opendist/client/users/1/index.htmlwith JavaScript disabled: it shows "Loading…".- Add
renderMode: 'async'tostartand build again: the user's name and title are in the HTML.
- 主要语言
- MDX
- 星标
- 291
- 派生
- 369
- 平均合并
- 1 天 1 小时
- 30 天内合并 PR
- 39
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
solidjs/solid-docs 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
solidjs/solid-docs#1716 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
solidjs/solid-docs#1635 ·
维护者通常 1 天内回复
-
[Content]: Cloudflare Workers可能已有人在做 @Janani-bn 于 52 天前认领。 未关闭good first issue solid solidstart
难度 2/5 1-3 小时 新手友好度 62/100
solidjs/solid-docs#1522 · 1 条评论 ·
维护者通常 1 天内回复
-
[Content]: v2 Store documentation is unclear on class instances可能已有人在做 @LadyBluenotes 于 14 天前认领。 未关闭pending review
solidjs/solid-docs#1687 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[Content]: Add a concrete DOM-binding example to fine-grained reactivity可能重新可做 @LadyBluenotes 于 85 天前认领,目前没有进行中的 PR。 未关闭pending review
solidjs/solid-docs#1637 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 solidjs/solid-docs 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
needs discussion
难度 2/5 1-3 小时 新手友好度 78/100
openfga/openfga.dev#1436 · 1 条评论 ·
维护者通常 2 天内回复
-
documentation
难度 1/5 1 小时以内 新手友好度 86/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#335 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
-
难度 1/5 1-3 小时 新手友好度 84/100