mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 15:07:55 -05:00
fix(edges): prevent autoconnect outgoing edges from response block (#2479)
This commit is contained in:
@@ -555,6 +555,7 @@ const WorkflowContent = React.memo(() => {
|
|||||||
const candidates = Object.entries(blocks)
|
const candidates = Object.entries(blocks)
|
||||||
.filter(([id, block]) => {
|
.filter(([id, block]) => {
|
||||||
if (!block.enabled) return false
|
if (!block.enabled) return false
|
||||||
|
if (block.type === 'response') return false
|
||||||
const node = nodeIndex.get(id)
|
const node = nodeIndex.get(id)
|
||||||
if (!node) return false
|
if (!node) return false
|
||||||
|
|
||||||
@@ -726,7 +727,9 @@ const WorkflowContent = React.memo(() => {
|
|||||||
) {
|
) {
|
||||||
if (existingChildBlocks.length > 0) {
|
if (existingChildBlocks.length > 0) {
|
||||||
// Connect to the nearest existing child block within the container
|
// Connect to the nearest existing child block within the container
|
||||||
|
// Filter out response blocks since they have no outgoing handles
|
||||||
const closestBlock = existingChildBlocks
|
const closestBlock = existingChildBlocks
|
||||||
|
.filter((b) => b.type !== 'response')
|
||||||
.map((b) => ({
|
.map((b) => ({
|
||||||
block: b,
|
block: b,
|
||||||
distance: Math.sqrt(
|
distance: Math.sqrt(
|
||||||
@@ -2048,7 +2051,9 @@ const WorkflowContent = React.memo(() => {
|
|||||||
|
|
||||||
if (existingChildBlocks.length > 0) {
|
if (existingChildBlocks.length > 0) {
|
||||||
// Connect from nearest existing child inside the container
|
// Connect from nearest existing child inside the container
|
||||||
|
// Filter out response blocks since they have no outgoing handles
|
||||||
const closestBlock = existingChildBlocks
|
const closestBlock = existingChildBlocks
|
||||||
|
.filter((b) => b.type !== 'response')
|
||||||
.map((b) => ({
|
.map((b) => ({
|
||||||
block: b,
|
block: b,
|
||||||
distance: Math.sqrt(
|
distance: Math.sqrt(
|
||||||
|
|||||||
Reference in New Issue
Block a user