-
-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: @urql/vue - Allow getter syntax in useQuery
#3556
Comments
Sorry, I forgot about this. Because we don't really have a lot of Vue projects to test against, I'm not 100% convinced that this works, and don't have enough context to test the getter-based reactive primitives in action. So I'd appreciate some feedback on whether it's working as intended ❤️ |
Thanks ! But, well, I have to admit that not being used that much to npm packages dev I don't actually know how to test it ^^' |
@Neluji I've just merged the PR, which means that the |
Tested it in my project and it seems to work well! 👍🏻 |
Summary
In Vue, if we use component props in the
variable
object of theuseQuery
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 thevariable
object in atoRef
, using a getter function.Allowing to pass directly the getter function to the
variable
property, as VueUse is doing with theirMaybeRefOrGetter
type, would be more fluent.Proposed Solution
Check if the passed
variable
arg is a function, and if yes, unwrap it when needed (see VueUseuseFetch
composable and how they does it?)The text was updated successfully, but these errors were encountered: