-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
feat: replace useQueryProvider with VueQueryPlugin #116
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/damianosipiuk/vue-query/HZL6L8wdrYth6JjnZ4fpqzQWxdHB |
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 635a7aa:
|
Codecov Report
@@ Coverage Diff @@
## main #116 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 13 14 +1
Lines 239 266 +27
Branches 45 51 +6
=========================================
+ Hits 239 266 +27
Continue to review full report at Codecov.
|
client = new QueryClient(clientConfig); | ||
} | ||
|
||
client.mount(); |
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 was wondering if we can track when the app is being destroyed to do unmounting.
@DamianOsipiuk Do you have any ideas?
As I understand mount
among other things adds event listener to do refetching on window focus. It's better to remove the listener once the app is destroyed. It can be especially important in cases when a page has multiple Vue applications (at my job we have an AngularJS app with multiple Vue apps within it)
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.
Relevant issue: vuejs/core#4516
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.
Thanks for the link! 👍
I there is a linked PR, hopefully it will land there soon 🤞
src/vue/vueQueryPlugin.ts
Outdated
app.unmount = function vueQueryUnmount() { | ||
client.unmount(); | ||
originalUnmount(); | ||
}; |
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.
nice trick!
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Before we can deprecate |
* feat: create VueQueryPlugin * docs: update Installation section * feat(plugin): vue2 plugin * feat(plugin): unmount hook * build: remove plugin, add external deps * test: vueQueryPlugin * docs: update some docs * fix: import type from core, export plugin options type * chore: update examples * feat: multiple clients support * fix: multi client support * refactor: query client key helper * docs: update custom clients page Co-authored-by: Alexey Antipov <antipov.alexei@gmail.com>
TODO:
Closes: #98
Closes: #112