Subscribe on changes!

v-once and "unmount callbacks", possible memory leak?

avatar
Dec 22nd 2021

Version

3.2.26

Reproduction link

codesandbox.io

Steps to reproduce

  • click on the "toggle" button at least twice

What is expected?

Console statements saying that the "OtherCmponent" is unmounted/destroyed are shown along with the "mounted" statements.

What is actually happening?

Only the mount statements are shown


This was behaving differently in vue2, as the "destroy callbacks" were called, see: https://codesandbox.io/s/lingering-water-j7g43

This might also be related to this external issue: https://github.com/intlify/vue-i18n-next/issues/844 (I think I can see evidence of something similar with vue-router) and generally, it might introduce memory leaks when using Components that were not specifically written to account for the beforeUnmount/unmounted not being called.

Please do let me know if this is not an issue but just a documentation miss (is it specified somewhere or should it be?), or if this is just my misunderstanding.