Skip to content

Commit b7144ea

Browse files
committed
Deduplicate slots/widgets
1 parent fe1b61d commit b7144ea

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/components/graph/vueNodes/NodeSlots.vue

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
⚠️ Node Slots Error
44
</div>
55
<div v-else class="lg-node-slots flex justify-between">
6-
<div v-if="nodeInfo?.inputs?.length" class="flex flex-col">
6+
<div v-if="filteredInputs.length" class="flex flex-col">
77
<div
8-
v-for="(input, index) in nodeInfo.inputs"
8+
v-for="(input, index) in filteredInputs"
99
:key="`input-${index}`"
1010
class="text-xs text-gray-300"
1111
>
1212
{{ getInputName(input, index) }}
1313
</div>
1414
</div>
1515

16-
<div v-if="nodeInfo?.outputs?.length" class="flex flex-col ml-auto">
16+
<div v-if="filteredOutputs.length" class="flex flex-col ml-auto">
1717
<div
18-
v-for="(output, index) in nodeInfo.outputs"
18+
v-for="(output, index) in filteredOutputs"
1919
:key="`output-${index}`"
2020
class="text-xs text-gray-300 text-right"
2121
>
@@ -48,6 +48,23 @@ const props = defineProps<NodeSlotsProps>()
4848
4949
const nodeInfo = computed(() => props.nodeData || props.node)
5050
51+
// Filter out input slots that have corresponding widgets
52+
const filteredInputs = computed(() => {
53+
if (!nodeInfo.value?.inputs) return []
54+
55+
return nodeInfo.value.inputs.filter((input) => {
56+
// Check if this slot has a widget property (indicating it has a corresponding widget)
57+
if (isSlotObject(input) && 'widget' in input && input.widget) {
58+
// This slot has a widget, so we should not display it separately
59+
return false
60+
}
61+
return true
62+
})
63+
})
64+
65+
// Outputs don't have widgets, so we don't need to filter them
66+
const filteredOutputs = computed(() => nodeInfo.value?.outputs || [])
67+
5168
const getInputName = (input: unknown, index: number): string => {
5269
if (isSlotObject(input) && input.name) {
5370
return input.name

0 commit comments

Comments
 (0)