Skip to content

Commit ce1647a

Browse files
committed
feat(core): cleanup handle bounds from node when handle is unmounted
1 parent 5e78795 commit ce1647a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/core/src/components/Handle/Handle.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" setup>
22
import { toRef, until } from '@vueuse/core'
3-
import { computed, ref } from 'vue'
3+
import { computed, onBeforeUnmount, ref } from 'vue'
44
import type { HandleProps } from '../../types/handle'
55
import { Position } from '../../types'
66
import { useHandle, useNode, useVueFlow } from '../../composables'
@@ -131,6 +131,14 @@ until(() => node.initialized)
131131
node.handleBounds[type.value] = [...(node.handleBounds[type.value] ?? []), nextBounds]
132132
})
133133
134+
onBeforeUnmount(() => {
135+
// clean up node internals
136+
const handleBounds = node.handleBounds[type.value]
137+
if (handleBounds) {
138+
node.handleBounds[type.value] = handleBounds.filter((b) => b.id !== handleId.value)
139+
}
140+
})
141+
134142
function onPointerDown(event: MouseEvent | TouchEvent) {
135143
const isMouseTriggered = isMouseEvent(event)
136144

0 commit comments

Comments
 (0)