fix(core): avoid removing handle bounds on handle unmount (#1781)
* fix(core): avoid removing handle bounds on handle unmount Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> * chore(changeset): add Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --------- Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@vue-flow/core": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Prevent removal of handle bounds when `<Handle>` is unmounted.
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, onUnmounted, ref, toRef } from 'vue'
|
import { computed, onMounted, ref, toRef } from 'vue'
|
||||||
import type { HandleProps } from '../../types'
|
import type { HandleProps } from '../../types'
|
||||||
import { Position } from '../../types'
|
import { Position } from '../../types'
|
||||||
import { useHandle, useNode, useVueFlow } from '../../composables'
|
import { useHandle, useNode, useVueFlow } from '../../composables'
|
||||||
@@ -136,14 +136,6 @@ onMounted(() => {
|
|||||||
node.handleBounds[type.value] = [...(node.handleBounds[type.value] ?? []), nextBounds]
|
node.handleBounds[type.value] = [...(node.handleBounds[type.value] ?? []), nextBounds]
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
// clean up node internals
|
|
||||||
const handleBounds = node.handleBounds[type.value]
|
|
||||||
if (handleBounds) {
|
|
||||||
node.handleBounds[type.value] = handleBounds.filter((b) => b.id !== handleId)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
function onPointerDown(event: MouseEvent | TouchEvent) {
|
function onPointerDown(event: MouseEvent | TouchEvent) {
|
||||||
const isMouseTriggered = isMouseEvent(event)
|
const isMouseTriggered = isMouseEvent(event)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user