fix(input-format): allow value field to be cleared (#1658)

* fix(input-format): allow value field to be cleared

* don't let value field be detected as deployment change

* fix zep icon in docs

* exclude collapsed state
This commit is contained in:
Vikhyath Mondreti
2025-10-16 11:11:27 -07:00
committed by GitHub
parent 4cd790b200
commit 82fa4e8bbb
3 changed files with 41 additions and 16 deletions

View File

@@ -7,30 +7,30 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
<BlockInfoCard
type="zep"
color="#4F46E5"
color="#E8E8E8"
icon={true}
iconSvg={`<svg className="block-icon"
viewBox='0 0 24 24'
fill='none'
xmlns='http://www.w3.org/2000/svg'
viewBox='0 0 233 196'
>
<path
d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z'
fill='currentColor'
d='m231.34,108.7l-1.48-1.55h-10.26l3.59-75.86-14.8-.45-2.77,49.31c-59.6-3.24-119.33-3.24-178.92-.02l-1.73-64.96-14.8.45,2.5,91.53H2.16l-1.41,1.47c-1.55,16.23-.66,32.68,2.26,48.89h10.83l.18,1.27c.67,19.34,16.1,34.68,35.9,34.68s44.86-.92,66.12-.92,46.56.92,65.95.92,35.19-15.29,35.9-34.61l.16-1.34h11.02c2.91-16.19,3.81-32.61,2.26-48.81Zm-158.23,58.01c-17.27,0-30.25-13.78-30.25-29.78s12.99-29.78,30.25-29.78,29.62,13.94,29.62,29.94-12.35,29.62-29.62,29.62Zm86.51,0c-17.27,0-30.25-13.78-30.25-29.78s12.99-29.78,30.25-29.78,29.62,13.94,29.62,29.94-12.35,29.62-29.62,29.62Z'
fill='#FF1493'
/>
<polygon
points='111.77 22.4 93.39 49.97 93.52 50.48 185.88 38.51 190.95 27.68 114.32 36.55 117.7 31.48 117.7 31.47 138.38 .49 138.25 0 47.67 11.6 42.85 22.27 118.34 12.61 111.77 22.4'
fill='#FF1493'
/>
<path
d='M12 6c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z'
fill='currentColor'
d='m72.97,121.47c-8.67,0-15.73,6.93-15.73,15.46s7.06,15.46,15.73,15.46,15.37-6.75,15.37-15.37-6.75-15.55-15.37-15.55Z'
fill='#FF1493'
/>
<circle cx='12' cy='12' r='2' fill='currentColor' />
<path
d='M8 8h8M8 16h8'
stroke='currentColor'
strokeWidth='1.5'
strokeLinecap='round'
d='m159.48,121.47c-8.67,0-15.73,6.93-15.73,15.46s7.06,15.46,15.73,15.46,15.37-6.75,15.37-15.37-6.75-15.55-15.37-15.55Z'
fill='#FF1493'
/>
</svg>`}
/>

View File

@@ -135,8 +135,6 @@ export function FieldFormat({
if (!inputEl) return
const current = localValues[field.id] ?? inputEl.value ?? ''
const trimmed = current.trim()
if (!trimmed) return
updateField(field.id, 'value', current)
}

View File

@@ -206,6 +206,23 @@ function sanitizeToolsForComparison(tools: any[] | undefined): any[] {
})
}
/**
* Sanitize inputFormat array by removing test-only value fields
* @param inputFormat - The inputFormat array to sanitize
* @returns A sanitized inputFormat array without test values
*/
function sanitizeInputFormatForComparison(inputFormat: any[] | undefined): any[] {
if (!Array.isArray(inputFormat)) {
return []
}
return inputFormat.map((field) => {
// Remove test-only field: value (used only for manual testing)
const { value, collapsed, ...cleanField } = field
return cleanField
})
}
/**
* Normalize a value for consistent comparison by sorting object keys
* @param value - The value to normalize
@@ -363,6 +380,16 @@ export function hasWorkflowChanged(
deployedValue = sanitizeToolsForComparison(deployedValue)
}
// Special handling for 'inputFormat' subBlock - sanitize test-only value fields
if (
subBlockId === 'inputFormat' &&
Array.isArray(currentValue) &&
Array.isArray(deployedValue)
) {
currentValue = sanitizeInputFormatForComparison(currentValue)
deployedValue = sanitizeInputFormatForComparison(deployedValue)
}
// For string values, compare directly to catch even small text changes
if (typeof currentValue === 'string' && typeof deployedValue === 'string') {
if (currentValue !== deployedValue) {