Skip to content
Source
Sign inSign up
TanStack/query

feat: support skipToken in imperative queries #12681

MergedTkDodomerged 5 commits intoquery-v6 fromrefs/pull/12681/headmerged by TkDodo View on GitHub

TkDodocommented

🎯 Changes

Stacked on #12679.

An explicit queryFn: skipToken makes queryClient.query() and queryClient.infiniteQuery() read the cache without starting or waiting for a fetch. The calls return existing data regardless of freshness and apply select when data exists. A cache miss resolves to undefined without creating an entry.

Calls whose options can contain skipToken return Promise<TData | undefined>. Calls whose options exclude the token keep Promise<TData>. Vue's reactive overloads follow the same rule.

Core and all seven adapter suites, type checks, and lint passed locally. Core and Vue package checks and docs link checks passed.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I have followed the AI contribution policy and fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).
    1. Pushede5f9b76

    2. Pushed6785aab

    3. Pushedcd26c1e

    4. TkDodo merged this7ff917a

    5. TkDodo closed this

Sign in to join this conversation.