[vue-query] queryClient.fetchQuery passes getter options through without unwrapping
メンテナーはふだん 1 日以内に返信
@byungsker がすでに取り組んでいます。
2026年7月22日 から。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- frontend, testing-qa
調査の方向性
@tanstack/vue-query QueryClient.fetchQuery の実装と、そこから cloneDeepUnref を呼び出している箇所から始めます。PR #11103 にリンクされている対象のリグレッションテストを確認し、その後、getter が返すオプションオブジェクトが評価され、query-core に到達する前にアンラップされることを検証します。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
QueryClient.fetchQuery in @tanstack/vue-query has an overload that accepts getter-function options, but the runtime implementation currently passes that top-level function through to query-core instead of evaluating it first.
The overload allows this shape:
queryClient.fetchQuery(() => ({
queryKey: ["foo", ref("bar")],
queryFn,
}))
But the implementation calls cloneDeepUnref(options) directly. cloneDeepUnref unwraps refs and nested query-key getters, but it does not call a top-level function value. As a result, query-core receives the function itself instead of the resolved FetchQueryOptions object.
Your minimal, reproducible example
Focused regression test in the linked PR: https://github.com/TanStack/query/pull/11103/files#diff-3d6cc18a7ff7e8e5afb08c0e3cba8d9f3e08fb9c6f6c59f1f5f58dc12f3f8b8e
Minimal code shape:
import { QueryClient } from "@tanstack/vue-query"
import { ref } from "vue"
const queryClient = new QueryClient()
const queryFn = () => Promise.resolve("mock")
queryClient.fetchQuery(() => ({
queryKey: ["foo", ref("bar")],
queryFn,
}))
Steps to reproduce
- Create a Vue Query
QueryClient. - Call
queryClient.fetchQuerywith a getter function returningFetchQueryOptions. - Observe that the getter is not evaluated before delegating to query-core.
A focused test shows the current behavior clearly:
queryClient.fetchQuery(() => ({
queryKey: queryKeyRef,
queryFn: fn,
}))
expect(QueryClientOrigin.prototype.fetchQuery).toHaveBeenCalledWith({
queryKey: queryKeyUnref,
queryFn: fn,
})
Currently the received argument is [Function anonymous].
Expected behavior
queryClient.fetchQuery(() => options) should evaluate the top-level getter, then deep-unref the returned options object before passing it to query-core.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: N/A
- Runtime: Node.js v24.13.0
- Adapter: vue-query
- Vue runtimes tested: Vue 2 / Vue 2.7 / Vue 3
Tanstack Query adapter
vue-query
TanStack Query version
v5.101.4 / current main branch at commit 86bb8a6fb
TypeScript version
TypeScript 5.9.3 in the local repo; package type tests also passed across the repo's configured TS 5.4 through TS 6.0 matrix.
Additional context
I could not find an existing open issue or PR for this with these searches:
vue queryClient fetchQuery getter options cloneDeepUnreffetchQuery getter function options vue-query
- 主要言語
- TypeScript
- スター
- 50.6k
- フォーク
- 4.2k
- 平均マージ
- 9時間 50分
- マージ済み PR(30日)
- 310
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/query のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TanStack/query#12466 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
solid-query: STRICT_READ_UNTRACKED on Solid 2 — client()/options() read in component body (useMutation, useBaseQuery)再び着手できるかも @LeonxLJX が 77 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
TanStack/query#11358 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
select that throws for placeholderData brings back the selection of data removed by resetQueries対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 56/100
メンテナーはふだん 1 日以内に返信
-
Render loop since v5.105.2 when placeholderData, or its select result, is not referentially stableオープン
難易度 4/5 3〜5日 初心者へのやさしさ 54/100
メンテナーはふだん 1 日以内に返信
-
useQueries: stable combine returns a stale result when a query updates before setQueries runs対応中かも @sakaintp が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
TanStack/query#12626 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
inference/go type/feature
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
anomalyco/opencode#65148 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
truapi-release
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
paritytech/product-sdk#529 ·
メンテナーはふだん 1 日以内に返信
-
Add: Mansudae TVオープンapproved check:passed streams:add
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
devlikeapro/waha#2369 ·
メンテナーはふだん 5 日以内に返信