urql icon indicating copy to clipboard operation
urql copied to clipboard

RFC: @urql/vue - Allow getter syntax in `useQuery`

Open Neluji opened this issue 1 year ago • 0 comments

Summary

In Vue, if we use component props in the variable object of the useQuery composable, their reactivity is lost in the process and this results the same as if it was passed as a constant. To avoid this, the solution is to wrap the variable object in a toRef, using a getter function.

Allowing to pass directly the getter function to the variable property, as VueUse is doing with their MaybeRefOrGetter type, would be more fluent.

Proposed Solution

Check if the passed variable arg is a function, and if yes, unwrap it when needed (see VueUse useFetch composable and how they does it?)

Neluji avatar Apr 04 '24 09:04 Neluji