Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
(metric: { name: string }) => `${normalizedBlockName}.${metric.name.toLowerCase()}`
)
} else {
const outputPaths = generateOutputPaths(blockConfig.outputs)
const outputPaths = getBlockOutputPaths(sourceBlock.type, mergedSubBlocks)
blockTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`)
}
} else if (sourceBlock.type === 'variables') {
Expand All @@ -515,7 +515,11 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
if (schemaFields.length > 0) {
blockTags = schemaFields.map((field) => `${normalizedBlockName}.${field.name}`)
} else {
const outputPaths = generateOutputPaths(blockConfig.outputs || {})
const outputPaths = getBlockOutputPaths(
sourceBlock.type,
mergedSubBlocks,
sourceBlock.triggerMode
)
blockTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`)
}
} else if (!blockConfig.outputs || Object.keys(blockConfig.outputs).length === 0) {
Expand Down Expand Up @@ -573,21 +577,19 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
if (dynamicOutputs.length > 0) {
blockTags = dynamicOutputs.map((path) => `${normalizedBlockName}.${path}`)
} else {
const outputPaths = generateOutputPaths(blockConfig.outputs || {})
const outputPaths = getBlockOutputPaths(sourceBlock.type, mergedSubBlocks, true)
blockTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`)
}
} else if (sourceBlock.type === 'approval') {
// For approval block, use dynamic outputs based on inputFormat
const dynamicOutputs = getBlockOutputPaths(sourceBlock.type, mergedSubBlocks)

// If it's a self-reference, only show url (available immediately)
const isSelfReference = activeSourceBlockId === blockId

if (dynamicOutputs.length > 0) {
const allTags = dynamicOutputs.map((path) => `${normalizedBlockName}.${path}`)
blockTags = isSelfReference ? allTags.filter((tag) => tag.endsWith('.url')) : allTags
} else {
const outputPaths = generateOutputPaths(blockConfig.outputs || {})
const outputPaths = getBlockOutputPaths(sourceBlock.type, mergedSubBlocks)
const allTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`)
blockTags = isSelfReference ? allTags.filter((tag) => tag.endsWith('.url')) : allTags
}
Expand All @@ -601,7 +603,11 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
if (toolOutputPaths.length > 0) {
blockTags = toolOutputPaths.map((path) => `${normalizedBlockName}.${path}`)
} else {
const outputPaths = generateOutputPaths(blockConfig.outputs || {})
const outputPaths = getBlockOutputPaths(
sourceBlock.type,
mergedSubBlocks,
sourceBlock.triggerMode
)
blockTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`)
}
}
Expand Down Expand Up @@ -845,7 +851,7 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
(metric: { name: string }) => `${normalizedBlockName}.${metric.name.toLowerCase()}`
)
} else {
const outputPaths = generateOutputPaths(blockConfig.outputs)
const outputPaths = getBlockOutputPaths(accessibleBlock.type, mergedSubBlocks)
blockTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`)
}
} else if (accessibleBlock.type === 'variables') {
Expand All @@ -867,7 +873,11 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
if (schemaFields.length > 0) {
blockTags = schemaFields.map((field) => `${normalizedBlockName}.${field.name}`)
} else {
const outputPaths = generateOutputPaths(blockConfig.outputs || {})
const outputPaths = getBlockOutputPaths(
accessibleBlock.type,
mergedSubBlocks,
accessibleBlock.triggerMode
)
blockTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`)
}
} else if (!blockConfig.outputs || Object.keys(blockConfig.outputs).length === 0) {
Expand All @@ -879,21 +889,19 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
if (dynamicOutputs.length > 0) {
blockTags = dynamicOutputs.map((path) => `${normalizedBlockName}.${path}`)
} else {
const outputPaths = generateOutputPaths(blockConfig.outputs || {})
const outputPaths = getBlockOutputPaths(accessibleBlock.type, mergedSubBlocks, true)
blockTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`)
}
} else if (accessibleBlock.type === 'approval') {
// For approval block, use dynamic outputs based on inputFormat
const dynamicOutputs = getBlockOutputPaths(accessibleBlock.type, mergedSubBlocks)

// If it's a self-reference, only show url (available immediately)
const isSelfReference = accessibleBlockId === blockId

if (dynamicOutputs.length > 0) {
const allTags = dynamicOutputs.map((path) => `${normalizedBlockName}.${path}`)
blockTags = isSelfReference ? allTags.filter((tag) => tag.endsWith('.url')) : allTags
} else {
const outputPaths = generateOutputPaths(blockConfig.outputs || {})
const outputPaths = getBlockOutputPaths(accessibleBlock.type, mergedSubBlocks)
const allTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`)
blockTags = isSelfReference ? allTags.filter((tag) => tag.endsWith('.url')) : allTags
}
Expand All @@ -907,7 +915,11 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
if (toolOutputPaths.length > 0) {
blockTags = toolOutputPaths.map((path) => `${normalizedBlockName}.${path}`)
} else {
const outputPaths = generateOutputPaths(blockConfig.outputs || {})
const outputPaths = getBlockOutputPaths(
accessibleBlock.type,
mergedSubBlocks,
accessibleBlock.triggerMode
)
blockTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,25 @@ export function useEditorSubblockLayout(
const blocks = useWorkflowStore.getState().blocks || {}
const mergedMap = mergeSubblockState(blocks, activeWorkflowId || undefined, blockId)
const mergedState = mergedMap ? mergedMap[blockId] : undefined
stateToUse = mergedState?.subBlocks || {}
const mergedSubBlocks = mergedState?.subBlocks || {}

stateToUse = Object.keys(mergedSubBlocks).reduce(
(acc, key) => {
const value =
blockSubBlockValues[key] !== undefined
? blockSubBlockValues[key]
: (mergedSubBlocks[key]?.value ?? null)
acc[key] = { value }
return acc
},
{} as Record<string, { value: unknown }>
)

Object.keys(blockSubBlockValues).forEach((key) => {
if (!(key in stateToUse)) {
stateToUse[key] = { value: blockSubBlockValues[key] }
}
})

// Filter visible blocks and those that meet their conditions
const visibleSubBlocks = (config.subBlocks || []).filter((block) => {
Expand All @@ -59,12 +77,12 @@ export function useEditorSubblockLayout(
if (block.mode === 'advanced' && !displayAdvancedMode) return false
if (block.mode === 'trigger') {
// Show trigger mode blocks only when in trigger mode
return displayTriggerMode
if (!displayTriggerMode) return false
}
}

// When in trigger mode, hide blocks that don't have mode: 'trigger'
if (displayTriggerMode) {
if (displayTriggerMode && block.mode !== 'trigger') {
return false
}

Expand Down
Loading