From 8cfbc89d23588c381b93c343cc51f86f8a016685 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sat, 17 Jul 2021 23:19:50 +0200 Subject: [PATCH] chore: remove some logs fix: inject store instance to handle component --- examples/DragNDrop/index.tsx | 1 - src/components/Handle/index.tsx | 19 +++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/examples/DragNDrop/index.tsx b/examples/DragNDrop/index.tsx index e8921b20..fe4eebaf 100644 --- a/examples/DragNDrop/index.tsx +++ b/examples/DragNDrop/index.tsx @@ -50,7 +50,6 @@ const DnDFlow = defineComponent({ }; elements.value.push(newNode); - console.log(elements.value); } }; diff --git a/src/components/Handle/index.tsx b/src/components/Handle/index.tsx index c345f879..28e5ce7b 100644 --- a/src/components/Handle/index.tsx +++ b/src/components/Handle/index.tsx @@ -1,7 +1,6 @@ -import { Connection, ElementId, Position } from '../../types'; +import { Connection, ElementId, Position, RevueFlowStore } from '../../types'; import { onMouseDown, ValidConnectionFunc } from './handler'; import { computed, defineComponent, inject, PropType } from 'vue'; -import store from '../../store'; const alwaysValid = () => true; @@ -39,10 +38,10 @@ const Handle = defineComponent({ } }, setup(props, { slots }) { - const pinia = store(); + const store = inject('store')!; const nodeId = inject('NodeIdContext') as ElementId; const isTarget = computed(() => props.type === 'target'); - const onConnect = computed(() => pinia.onConnect); + const onConnect = computed(() => store.onConnect); const onConnectExtended = (params: Connection) => { onConnect.value?.(params); @@ -54,17 +53,17 @@ const Handle = defineComponent({ event, props.id as string, nodeId, - pinia.setConnectionNodeId, - pinia.setConnectionPosition, + store.setConnectionNodeId, + store.setConnectionPosition, onConnectExtended, isTarget.value, props.isValidConnection, - pinia.connectionMode, + store.connectionMode, undefined, undefined, - pinia.onConnectStart, - pinia.onConnectStop, - pinia.onConnectEnd + store.onConnectStart, + store.onConnectStop, + store.onConnectEnd ); };