fix(node-toolbar): set default value for isVisible to undefined (#1785)

* fix(node-toolbar): set default value for isVisible to undefined

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:
Braks
2025-03-09 10:10:38 +01:00
parent dd9c92ff81
commit 2ba98efef0
2 changed files with 8 additions and 2 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { computed, inject, toRef } from 'vue'
import { computed, inject } from 'vue'
import type { GraphNode, Rect, ViewportTransform } from '@vue-flow/core'
import { NodeIdInjection, Position, getRectOfNodes, useVueFlow } from '@vue-flow/core'
@@ -10,6 +10,7 @@ const props = withDefaults(defineProps<NodeToolbarProps>(), {
position: Position.Top,
offset: 10,
align: 'center',
isVisible: undefined,
})
const contextNodeId = inject(NodeIdInjection, null)
@@ -30,7 +31,7 @@ const nodes = computed(() => {
}, [] as GraphNode[])
})
const isActive = toRef(() =>
const isActive = computed(() =>
typeof props.isVisible === 'boolean'
? props.isVisible
: nodes.value.length === 1 && nodes.value[0].selected && getSelectedNodes.value.length === 1,