Skip to content

Commit 6bccf35

Browse files
authored
fix: dispose flame graph on unmounted (#20)
1 parent 0a6778a commit 6bccf35

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

packages/devtools/src/app/components/chart/ModuleFlamegraph.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import type { TreeNodeInput } from 'nanovis'
33
import type { ModuleInfo, SessionContext } from '~~/shared/types'
44
import { Flamegraph, normalizeTreeNode } from 'nanovis'
5-
import { computed, defineProps, nextTick, onMounted, ref, shallowRef, useTemplateRef, watch } from 'vue'
5+
import { computed, defineProps, nextTick, onMounted, onUnmounted, ref, shallowRef, useTemplateRef, watch } from 'vue'
66
77
const props = defineProps<{
88
info: ModuleInfo
@@ -99,9 +99,10 @@ function disposeFlamegraph() {
9999
100100
onMounted(() => {
101101
buildFlamegraph()
102-
return () => {
103-
disposeFlamegraph()
104-
}
102+
})
103+
104+
onUnmounted(() => {
105+
disposeFlamegraph()
105106
})
106107
107108
watch(tree, async () => {

0 commit comments

Comments
 (0)