solid-query: STRICT_READ_UNTRACKED on Solid 2 — client()/options() read in component body (useMutation, useBaseQuery)
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 84/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- frontend
调研方向
从 packages/solid-query/src/useMutation.ts 和 packages/solid-query/src/useBaseQuery.ts 开始,这里会在 observer 初始化期间读取 client() 和 options()。使用 Solid 2 和提供的组件场景进行复现,然后选择预期的未跟踪或延迟初始化方案。当挂载使用 useMutation 或 useQuery 的组件不再产生库的 STRICT_READ_UNTRACKED 诊断时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
With Solid 2 (solid-js@2.0.0-rc.4) and @tanstack/solid-query@6.0.0-rc.1, every component that calls useMutation (and useQuery) logs a reactivity diagnostic on mount:
[STRICT_READ_UNTRACKED] Reactive value read directly in <UnitCard> will not update.
Move it into a tracking scope (JSX, a memo, or an effect's compute function).
[STRICT_READ_UNTRACKED] repair guide: node_modules/solid-js/skills/reactivity-diagnostics/SKILL.md
Solid 2 ships these diagnostics in dev builds, and they are meant to be actionable: the console is expected to stay clean. Right now a single screen with a handful of mutations produces dozens of them, which drowns out the diagnostics that are about application code.
Cause
The hooks read memos directly in the component body, outside any tracking scope.
packages/solid-query/src/useMutation.ts:
const client = createMemo(() => resolveClient())
const observer = new MutationObserver(client(), options()) // ← read in component body
packages/solid-query/src/useBaseQuery.ts does the same when it creates its observer:
const initialOptions = defaultedOptions()
const [observer, setObserver] = createSignal(
new Observer(client(), defaultedOptions()), // ← read in component body
)
Both reads are intentional one-shot initialisations, so the value genuinely does not need to be tracked — which is exactly the case Solid's untrack exists for. Under Solid 1 this was silent; Solid 2 reports it.
Your minimal, reproducible example
Any component calling useMutation reproduces it. The official Solid 2 fullstack template does it out of the box:
https://github.com/solidjs/templates/tree/main/solid-v2/fullstack-tanstack
src/routes/users.$id.tsx calls useMutation; open the page with a dev build of solid-js@2 and the diagnostic appears on every mount.
Steps to reproduce
- Use
solid-js@2.0.0-rc.4with@tanstack/solid-query@6.0.0-rc.1. - Render any component that calls
useMutation(oruseQuery). - Watch the browser console on mount.
Expected behavior
No reactivity diagnostics from library code — the initial reads of client() / options() are untracked by design and should say so.
Suggested fix
Wrap the initialisation reads in untrack(...), or move observer creation into a createRenderEffect / memo. A related Solid-specific fix was already made in #10445 (useQueryClient running inside createMemo).
Platform
@tanstack/solid-query6.0.0-rc.1 (latestrcon npm as of 2026-09-01)solid-js2.0.0-rc.4- Chromium 141, macOS
Note
Not filing a PR because I did not want to guess which of the two shapes (untrack vs. deferred observer creation) you prefer for v6 — happy to send one either way.
- 主要语言
- TypeScript
- 星标
- 50.3k
- 派生
- 4.2k
- 平均合并
- 22 小时 33 分钟
- 30 天内合并 PR
- 214
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/query 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 4/5 3-5 天 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 40/100
-
难度 4/5 3-5 天 新手友好度 48/100
-
难度 3/5 1-2 天 新手友好度 78/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
mksglu/context-mode#1200 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/claude-code#96687 ·
-
good first issue
难度 1/5 1 小时以内 新手友好度 95/100
AOSSIE-Org/DebateAI#582 · 2 条评论 ·