Skip to content
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

Open
Neluji opened this issue Apr 4, 2024 · 1 comment · May be fixed by #3582
Open

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

Neluji opened this issue Apr 4, 2024 · 1 comment · May be fixed by #3582
Labels
future 🔮 An enhancement or feature proposal that will be addressed after the next release

Comments

@Neluji
Copy link

Neluji commented Apr 4, 2024

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 Neluji added the future 🔮 An enhancement or feature proposal that will be addressed after the next release label Apr 4, 2024
@kitten
Copy link
Member

kitten commented May 3, 2024

Sorry, I forgot about this.
Just to clarify, we don't use Vue ourselves regularly, so we're happy to receive PRs for it (same as for anything really — as long as it's not a heavy RFC that we may not accept, which isn't the case here of course)

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 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future 🔮 An enhancement or feature proposal that will be addressed after the next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants