Removing elements that have been mounted


I am wondering if there is any need for a clean up e.g. unmounting when an element is removed from the DOM that has been mounted before.

With a page that does partial updates e.g. replacing the contents of certain elements, is there a need to unmount all vue apps contained in that content before the replace happens?

I tried to observe the heap if I can see anything that would cause a memory leak but I couldn’t really find anything, to me it looks like the reference is actually bound to the element which leads me to think that removing the element would also remove the reference to the app, assuming that no references have been stored somewhere (intentionally or unintentionally) manually of course.

I just try to get a general understanding what the consequences would be if the mounted element gets removed from the DOM.

I assume that before removing/replacing, one should probably unmount all elements that have a data attribute “data-v-app” or what would be the best way to deal with partial updates on a page that does only use vue in widget-like scenarios?

Version: 3.2.33