xyflow / xyflow

React Flow | Svelte Flow - Powerful open source libraries for building node-based UIs with React (https://reactflow.dev) or Svelte (https://svelteflow.dev). Ready out-of-the-box and infinitely customizable.
https://xyflow.com
MIT License
21.54k stars 1.43k forks source link

The edge style is wrong when dragging #4227

Closed da-du closed 2 weeks ago

da-du commented 2 weeks ago

Describe the Bug

I set the edge type to 'step', but when dragging, the edge is not of type 'step'

defaultEdgeOptions={{
      type: 'step',
      style: {
          stroke: theme.colors.pattern.text.secondary,
      },
      markerEnd: {
          type: MarkerType.ArrowClosed,
          width: 20,
          height: 20,
      },
  }}

image

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

1.set defaultEdgeOptions, type: 'step', 2.Create new connections between nodes

Expected behavior

The edge type is 'step'

Screenshots or Videos

No response

Platform

Additional context

No response

bcakmakoglu commented 2 weeks ago

An edge and a connection line are two different things, hence why defaultEdgeOptions will not change the style/type of a connection line. Edges are established connections between two nodes. Connection Lines are lines that are drawn to establish a connection between two nodes (in other words, the connection has not yet been created).

There's a separate set of props for connection lines (besides using your own custom connection line).

In your case you would want to use something like this

<ReactFlow connectionLineType={ConnectionLineType.Step} connectionLineStyle={{ stroke: theme.colors.pattern.text.secondary, }} {...rest}>