[vue-query] queryClient.fetchQuery passes getter options through without unwrapping
I maintainer di solito rispondono entro 1 giorno
@byungsker ci sta già lavorando.
Dal 22/7/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- frontend, testing-qa
Direzione di ricerca
Inizia con l’implementazione di @tanstack/vue-query QueryClient.fetchQuery e la relativa chiamata a cloneDeepUnref. Esamina il test di regressione mirato collegato in PR #11103, quindi verifica che un oggetto di opzioni restituito da un getter venga valutato e decomposto prima di raggiungere query-core.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- TypeScript
- Stelle
- 50.6k
- Fork
- 4.2k
- Merge medio
- 9h 50m
- PR unite (30g)
- 310
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TanStack/query
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
TanStack/query#12466 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
solid-query: STRICT_READ_UNTRACKED on Solid 2 — client()/options() read in component body (useMutation, useBaseQuery)Forse di nuovo libera @LeonxLJX l’ha presa 77 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
TanStack/query#11358 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
select that throws for placeholderData brings back the selection of data removed by resetQueriesForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 56/100
I maintainer di solito rispondono entro 1 giorno
-
Render loop since v5.105.2 when placeholderData, or its select result, is not referentially stableAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
I maintainer di solito rispondono entro 1 giorno
-
useQueries: stable combine returns a stale result when a query updates before setQueries runsForse già presa @sakaintp l’ha presa 1 giorno fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
TanStack/query#12626 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di TanStack/query
Issue simili
-
inference/go type/feature
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
anomalyco/opencode#65148 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
truapi-release
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
paritytech/product-sdk#529 ·
I maintainer di solito rispondono entro 1 giorno
-
Add: Mansudae TVApertaapproved check:passed streams:add
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
devlikeapro/waha#2369 ·
I maintainer di solito rispondono entro 5 giorni