Retain $ServerOnly templates while HMR is active
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- babel, typescript, vite
- 领域
- build-system, tooling
调研方向
使用 pnpm install 和 pnpm dev 通过链接的 repro 重现该失败,然后编辑 src/App.tsx。从计算 needHmr 的客户端转换路径开始,将其编译器选项与显式的 omitServerOnlyTemplates 设置进行比较。完成的标准是 HMR 在没有模板错误的情况下更新 DOM,同时显式的用户设置仍然具有优先权。
由索引模型根据 Issue 内容生成。
描述
Summary
When an SSR application uses $ServerOnly on a component's root JSX element, the initial render and hydration succeed, but the first HMR update throws and leaves stale DOM.
[email protected] now defaults omitServerOnlyTemplates to true. During a client HMR re-evaluation, Solid Refresh calls the component outside the initial hydration pass, but the compiled component only calls getNextElement() and has no retained template.
Because vite-plugin-solid already determines needHmr, could it default omitServerOnlyTemplates to false for client transforms while HMR is active? An explicit user setting should presumably continue to win.
Reproduction
https://github.com/birkskyum/repro-solid-server-only-hmr
git clone https://github.com/birkskyum/repro-solid-server-only-hmr.git
cd repro-solid-server-only-hmr
pnpm install
pnpm dev
- Open http://localhost:4174.
- Change
edit me!insrc/App.tsxand save.
Actual
The DOM does not update, and the HMR evaluation throws:
TypeError: template is not a function
at getNextElement (.../solid-js/web/dist/dev.js)
at _$getNextElement (src/App.tsx)
at HMRComp.createMemo.name [as fn] (@solid-refresh)
Expected
The component hot-updates normally.
Control / proposed direction
The exact same edit succeeds when the compiler option is set explicitly:
solid({
ssr: true,
solid: { omitServerOnlyTemplates: false },
})
This appears to be needed only for the client transform when HMR is enabled; server and production transforms can keep omitting the template.
Versions
Downstream report: https://github.com/solidjs/solid-start/issues/1930
Relevant dom-expressions change: https://github.com/ryansolid/dom-expressions/commit/3774c790a9c3c8e2b2f2984f36be002ac612df34
- 主要语言
- TypeScript
- 星标
- 520
- 派生
- 70
- 平均合并
- 16 小时 4 分钟
- 30 天内合并 PR
- 34
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
solidjs/solid-vite-plugin 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
solidjs/solid-vite-plugin#205 · 1 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 76/100
solidjs/solid-vite-plugin#375 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 68/100
solidjs/solid-vite-plugin#369 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
solidjs/solid-vite-plugin#328 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 72/100
solidjs/solid-vite-plugin#262 · 2 条评论 ·
维护者通常 1 天内回复
查看 solidjs/solid-vite-plugin 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
openedx/frontend-app-authoring#3274 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
-
area/documentation status/need-triage
难度 1/5 1 小时以内 新手友好度 95/100
google-gemini/gemini-cli#29548 ·
维护者通常 1 天内回复
-
sdk-typescript vector-store
难度 2/5 半天 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复