query icon indicating copy to clipboard operation
query copied to clipboard

[vue-query] Callback for enabled does not provide query as parameter

Open Jak-Ch-ll opened this issue 6 months ago • 2 comments

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

  1. Open the console
  2. The parameter outerQuery in undefined

Expected behavior

The parameter outerQuery to be the query

Tanstack Query adapter

vue-query

TanStack Query version

5.51.21

Jak-Ch-ll avatar Aug 15 '24 16:08 Jak-Ch-ll