Transform inline "use server" functions inside file-level "use server" files
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 50/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- react, typescript
- 领域
- build-system
调研方向
从内置的 Server Function transform 开始,跟踪它如何处理模块级的 "use server" 指令与内联的 "use server" 指令。使用 issue 中的示例作为复现,然后在可用的情况下检查现有的 transform 覆盖范围。当 outer 和 inner 都分别注册为 Server Functions,且返回 inner 会产生可序列化的服务器引用时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
The composability issue of file directive and inline directive is hinted in https://github.com/vitejs/vite-plugin-react/issues/1336 for use server/cache, but this is already an issue with same use server directives. Before jumping too focused on use server/cache composition, we should evaluate the design for use server separately.
It may be a low priority if it's not used in practice, but it's good to be aware that there's a general Next.js transform approach divergence.
EDIT: It turned out Next.js doesn't support fully due to runtime side issue:
https://github.com/hi-ogawa/reproductions/tree/main/next-rsc-returned-nested-action
Description
The built-in Server Function transform currently chooses between handling a module-level "use server" directive and handling inline "use server" directives. When a file has the module directive, it wraps the module exports but does not hoist and register explicitly annotated local functions inside those exports.
For example:
'use server'
export async function outer() {
async function inner() {
'use server'
return 'inner result'
}
return inner
}
outer is exported and inherits the module-level role. inner is local, so it does not inherit that role, but its own inline directive explicitly declares it as a Server Function. The expected result is that outer and inner are independently registered Server Functions and that calling outer can return inner as a serializable server reference.
The current transform registers only outer. It leaves inner as an ordinary nested function, including the inert directive string in its body. Returning that function through React therefore does not produce a registered server reference.
- 主要语言
- TypeScript
- 星标
- 1.2k
- 派生
- 287
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 21
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
vitejs/vite-plugin-react 的其他 Issue
-
plugin-rsc: a client reference's CSS is linked before the CSS of the chunks it imports (build)可能已有人在做 @wozhenbang2004 于 7 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
vitejs/vite-plugin-react#1570 ·
维护者通常 1 天内回复
-
[plugin-rsc] With two dev servers in one process, loadModule runs in the last server's environment未关闭
难度 4/5 3-5 天 新手友好度 57/100
vitejs/vite-plugin-react#1589 ·
维护者通常 1 天内回复
-
pending triage
难度 4/5 3-5 天 新手友好度 35/100
vitejs/vite-plugin-react#1581 ·
维护者通常 1 天内回复
-
[plugin-rsc] Build exits 0, but the app fails at runtime: a server action imported only by browser code is missing from the RSC build可能已有人在做 @NeilPant 于 4 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 48/100
vitejs/vite-plugin-react#1578 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 42/100
vitejs/vite-plugin-react#1577 ·
维护者通常 1 天内回复
查看 vitejs/vite-plugin-react 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
ardia-browser/ardia#4778 ·
维护者通常 1 天内回复
-
[M09] Silence parser misreads ffmpeg times in scientific notation (6.25e-05 → 6.25 s)可能已有人在做 @G-darshan-32 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
clipy-recorder/clipy#164 · 1 条评论 ·
-
bug from-app needs-triage
难度 2/5 1-3 小时 新手友好度 72/100
nightly-labs/openbot#18462 ·
维护者通常 1 天内回复
-
Fast and light shell approval "Always allow" button shows raw English backticks and scrambles commands in Arabic可能已有人在做 @tylerbea 今天认领。 未关闭agent-ui bug p3
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
[Bug] Windows: Ctrl+C / Ctrl+V not working in chat input box可能已有人在做 @PranavTJ-05 今天认领。 未关闭comp/desktop desktop/chat desktop/shell os/windows P2 type/bug
难度 2/5 1-3 小时 新手友好度 76/100
NousResearch/hermes-agent#161023 · 2 条评论 ·
维护者通常 1 天内回复