-
Notifications
You must be signed in to change notification settings - Fork 3.1k
improvement(block-outputs): fix chat fields being hidden even if in inputFormat, cleanup code #1819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nputFormat, cleanup code"
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
Fixed a bug where chat-related fields (input, conversationId, files) were being hidden from the UI dropdown even when explicitly defined in a start block's inputFormat.
Key Changes:
- Bug Fix: Modified
shouldFilterReservedField()inblock-outputs.ts:178-196to check if reserved fields are explicitly defined ininputFormatbefore filtering them out. Previously, these fields were unconditionally hidden from the dropdown forstart_triggerblocks. - Code Organization: Extracted complex logic into smaller, focused helper functions (
getUnifiedStartOutputs,getLegacyStarterOutputs,shouldClearBaseOutputs,applyInputFormatToOutputs,shouldFilterReservedField, etc.) making the code more maintainable and testable. - Type Consolidation: Created
apps/sim/lib/workflows/types.tsto centralize workflow-related type definitions (InputFormatField,LoopType,ParallelType, user file properties) eliminating duplicate type definitions across 6 files. - String Literal Cleanup: Replaced hardcoded trigger type strings with
TRIGGER_TYPESconstants throughout the codebase (addedGENERIC_WEBHOOKto the constants).
The refactoring maintains backward compatibility while improving code quality and fixing the reported issue.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The changes are well-structured with clear intent. The bug fix properly addresses the issue by adding a conditional check instead of removing filtering entirely. The refactoring extracts logic into pure functions without changing behavior. Type consolidation eliminates duplication and improves maintainability. All changes are backward compatible and the PR was manually tested.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/lib/workflows/types.ts | 5/5 | New file created to centralize workflow-related type definitions including InputFormatField, loop/parallel types, and file property constants |
| apps/sim/lib/workflows/block-outputs.ts | 5/5 | Major refactor with bug fix - chat fields now shown if explicitly in inputFormat; extracted helper functions for clarity; uses centralized types |
| apps/sim/lib/workflows/triggers.ts | 5/5 | Added GENERIC_WEBHOOK to TRIGGER_TYPES constant and updated usages to reference the constant instead of hardcoded string |
Sequence Diagram
sequenceDiagram
participant UI as UI Component
participant GBO as getBlockOutputs
participant GSO as getUnifiedStartOutputs
participant SFR as shouldFilterReservedField
participant GOP as getBlockOutputPaths
UI->>GBO: Request outputs for start_trigger block
GBO->>GBO: Check if block is UNIFIED start type
GBO->>GSO: Get unified start outputs
GSO->>GSO: Clone UNIFIED_START_OUTPUTS (input, conversationId, files)
GSO->>GSO: Normalize inputFormat fields
GSO->>GSO: Apply inputFormat fields on top of base outputs
GSO-->>GBO: Return merged outputs
GBO-->>UI: Return complete outputs
UI->>GOP: Request output paths for tag dropdown
GOP->>GBO: Get all outputs
GOP->>GOP: Traverse output tree
loop For each field
GOP->>SFR: Should filter this reserved field?
alt Field is reserved AND not in inputFormat
SFR-->>GOP: Filter out (hidden from dropdown)
else Field is explicitly defined in inputFormat
SFR-->>GOP: Keep field (show in dropdown)
end
end
GOP-->>UI: Return filtered paths
12 files reviewed, no comments
…nputFormat, cleanup code (#1819) * improvement(block-outputs): fix chat fields being hidden even if in inputFormat, cleanup code" * fix type error
…nputFormat, cleanup code (#1819) * improvement(block-outputs): fix chat fields being hidden even if in inputFormat, cleanup code" * fix type error
Summary
Type of Change
Testing
Tested Manually
Checklist