-
Notifications
You must be signed in to change notification settings - Fork 14
fix(entry-point): resolve dynamic ports correctly for Entry Point nodes #215
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
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 122b2228ea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Get parameters from node data (stored in config.params) | ||
| const params = nodeData.config?.params || {}; |
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.
Include legacy param locations in port resolution
The new resolveGraphPorts only reads nodeData.config?.params, so workflows saved before the config.params migration (where params live under node.data.parameters or directly on node.data.config) will resolve ports with {} and still show the fallback outputs (e.g., Entry Point stays on “Triggered”) when fetched. You already handle legacy locations in parse(), but fetch-time resolution doesn’t, so older workflows won’t get the fix until they’re re-saved. Consider using the same fallback chain as parse() to avoid leaving legacy graphs unresolved.
Useful? React with 👍 / 👎.
d01fb2d to
06a7685
Compare
This fixes a bug where dragging from Input 2 on an Entry Point node would incorrectly connect from Input 1. The issue was that ReactFlow caches handle positions, and without calling updateNodeInternals when dynamic outputs/inputs change, it would use stale positions. Added a useEffect that triggers updateNodeInternals whenever the output or input port IDs change, ensuring ReactFlow recalculates handle positions. Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Fixes ENG-114: Entry node issue
When dragging from Input 2 on an Entry Point node, it would incorrectly
connect from Input 1. This was because ReactFlow caches handle positions
and wasn't being notified when dynamic ports changed.
**Fix**: Added useEffect in WorkflowNode.tsx that calls updateNodeInternals
whenever effectiveOutputs or componentInputs change, forcing ReactFlow to
recalculate handle positions.
When loading a workflow, the Entry Point would show the fallback 'Triggered'
output instead of the configured runtime inputs (Input 1, Input 2, etc.).
Opening the config panel would fix it by calling resolvePorts.
**Root Cause**: Two bugs in workflows.service.ts
1. The parse() method was passing the wrong object to resolvePorts:
- Before: nodeData.config (contains {params: {...}, inputOverrides: {...}})
- After: nodeData.config.params (contains {runtimeInputs: [...]})
2. Dynamic ports were only resolved when saving workflows, not when fetching.
**Fix**:
- Fixed param extraction: nodeData.config.params instead of nodeData.config
- Added resolveGraphPorts() that resolves dynamic ports when fetching workflows
- buildWorkflowResponse now applies port resolution before returning to frontend
The dynamic ports system now correctly:
- Resolves ports when creating/updating workflows (via parse)
- Resolves ports when fetching workflows (via resolveGraphPorts)
- Updates ReactFlow handle positions when ports change (via updateNodeInternals)
- Properly types the graph using WorkflowGraph instead of 'any'
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…esolution - Added extractNodeParams() to handle legacy config schema migrations: - Current: nodeData.config.params - Legacy: nodeData.parameters - Legacy: nodeData.config (when config was params directly) - Added extractComponentId() to handle frontend node extensions - Added resolveNodePorts() as single-node resolution helper - Refactored parse() to use shared resolveGraphPorts() This ensures both save and fetch operations use the same logic, fixing the issue where legacy workflows wouldn't have ports resolved correctly when fetched until re-saved. Types: - Uses z.infer<WorkflowNodeSchema> and z.infer<WorkflowNodeDataSchema> - No more 'as any' casts for node data (except for extended properties) Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
06a7685 to
f5d496b
Compare
Summary
Fixes ENG-114: Entry node issue
This PR fixes multiple issues with the Entry Point node's dynamic ports (runtime inputs):
Issues Fixed
Issue 1: Edge connections from wrong output port
When dragging from Input 2 on an Entry Point node, it would incorrectly connect from Input 1.
Root Cause: ReactFlow caches handle positions and wasn't being notified when dynamic ports changed.
Fix: Added `useEffect` in `WorkflowNode.tsx` that calls `updateNodeInternals()` whenever `effectiveOutputs` or `componentInputs` change, forcing ReactFlow to recalculate handle positions.
Issue 2: Entry Point shows 'Triggered' instead of actual inputs
When loading a workflow, the Entry Point would show the fallback 'Triggered' output instead of the configured runtime inputs (Input 1, Input 2, etc.). Opening the config panel would magically fix it.
Root Cause: Two bugs in `workflows.service.ts`:
The `parse()` method was passing the wrong object to `resolvePorts`:
Dynamic ports were only resolved when saving workflows, not when fetching.
Fix:
Technical Details
The dynamic ports system now correctly:
Files Changed