-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix(useStorage): when used inside effectScope
, should not remove listener on component unmount (#4695)
#4717
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
base: main
Are you sure you want to change the base?
Conversation
…stener on component unmount (vueuse#4695)
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.
looks good to me. we have a few solutions floating around for this particular problem, so ill wait until @OrbisK or someone can review too
This is a bit tricky. I think our (Anthony's) initial expectation is that lifecycle hooks should work with effect scope by default (and dont change the context). There are some issues with that. I think we should open a discussion in vue now to get this straightened out. |
Hope this fix can be merged soon. I’m concerned about spending too much time discussing it, as my site has been struggling with the issue for six months.😂 |
Yeah, I think we can merge this an revistit it after we know a better solution 👍🏽 |
@OrbisK Is this ready to merge now? |
@FishHawk there is still a bug here (from before your PR) since we mistakenly setup the listeners in the component scope ( i opened #4730 to try fix both problems in one if we can get that PR approved, it'll likely replace this one. sorry for not letting you know sooner! it'd be super helpful if you could review the other PR and make sure it still fixes the problem you had here |
It's okay, as long as it can be fixed in the next version. This issue can cause storage to be cleared in the production environment |
Before submitting the PR, please make sure you do the following
fixes #123
).Description
When used in
effectScope
,useStorage
should continue to listen on storage even after the module is unmounted.tryOnMounted
should only be called wheninitOnMounted
is set.Fix #4695