-
Notifications
You must be signed in to change notification settings - Fork 344
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
onUnmounted called in keep-alive components #178
Comments
Reopening because after a bit of testing there really seems to be a lifecycle hook missing for this case. onUnmounted does not suffice. There need to be a hook that is called once the component is destroyed. |
The issue seems to be this line: composition-api/src/apis/lifecycle.ts Line 37 in 1672b6e
Where the hook of This was appearantly done on purpose by @liximomo "to increase compatibility with the rfc" (according to the commit message from the blame for that line), but it could be that this is no longer accurate, not sure from the top of my head. |
https://vue-composition-api-rfc.netlify.com/api.html#lifecycle-hooks states: |
Yeah I'd rate this a bug. The options API doesn't have a similar API, and there's nothing about |
When using keep-alive there does not seem to be a way to trigger something on destroyed. onUnmounted gets called every time I navigate away from that component, even though the component persists due to keep-alive. onDestroyed does not exist in the composition API. An oversight ?
(edit)
It is a nested component within other tabs that do not have keep-alive. I assumed in this case nested childs will get destroyed when navigating away from the parent component. I guess that isn't the case and so there is no need for an onDestroyed.The text was updated successfully, but these errors were encountered: