You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since v5.48.0 and the changes in #7566 the enabled property for TanStack Query in general does accept a callback function, which provides the the query as argument.
Sadly this does not work with vue-query, as vue-query did already accept a getter since #6018, which does not provide the query. It technically is possible to return a function from the getter and that one will provide the query, but that does not fit the current types and docs. In addition it seems to run unnecessarily often, as you can see in my example repro.
This would only work if we also change the querytype to be optional.
Otherwise it's a chicken and the egg problem.
First time when enabled getter would be run, we do not have observer yet and query might also not exist.
Describe the bug
Since v5.48.0 and the changes in #7566 the
enabled
property for TanStack Query in general does accept a callback function, which provides the the query as argument.Sadly this does not work with vue-query, as vue-query did already accept a getter since #6018, which does not provide the query. It technically is possible to return a function from the getter and that one will provide the query, but that does not fit the current types and docs. In addition it seems to run unnecessarily often, as you can see in my example repro.
Your minimal, reproducible example
https://stackblitz.com/edit/vitejs-vite-dt8byq?file=src%2FApp.vue
Steps to reproduce
outerQuery
inundefined
Expected behavior
The parameter
outerQuery
to be the queryTanstack Query adapter
vue-query
TanStack Query version
5.51.21
The text was updated successfully, but these errors were encountered: