Skip to content

Commit d900267

Browse files
committed
fix(ring): duplicate should clear original block
1 parent 145db9d commit d900267

File tree

1 file changed

+14
-1
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]

1 file changed

+14
-1
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2075,7 +2075,18 @@ const WorkflowContent = React.memo(() => {
20752075
...node,
20762076
selected: pendingSet.has(node.id),
20772077
}))
2078-
setDisplayNodes(resolveParentChildSelectionConflicts(withSelection, blocks))
2078+
const resolved = resolveParentChildSelectionConflicts(withSelection, blocks)
2079+
setDisplayNodes(resolved)
2080+
const selectedIds = resolved.filter((node) => node.selected).map((node) => node.id)
2081+
const { currentBlockId, clearCurrentBlock, setCurrentBlockId } =
2082+
usePanelEditorStore.getState()
2083+
if (selectedIds.length === 1 && selectedIds[0] !== currentBlockId) {
2084+
setCurrentBlockId(selectedIds[0])
2085+
} else if (selectedIds.length === 0 && currentBlockId) {
2086+
clearCurrentBlock()
2087+
} else if (selectedIds.length > 1 && currentBlockId) {
2088+
clearCurrentBlock()
2089+
}
20792090
return
20802091
}
20812092

@@ -2181,6 +2192,8 @@ const WorkflowContent = React.memo(() => {
21812192
setCurrentBlockId(selectedIds[0])
21822193
} else if (selectedIds.length === 0 && currentBlockId) {
21832194
clearCurrentBlock()
2195+
} else if (selectedIds.length > 1 && currentBlockId) {
2196+
clearCurrentBlock()
21842197
}
21852198
}
21862199
},

0 commit comments

Comments
 (0)