Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
Repository: TanStack/query
Length of output: 40
🏁 Script executed:
Repository: TanStack/query
Length of output: 635
🏁 Script executed:
Repository: TanStack/query
Length of output: 678
🏁 Script executed:
Repository: TanStack/query
Length of output: 223
🏁 Script executed:
# Check the queryOptions.ts file to understand the enabled parameter type definition cat -n packages/vue-query/src/queryOptions.tsRepository: TanStack/query
Length of output: 4162
🏁 Script executed:
Repository: TanStack/query
Length of output: 843
🏁 Script executed:
Repository: TanStack/query
Length of output: 370
Add a type test for the predicate form
enabled: () => (query) => booleanto prevent regression.The current test coverage includes computed ref, ref, boolean, and a simple getter function returning
true. However, theEnabledtype also accepts a predicate function that receives the query object:(query) => boolean. Add a dedicated test case that validates this form through the getter—for example,enabled: () => (query) => boolean—to ensure full type coverage.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
Regarding the query predicate test suggestion: I tested it and found that the query predicate form (query) => boolean actually doesn't work with queryOptions - it throws a type error even on the current main branch. This seems to be a pre-existing limitation, not something introduced or changed by this PR.
This PR's scope is specifically fixing the regression from #10452 where ComputedRef, Ref, and plain boolean values stopped working. The added tests cover these cases.
If predicate support in queryOptions is desired, that would be a separate feature request/issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@byungsker, thanks for testing and clarifying! That's a good point — the predicate form(query) => booleanbeing unsupported inqueryOptionsis a pre-existing limitation unrelated to this PR. The existing tests you've added correctly cover the regression cases from#10452(ComputedRef,Ref, and plainboolean), and the scope of this PR is appropriate.Would you like me to open a follow-up GitHub issue to track adding predicate (
(query) => boolean) support toqueryOptionsas a separate feature request?✏️ Learnings added
🧠 Learnings used