fix(connection-tags): drag and drop didn't render tag dropdown with input format fields#1647
Merged
Merged
Conversation
…nput format fields
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
Greptile Overview
Summary
Fixed a bug where drag-and-drop connection tags didn't render properly for API trigger and Input Form trigger blocks when inputFormat fields were configured. The fix involves two coordinated changes:
use-block-connections.ts: Integrated thegetBlockOutputshelper function to correctly derive dynamic outputs based oninputFormatfields, replacing the previous approach that only used static block outputstag-dropdown.tsx: Added explicit handling forapi_triggerandinput_triggerblock types to parse and display tags frominputFormatfields
Both files now properly merge live subblock values from the store with base subblock definitions, ensuring the tag dropdown reflects the current state of input format configurations during drag-and-drop operations.
Confidence Score: 4/5
- This PR is safe to merge with minor considerations
- The changes correctly address the stated bug by integrating the existing
getBlockOutputshelper and adding explicit handling for trigger blocks. The logic is consistent with similar handling for starter blocks. Code duplication exists between the two locations inuse-block-connections.tswhere outputs are computed (lines 131-152 and 182-203), but this appears to be pre-existing technical debt rather than introduced by this PR. - No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-block-connections.ts | 4/5 | Integrated getBlockOutputs helper to properly handle dynamic outputs from inputFormat for API and Input Form triggers, fixing connection tag rendering during drag-and-drop |
| apps/sim/components/ui/tag-dropdown.tsx | 5/5 | Added explicit handling for api_trigger and input_trigger blocks to render tags based on inputFormat fields, matching the logic used for starter block |
Sequence Diagram
sequenceDiagram
participant User
participant TagDropdown
participant useBlockConnections
participant getBlockOutputs
participant SubBlockStore
User->>TagDropdown: Drag and drop connection tag
TagDropdown->>TagDropdown: getMergedSubBlocks(sourceBlockId)
TagDropdown->>SubBlockStore: Get live subblock values
SubBlockStore-->>TagDropdown: Return inputFormat values
alt Block is api_trigger or input_trigger
TagDropdown->>TagDropdown: Check inputFormat.value
TagDropdown->>TagDropdown: Filter and map fields to tags
TagDropdown-->>User: Render tag dropdown with input format fields
else Other block types
TagDropdown->>TagDropdown: Use existing logic
end
User->>useBlockConnections: Request connected blocks
useBlockConnections->>useBlockConnections: getMergedSubBlocks(sourceBlockId)
useBlockConnections->>SubBlockStore: Get live subblock values
SubBlockStore-->>useBlockConnections: Return merged subBlocks
useBlockConnections->>getBlockOutputs: Get dynamic outputs
getBlockOutputs->>getBlockOutputs: Check if api_trigger/input_trigger
getBlockOutputs->>getBlockOutputs: Parse inputFormat fields
getBlockOutputs-->>useBlockConnections: Return dynamic outputs
useBlockConnections->>useBlockConnections: Convert to field format
useBlockConnections-->>User: Return connections with proper output fields
2 files reviewed, no comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Drag and drop didn't render tag dropdown with input format fields --> affected input form trigger and API trigger.
Type of Change
Testing
Set input format fields and drag and drop connection tag
Checklist