-
-
Notifications
You must be signed in to change notification settings - Fork 48
fix(useQueries): fix handling of queries update. Accept Ref as an argument #105
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
fix(useQueries): fix handling of queries update. Accept Ref as an argument #105
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/damianosipiuk/vue-query/GasAQTXFz3hWdu7Zn5R2AH7hz7M4 |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 2215fa9:
|
|
Hi, thanks for the contribution! I don't have access to PC right now, so I will take a look at this PR at the beginning of next week. Hope that is ok. |
Sure, that's ok, take your time! Thanks for the quick response. |
68d0ca2 to
5541b15
Compare
cffe1a5 to
2215fa9
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
Codecov Report
@@ Coverage Diff @@
## main #105 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 13 13
Lines 210 213 +3
Branches 34 35 +1
=========================================
+ Hits 210 213 +3
Continue to review full report at Codecov.
|
| const queryClientKey = (unref(queries) as UseQueriesOptionsArg<T>)[0] | ||
| ?.queryClientKey; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to do the as UseQueriesOptionsArg<T> assertions because typescript apparently can't properly derive the return type of unref
It works totally fine in my IDE, no ts failures.
Maybe the failure come from the way Typescript works with Rollup: maybe it can't infer the type from the function and has to rely on the function type (which apparently is not enough)
|
🎉 This PR is included in version 1.16.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
@DamianOsipiuk thanks a lot for fast PR merges and new versions releases! 🙏 💪 |









Hi,
I noticed a bug in
useQuerieshook: if a query is deleted from the list of provided queries, it isn't reflected in the result. The result doesn't match queries anymore.This PR fixes the bug.
I also added a test which catches this problem.
Bonus: I made the function to accept Refs. I believe a common use case is constructing Queries as a computed value. This fix makes it possible to provide computed values
Lemme know what you think :)
Alexey