Devtools events lost when using Nitro v3 (worker_threads isolates globalThis)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- typescript, vite
调研方向
首先跟踪 globalThis.TANSTACK_EVENT_TARGET 周围的 EventClient 和 ServerEventBus,然后使用 issue 中描述的 nitro() Vite 插件和 Nitro v3 worker_threads 设置进行复现。比较 worker 与 Vite 主线程之间的边界,并验证服务端 Devtools 事件无需 HTTP workaround 即可到达面板。
由索引模型根据 Issue 内容生成。
描述
TanStack Devtools version
0.9.13
Framework/Library version
TanStack Start v1.149.3, Nitro v3.0.1-nightly
Describe the bug and the steps to reproduce it
When using TanStack Start with the nitro() Vite plugin (Nitro v3 nightly) rather than nitroV2Plugin, devtools events emitted from server code never reach the devtools panel.
The root cause is that Nitro v3's NodeEnvRunner runs server code in a worker_threads Worker during dev. EventClient dispatches events to globalThis.__TANSTACK_EVENT_TARGET__
inside the worker thread, but ServerEventBus is listening on a different globalThis.__TANSTACK_EVENT_TARGET__ in the Vite main thread. The events are emitted but never received.
This doesn't happen with nitroV2Plugin because that plugin is build-only — in dev, Start uses its own RunnableDevEnvironment which runs in-process and shares the same global scope.
Steps to reproduce:
- Set up a TanStack Start app using
nitro()(Nitro v3) instead ofnitroV2Plugin - Emit devtools events from server code (e.g. TanStack AI streaming, or any library using
@tanstack/devtools-event-client) - Open the devtools panel — server-side events are missing
Workaround:
We confirmed the issue by manually bridging events from the Nitro worker to the Vite process over HTTP — intercepting tanstack-dispatch-event on the worker's
globalThis.__TANSTACK_EVENT_TARGET__ and POSTing the payload to a Vite dev server middleware that re-dispatches it on the main thread's event target. This works but is hacky.
Apologies for the double-post — originally mentioned this in Discord, just filing here too since it might be easier to track.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
n/a
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
- 主要语言
- TypeScript
- 星标
- 499
- 派生
- 100
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 4
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/devtools 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 4/5 3-5 天 新手友好度 45/100
-
难度 3/5 1-2 天 新手友好度 74/100
查看 TanStack/devtools 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
bug v2
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/inspector#2458 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
难度 2/5 1-3 小时 新手友好度 70/100
carbon-design-system/ibm-products#9907 ·