diff --git a/src/components/rightSidePanel/parameters/TabSubgraphInputs.test.ts b/src/components/rightSidePanel/parameters/TabSubgraphInputs.test.ts index a9d67b0848..3194ed775a 100644 --- a/src/components/rightSidePanel/parameters/TabSubgraphInputs.test.ts +++ b/src/components/rightSidePanel/parameters/TabSubgraphInputs.test.ts @@ -138,8 +138,8 @@ describe('TabSubgraphInputs drag-and-drop', () => { unmount() - expect(mockDraggableCleanup).toHaveBeenCalled() - expect(mockDropTargetCleanup).toHaveBeenCalled() + expect(mockDraggableCleanup).toHaveBeenCalledTimes(2) + expect(mockDropTargetCleanup).toHaveBeenCalledTimes(2) }) it('calls movePromotion with correct indices when an item is dropped', () => { diff --git a/src/components/rightSidePanel/parameters/TabSubgraphInputs.vue b/src/components/rightSidePanel/parameters/TabSubgraphInputs.vue index 2fc8e096a4..217e8112ca 100644 --- a/src/components/rightSidePanel/parameters/TabSubgraphInputs.vue +++ b/src/components/rightSidePanel/parameters/TabSubgraphInputs.vue @@ -177,7 +177,8 @@ function setDraggableState() { dropTargetForElements({ element: item, onDrop: ({ source }) => { - const fromIndex = source.data.index as number + const fromIndex = source.data.index + if (typeof fromIndex !== 'number') return if (fromIndex === index) return promotionStore.movePromotion( node.rootGraph.id, @@ -197,6 +198,7 @@ function setDraggableState() { watchDebounced(searchedWidgetsList, () => setDraggableState(), { debounce: 100 }) +watch(promotionEntries, () => nextTick(setDraggableState)) onMounted(() => setDraggableState()) onBeforeUnmount(() => cleanupDragAndDrop())