Skip to content

Commit c43f502

Browse files
waleedlatif1claude
andcommitted
fix(tool-input): render uncovered tool params alongside subblocks
The SubBlock-first rendering path was hard-returning after rendering subblocks, so tool params without matching subblocks (like inputMapping for workflow tools) were never rendered. Now renders subblocks first, then any remaining displayParams not covered by subblocks via the legacy ParameterWithLabel fallback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a29afd2 commit c43f502

File tree

1 file changed

+43
-4
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input

1 file changed

+43
-4
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,9 +1771,15 @@ export const ToolInput = memo(function ToolInput({
17711771

17721772
{/* Tool parameters */}
17731773
{(() => {
1774+
const renderedElements: React.ReactNode[] = []
1775+
17741776
// SubBlock-first rendering for registry tools
17751777
if (useSubBlocks && displaySubBlocks.length > 0) {
1776-
return displaySubBlocks.map((sb) => {
1778+
const coveredParamIds = new Set(
1779+
displaySubBlocks.map((sb) => sb.canonicalParamId || sb.id)
1780+
)
1781+
1782+
displaySubBlocks.forEach((sb) => {
17771783
const effectiveParamId = sb.canonicalParamId || sb.id
17781784

17791785
// Compute canonical toggle for basic/advanced mode switching
@@ -1808,7 +1814,7 @@ export const ToolInput = memo(function ToolInput({
18081814
? sb
18091815
: { ...sb, title: formatParameterLabel(effectiveParamId) }
18101816

1811-
return (
1817+
renderedElements.push(
18121818
<ToolSubBlockRenderer
18131819
key={sb.id}
18141820
blockId={blockId}
@@ -1823,6 +1829,41 @@ export const ToolInput = memo(function ToolInput({
18231829
/>
18241830
)
18251831
})
1832+
1833+
// Render remaining tool params not covered by subblocks
1834+
// (e.g. inputMapping for workflow tools with custom UI)
1835+
const uncoveredParams = displayParams.filter(
1836+
(param) =>
1837+
!coveredParamIds.has(param.id) && evaluateParameterCondition(param, tool)
1838+
)
1839+
1840+
uncoveredParams.forEach((param) => {
1841+
renderedElements.push(
1842+
<ParameterWithLabel
1843+
key={param.id}
1844+
paramId={param.id}
1845+
title={param.uiComponent?.title || formatParameterLabel(param.id)}
1846+
isRequired={param.required === true}
1847+
visibility={param.visibility || 'user-or-llm'}
1848+
wandConfig={param.uiComponent?.wandConfig}
1849+
disabled={disabled}
1850+
isPreview={isPreview || false}
1851+
>
1852+
{(wandControlRef: React.MutableRefObject<WandControlHandlers | null>) =>
1853+
renderParameterInput(
1854+
param,
1855+
tool.params?.[param.id] || '',
1856+
(value) => handleParamChange(toolIndex, param.id, value),
1857+
toolIndex,
1858+
toolContextValues as Record<string, string>,
1859+
wandControlRef
1860+
)
1861+
}
1862+
</ParameterWithLabel>
1863+
)
1864+
})
1865+
1866+
return renderedElements
18261867
}
18271868

18281869
// Fallback: legacy ToolParameterConfig-based rendering
@@ -1831,8 +1872,6 @@ export const ToolInput = memo(function ToolInput({
18311872
evaluateParameterCondition(param, tool)
18321873
)
18331874

1834-
const renderedElements: React.ReactNode[] = []
1835-
18361875
filteredParams.forEach((param) => {
18371876
renderedElements.push(
18381877
<ParameterWithLabel

0 commit comments

Comments
 (0)