Memory leak problem with (Dom Node) Download
Vue version
3.3.4
Link to minimal reproduction
Steps to reproduce
1 - Create 2 Component or 2 Route. 2 - One is just tag, other one is just
What is expected?
When Route changes or Component changes or v-if toggles, old one must be destroyed and not drop detached nodes in memory.
What is actually happening?
When Route changes or Component changes or v-if toggles, drops detached node, not cleanable and increases continues. (When i take heap snapshot this detached dom nodes reduces)
System Info
No response
Any additional comments?
// A.vue
<script setup lang="ts"></script>
<template>
<img src="https://brandonroberts.dev/assets/posts/astro-logo.jpg" />
</template>
<style scoped lang="scss"></style>
// B.vue
<script setup lang="ts"></script>
<template>
<video muted autoplay src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" />
</template>
<style scoped lang="scss"></style>
// App.vue
<template>
<KeepAlive>
<component :is="component" />
</KeepAlive>
</template>
<script setup lang="ts">
import { shallowRef } from "vue";
import A from "./A.vue";
import B from "./B.vue";
let route = 0;
const component = shallowRef(A_Page);
setInterval(() => {
if (route === 0) {
component.value = B;
route = 1;
} else {
component.value = A;
route = 0;
}
}, 1000);
</script>
<style scoped lang="scss"></style>
duplicate of https://github.com/vuejs/core/issues/5256