Describe the bug#
Hello,
since #10452 (v5.98.0) the queryOptions helper function does not work with non-getter enabled properties anymore.
I think I am running into the problem mentioned by CodeRabbit in the PR:
https://github.com/TanStack/query/pull/10452#discussion_r3068236648
Your minimal, reproducible example#
https://stackblitz.com/edit/tanstack-query-dd82rg7b?file=src%2Fmain.ts
Steps to reproduce#
This code throws a typescript error:
function createDefaultQueryOptions() {
const enabled = computed(() => true);
return queryOptions({
queryKey: ['key'],
queryFn: () => Promise.resolve(1),
enabled,
});
}
If I change the code to pass a getter as enabled or remove enabled from the options, it works again:
function createDefaultQueryOptions() {
return queryOptions({
queryKey: ['key'],
queryFn: () => Promise.resolve(1),
enabled: () => true,
});
}
Expected behavior#
It should work with non-getter enabled, e.g. with computed properties to allow dependent queries as described here.
How often does this bug happen?#
Every time
Screenshots or Videos#
Platform#
- OS: MacOs
- Chrome 146.0.7680.178
Tanstack Query adapter#
vue-query
TanStack Query version#
v5.99.0
TypeScript version#
v6.0.2
Additional context#
No response
I'd like to work on this! 🙋