Skip to content

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

Open
MaNaN1803 wants to merge 2 commits into
TanStack:mainfrom
MaNaN1803:fix-vue-query-fetch-options
Open

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

Conversation

@MaNaN1803

@MaNaN1803 MaNaN1803 commented Jul 22, 2026

Copy link
Copy Markdown

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).

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

QueryClient.invalidateQueries and fetchQuery now evaluate function-form inputs before reactive values are unwrapped and options are forwarded to TanStack Query.

Changes

QueryClient option unwrapping

Layer / File(s) Summary
Resolve function-form query options
packages/vue-query/src/queryClient.ts
invalidateQueries resolves function-form filters and options, while fetchQuery accepts and evaluates function-form options before deep unref processing and delegation.

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

Possibly related PRs

Suggested labels: package: vue-query

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning invalidateQueries getter support was added even though #11102 only requests a fetchQuery fix. Move the invalidateQueries change to a separate PR or document it as part of the linked issue's scope before merging.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The fetchQuery getter evaluation and deep-unref behavior matches #11102's requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly summarizes the main fix for fetchQuery option getter unwrapping.
Description check ✅ Passed The description follows the required template and includes changes, checklist items, and release impact.
✨ 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.

@coderabbitai coderabbitai Bot 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 thread packages/vue-query/src/queryClient.ts Outdated
@MaNaN1803 MaNaN1803 closed this Jul 22, 2026
@MaNaN1803 MaNaN1803 reopened this Jul 22, 2026
Sign up for free to 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

1 participant