diff --git a/packages/app/src/components/Editor/Flow/engine/Connectors/Connection.tsx b/packages/app/src/components/Editor/Flow/engine/Connectors/Connection.tsx index e746bec..62b907b 100644 --- a/packages/app/src/components/Editor/Flow/engine/Connectors/Connection.tsx +++ b/packages/app/src/components/Editor/Flow/engine/Connectors/Connection.tsx @@ -1,26 +1,20 @@ -import type {FlowConnection} from '../types'; -import {createMemo} from 'solid-js'; import {getSmoothStepPath, Position} from '@xyflow/system'; -import {getNodeContext} from '../store'; +import {createMemo, Show} from 'solid-js'; import {BaseEdge} from '../Edge/BaseEdge'; +import {getNodeContext} from '../store'; +import type {FlowConnection, FlowNode} from '../types'; import {connection} from './Connection.css'; export interface ConnectionProps { connection: FlowConnection; } -export function Connection(props: ConnectionProps) { - const {nodes, sceneRef} = getNodeContext(); - - const sourceNode = () => nodes[props.connection.source.nodeId]; - - const targetNode = () => nodes[props.connection.target.nodeId]; - +function ConnectionNode(props: {source: FlowNode; target: FlowNode}) { const path = createMemo(() => { - const startX = sourceNode().position.x + 250; - const startY = sourceNode().position.y + 25; - const endX = targetNode().position.x; - const endY = targetNode().position.y + 25; + const startX = props.source.position.x + 250; + const startY = props.source.position.y + 25; + const endX = props.target.position.x; + const endY = props.target.position.y + 25; const [path, labelX, labelY, offsetX, offsetY] = getSmoothStepPath({ sourceX: startX, sourceY: startY, @@ -28,8 +22,6 @@ export function Connection(props: ConnectionProps) { targetX: endX, targetY: endY, targetPosition: Position.Left, - // borderRadius: pathOptions?.borderRadius, - // offset: pathOptions?.offset, }); return { path, @@ -54,14 +46,29 @@ export function Connection(props: ConnectionProps) { > ); } + +export function Connection(props: ConnectionProps) { + const {nodes, sceneRef} = getNodeContext(); + + const sourceNode = () => { + return nodes[props.connection.source.nodeId]; + }; + + const targetNode = () => { + return nodes[props.connection.target.nodeId]; + }; + + return ( + + + + ); +} diff --git a/packages/app/src/components/Editor/store/editor.store.ts b/packages/app/src/components/Editor/store/editor.store.ts index 256deb3..d6f42b5 100644 --- a/packages/app/src/components/Editor/store/editor.store.ts +++ b/packages/app/src/components/Editor/store/editor.store.ts @@ -98,16 +98,15 @@ export const EditorStore = defineStore(() => ({ .extend((_, context) => { context.hooks.onInit(() => { const context = useContext(EditorContext)!; - _.initEditSession(context.source).then(); - // Support reactivity when using hybrid routing createEffect( on( () => context.source, source => { + console.log('context source', context.source); _.initEditSession(context.source).then(); }, - {defer: true}, + // {defer: true}, ), );