From 82fa4e8bbb5738941c0ecc467dd6757c0e3c73ee Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Thu, 16 Oct 2025 11:11:27 -0700 Subject: [PATCH] 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 --- apps/docs/content/docs/en/tools/zep.mdx | 28 +++++++++---------- .../components/starter/input-format.tsx | 2 -- apps/sim/lib/workflows/utils.ts | 27 ++++++++++++++++++ 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/apps/docs/content/docs/en/tools/zep.mdx b/apps/docs/content/docs/en/tools/zep.mdx index 6c8437b44d..9d9b9a183e 100644 --- a/apps/docs/content/docs/en/tools/zep.mdx +++ b/apps/docs/content/docs/en/tools/zep.mdx @@ -7,30 +7,30 @@ import { BlockInfoCard } from "@/components/ui/block-info-card" + - `} /> diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/starter/input-format.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/starter/input-format.tsx index 9ef98cf0fa..2580d91fa8 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/starter/input-format.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/starter/input-format.tsx @@ -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) } diff --git a/apps/sim/lib/workflows/utils.ts b/apps/sim/lib/workflows/utils.ts index 93a797e096..db8c22de53 100644 --- a/apps/sim/lib/workflows/utils.ts +++ b/apps/sim/lib/workflows/utils.ts @@ -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) {