Skip to content

Commit 0f21fbf

Browse files
authored
fix(dropdown): simplify & fix tag dropdown for parallel & loop blocks (#634)
* fix(dropdown): simplify & fix tag dropdown for parallel & loop blocks * fixed build
1 parent 3e45d79 commit 0f21fbf

File tree

3 files changed

+232
-189
lines changed

3 files changed

+232
-189
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/connection-blocks/connection-blocks.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { RepeatIcon, SplitIcon } from 'lucide-react'
12
import { Card } from '@/components/ui/card'
23
import { cn } from '@/lib/utils'
34
import {
@@ -77,8 +78,20 @@ export function ConnectionBlocks({
7778
// Get block configuration for icon and color
7879
const blockConfig = getBlock(connection.type)
7980
const displayName = connection.name // Use the actual block name instead of transforming it
80-
const Icon = blockConfig?.icon
81-
const bgColor = blockConfig?.bgColor || '#6B7280' // Fallback to gray
81+
82+
// Handle special blocks that aren't in the registry (loop and parallel)
83+
let Icon = blockConfig?.icon
84+
let bgColor = blockConfig?.bgColor || '#6B7280' // Fallback to gray
85+
86+
if (!blockConfig) {
87+
if (connection.type === 'loop') {
88+
Icon = RepeatIcon as typeof Icon
89+
bgColor = '#2FB3FF' // Blue color for loop blocks
90+
} else if (connection.type === 'parallel') {
91+
Icon = SplitIcon as typeof Icon
92+
bgColor = '#FEE12B' // Yellow color for parallel blocks
93+
}
94+
}
8295

8396
return (
8497
<Card

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-block-connections.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,8 @@ export function useBlockConnections(blockId: string) {
104104
// Get the response format from the subblock store
105105
const responseFormatValue = useSubBlockStore.getState().getValue(sourceId, 'responseFormat')
106106

107-
let responseFormat
108-
109107
// Safely parse response format with proper error handling
110-
responseFormat = parseResponseFormatSafely(responseFormatValue, sourceId)
108+
const responseFormat = parseResponseFormatSafely(responseFormatValue, sourceId)
111109

112110
// Get the default output type from the block's outputs
113111
const defaultOutputs: Field[] = Object.entries(sourceBlock.outputs || {}).map(([key]) => ({
@@ -140,10 +138,8 @@ export function useBlockConnections(blockId: string) {
140138
.getState()
141139
.getValue(edge.source, 'responseFormat')
142140

143-
let responseFormat
144-
145141
// Safely parse response format with proper error handling
146-
responseFormat = parseResponseFormatSafely(responseFormatValue, edge.source)
142+
const responseFormat = parseResponseFormatSafely(responseFormatValue, edge.source)
147143

148144
// Get the default output type from the block's outputs
149145
const defaultOutputs: Field[] = Object.entries(sourceBlock.outputs || {}).map(([key]) => ({

0 commit comments

Comments
 (0)