Skip to content

fix(vue-query): unwrap getter function for fetchQuery options - #11108

Closed
MaNaN1803 wants to merge 3 commits into
TanStack:mainfrom
MaNaN1803:fix-vue-query-fetch-options
Closed

fix(vue-query): unwrap getter function for fetchQuery options#11108
MaNaN1803 wants to merge 3 commits into
TanStack:mainfrom
MaNaN1803:fix-vue-query-fetch-options

Conversation

@MaNaN1803

@MaNaN1803MaNaN1803 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Fixes#11102

🎯 Changes

  • Evaluates function-form options in \ etchQuery\ before deep unref processing to support getter reactivity.
  • Note: The same getter evaluation support was also added to \invalidateQueries\ to ensure API consistency, extending the scope of the linked issue appropriately.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with \pnpm run test:pr.

🚀 Release Impact

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

Summary by CodeRabbit

  • New Features

    • Added support for providing fetchQuery options through a function, including reactive values.
  • Bug Fixes

    • Improved handling of reactive query options by consistently resolving and unwrapping values before execution.
    • Updated invalidateQueries option handling for more predictable reactive value support.

@coderabbitai

coderabbitaiBot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 92252337-e306-4ac4-b6df-c460e5d89631

📥 Commits

Reviewing files that changed from the base of the PR and between 10ac8bb and f52101c.

📒 Files selected for processing (1)
  • packages/vue-query/src/queryClient.ts

📝 Walkthrough

Walkthrough

QueryClient.invalidateQueries overloads now accept direct MaybeRefDeep values, while fetchQuery supports getter-form options and resolves them before deep unref processing and delegation.

Changes

QueryClient option handling

Layer / File(s)Summary
Update QueryClient overloads and option resolution
packages/vue-query/src/queryClient.ts
invalidateQueries removes function-returning overloads. fetchQuery adds function-form options and evaluates the getter before cloning, deep-unreffing, and forwarding the options.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • TanStack/query#11103: Modifies fetchQuery getter handling in the same Vue Query client implementation.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Out of Scope Changes check⚠️ WarningThe invalidateQueries type-surface change is unrelated to issue #11102 and goes beyond the fetchQuery-only objective.Remove the invalidateQueries API/type changes or move them to a separate PR if they are intentionally being shipped.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly describes the main change: unwrapping getter-function options for fetchQuery in vue-query.
Description check✅ PassedThe PR description includes the required Changes, Checklist, and Release Impact sections and is mostly complete.
Linked Issues check✅ PassedThe fetchQuery getter-option fix matches issue #11102 by evaluating the top-level function before deep-unrefing and forwarding resolved options.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/vue-query/src/queryClient.ts`:
- Around line 307-320: Widen the getter overload return types in
QueryClient.fetchQuery and QueryClient.invalidateQueries to MaybeRefDeep of
their respective options or filters, matching cloneDeepUnref’s supported nested
refs. In fetchQuery, remove the as any cast when passing unwrappedOptions to
super.fetchQuery; apply the corresponding invalidateQueries type changes as
well.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0dc7e1d8-b442-4866-a15e-410bb5055d1f

📥 Commits

Reviewing files that changed from the base of the PR and between 86bb8a6 and b0b72a3.

📒 Files selected for processing (1)
  • packages/vue-query/src/queryClient.ts

Comment threadpackages/vue-query/src/queryClient.ts Outdated
@MaNaN1803MaNaN1803 reopened this Jul 22, 2026
@TkDodo

Copy link
Copy Markdown
Collaborator

duplicate of #11103

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[vue-query] queryClient.fetchQuery passes getter options through without unwrapping

2 participants

@MaNaN1803@TkDodo