Skip to content

fix(autoconnect): cleaned up autoconnect#1127

Merged
aadamgough merged 1 commit intostagingfrom
fix/autoconnect
Aug 24, 2025
Merged

fix(autoconnect): cleaned up autoconnect#1127
aadamgough merged 1 commit intostagingfrom
fix/autoconnect

Conversation

@aadamgough
Copy link
Contributor

Summary

Cleaned up autoconnect edge cases

Type of Change

  • New feature

Testing

Manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Aug 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Aug 24, 2025 3:44am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 24, 2025 3:44am

@aadamgough aadamgough marked this pull request as ready for review August 24, 2025 03:42
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR enhances the autoconnect functionality in the workflow system by fixing critical edge cases related to nested containers and improving connection precision. The changes span two key files:

utils.ts Changes:
The primary fix addresses a bug in the isPointInLoopNode function where nested containers weren't being properly detected. Previously, the function used relative coordinates (n.position) for containment checks, which failed for nested loop/parallel nodes since their position is relative to their parent container, not the canvas. The fix switches to using getNodeAbsolutePosition(n.id, getNodes) for both containment rectangle calculations and returned position data, ensuring accurate spatial detection for nested container hierarchies.

workflow.tsx Enhancements:
Several significant improvements were made to the autoconnect system:

  • A new getNodeAnchorPosition function calculates precise connection points at the right-middle edge of blocks, replacing less accurate center-based positioning
  • Enhanced findClosestOutput logic that respects container boundaries and filters out child nodes when dropping blocks outside containers
  • New auto-connect functionality for drag-and-drop scenarios when blocks are moved into containers, automatically establishing connections to existing children or container start handles
  • Container-aware filtering that prevents inappropriate cross-container connections

These changes integrate with the existing workflow store architecture and maintain the visual workflow building paradigm where spatial relationships and container hierarchies are fundamental to the user experience. The enhancements should make the autoconnect system more reliable and intuitive, particularly when working with complex nested workflow structures.

Confidence score: 4/5

  • This PR appears safe to merge with generally well-structured improvements to autoconnect functionality
  • Score reflects solid logic improvements and bug fixes, though the complexity of spatial calculations and container hierarchies introduces some inherent risk
  • Pay close attention to the workflow.tsx file due to its complex auto-connect logic and potential impact on user interactions

2 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@aadamgough aadamgough merged commit 1038e14 into staging Aug 24, 2025
5 checks passed
@aadamgough aadamgough deleted the fix/autoconnect branch August 24, 2025 03:46
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant