-
-
Notifications
You must be signed in to change notification settings - Fork 48
fix: change from onUnmount to onScopeDispose hook #179
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
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/damianosipiuk/vue-query/8czX4Do5Gr1Y66PUvzrFPvBLbweK |
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 a54a999:
|
Codecov Report
@@ Coverage Diff @@
## main #179 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 17 17
Lines 405 405
Branches 67 67
=========================================
Hits 405 405
Continue to review full report at Codecov.
|
This seems to fail with nuxt2 - codesandbox.io/s/damianosipiuk-vue-query-jwysrg |
@DamianOsipiuk Hello again - oops, Aprat from the test suite, I've only tested the basic example - Good catch :) I've fixed the issues - hopefully :) . Also I've rolled back some changes that are not that important to reduce some overhead. I've also illustrated the issue here The posts are reactive unless you hide/show them again, then they lose the reactivity (due to unmounted hook being called when they are hidden) |
Hmm i think there are few things to notice
|
Good point with vue2 - I was investigating further and it seems the problem with not finding the Regarding the points mentioned later, I really appreciate the explanation. I see If I need to have a single app-wide accessible state, using a store like Similarly, for async state, Now for the example - it is kinda long, so
You see, how both of these issues can be easily solved by embedding the queries in the store itself. Anyway, I am really thankful that you are considering this suggestion, and feel free to ask anything, or suggest a different setup. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Kudos, SonarCloud Quality Gate passed! |
Hi, sorry for the delay 🙄 |
No worries, I understand that this is an open source project and our time is limited. Thank you as well - if you find any issues - let me know :) |
🎉 This PR is included in version 1.23.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Replacing
onUnmounted
withonScopeDispose
hook will allow better integration and composability with 3rd party libraries that are creating a custom effect scope, that is not tied to the component lifetime (e.g. Pinia)If you need more info, let me know - or check out the docs
I've marked this change as a fix, as this should be perfectly backwards compatible. Let me know if we also need to include a special test or sample for this functionality, and how would you want it to look like.