From 88d2e7b97b53a8ae33e3a7d088a5b40c9b7340f2 Mon Sep 17 00:00:00 2001 From: Waleed Date: Wed, 8 Oct 2025 12:57:37 -0700 Subject: [PATCH] fix(env-vars): remove regex parsing from table subblock, add formatDisplayText to various subblocks that didn't have it (#1582) --- .../document-tag-entry/document-tag-entry.tsx | 21 +- .../knowledge-tag-filters.tsx | 7 +- .../mcp-dynamic-args/mcp-dynamic-args.tsx | 27 ++- .../components/sub-block/components/table.tsx | 9 +- .../components/trigger-config-section.tsx | 18 +- .../components/trigger-modal.tsx | 1 + .../condition/condition-handler.test.ts | 10 +- .../handlers/condition/condition-handler.ts | 2 +- apps/sim/executor/resolver/resolver.test.ts | 6 +- apps/sim/executor/resolver/resolver.ts | 213 ++---------------- 10 files changed, 105 insertions(+), 209 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/document-tag-entry/document-tag-entry.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/document-tag-entry/document-tag-entry.tsx index 0f2567185..fccca2b5e 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/document-tag-entry/document-tag-entry.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/document-tag-entry/document-tag-entry.tsx @@ -9,6 +9,7 @@ import { checkTagTrigger, TagDropdown } from '@/components/ui/tag-dropdown' import { MAX_TAG_SLOTS } from '@/lib/knowledge/consts' import { cn } from '@/lib/utils' import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/hooks/use-sub-block-value' +import { useAccessibleReferencePrefixes } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes' import type { SubBlockConfig } from '@/blocks/types' import { useKnowledgeBaseTagDefinitions } from '@/hooks/use-knowledge-base-tag-definitions' import { useTagSelection } from '@/hooks/use-tag-selection' @@ -40,6 +41,7 @@ export function DocumentTagEntry({ isConnecting = false, }: DocumentTagEntryProps) { const [storeValue, setStoreValue] = useSubBlockValue(blockId, subBlock.id) + const accessiblePrefixes = useAccessibleReferencePrefixes(blockId) // Get the knowledge base ID from other sub-blocks const [knowledgeBaseIdValue] = useSubBlockValue(blockId, 'knowledgeBaseId') @@ -301,7 +303,12 @@ export function DocumentTagEntry({ )} />
-
{formatDisplayText(cellValue)}
+
+ {formatDisplayText(cellValue, { + accessiblePrefixes, + highlightAll: !accessiblePrefixes, + })} +
{showDropdown && availableTagDefinitions.length > 0 && (
@@ -389,7 +396,10 @@ export function DocumentTagEntry({ />
- {formatDisplayText(cellValue)} + {formatDisplayText(cellValue, { + accessiblePrefixes, + highlightAll: !accessiblePrefixes, + })}
{showTypeDropdown && !isReadOnly && ( @@ -469,7 +479,12 @@ export function DocumentTagEntry({ className='w-full border-0 text-transparent caret-foreground placeholder:text-muted-foreground/50 focus-visible:ring-0 focus-visible:ring-offset-0' />
-
{formatDisplayText(cellValue)}
+
+ {formatDisplayText(cellValue, { + accessiblePrefixes, + highlightAll: !accessiblePrefixes, + })} +
diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/knowledge-tag-filters/knowledge-tag-filters.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/knowledge-tag-filters/knowledge-tag-filters.tsx index 6df8d6582..9b06b8649 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/knowledge-tag-filters/knowledge-tag-filters.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/knowledge-tag-filters/knowledge-tag-filters.tsx @@ -239,7 +239,12 @@ export function KnowledgeTagFilters({ onBlur={handleBlur} />
-
{formatDisplayText(cellValue || 'Select tag')}
+
+ {formatDisplayText(cellValue || 'Select tag', { + accessiblePrefixes, + highlightAll: !accessiblePrefixes, + })} +
{showDropdown && tagDefinitions.length > 0 && (
diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/mcp-dynamic-args/mcp-dynamic-args.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/mcp-dynamic-args/mcp-dynamic-args.tsx index 1eb5b15cd..d40f8d030 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/mcp-dynamic-args/mcp-dynamic-args.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/mcp-dynamic-args/mcp-dynamic-args.tsx @@ -1,5 +1,6 @@ import { useCallback } from 'react' import { useParams } from 'next/navigation' +import { formatDisplayText } from '@/components/ui/formatted-text' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { @@ -14,6 +15,7 @@ import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' import { cn } from '@/lib/utils' import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/hooks/use-sub-block-value' +import { useAccessibleReferencePrefixes } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes' import { useMcpTools } from '@/hooks/use-mcp-tools' import { formatParameterLabel } from '@/tools/params' @@ -37,6 +39,7 @@ export function McpDynamicArgs({ const { mcpTools } = useMcpTools(workspaceId) const [selectedTool] = useSubBlockValue(blockId, 'tool') const [toolArgs, setToolArgs] = useSubBlockValue(blockId, subBlockId) + const accessiblePrefixes = useAccessibleReferencePrefixes(blockId) const selectedToolConfig = mcpTools.find((tool) => tool.id === selectedTool) const toolSchema = selectedToolConfig?.inputSchema @@ -180,7 +183,7 @@ export function McpDynamicArgs({ case 'long-input': return ( -
+