## Summary
This PR fixes#4681 by building upon the foundation laid in PR #1182
(litegraph.js). It prevents incompatible type connections when dragging
from a normal node's output to a SubgraphInputNode's occupied slot.
Before:
https://github.com/user-attachments/assets/03def938-dccc-4b2c-b65b-745abf02a13b
After:
https://github.com/user-attachments/assets/7a0a2ed4-9ecd-4147-be56-d643d448d4cb
## Background
PR #1182 implemented:
- `isValidTarget()` method in SubgraphInput/SubgraphOutput classes for
validation
- Visual feedback during drag (40% opacity for invalid targets)
- Validation at the slot level
However, there was a missing piece: while the visual feedback correctly
showed invalid targets, the actual connection would still be made when
dropped.
## Changes
This PR extends PR #1182 by adding the missing connection prevention:
1. **Added `canConnectToSubgraphInput()` method** to render link
classes:
- `MovingOutputLink`
- `ToOutputRenderLink`
- `FloatingRenderLink`
- All methods use the existing `SubgraphInput.isValidTarget()` from PR
#1182
2. **Added validation in `LinkConnector.dropOnIoNode()`**:
- Checks `canConnectToSubgraphInput()` before allowing the connection
- Logs a warning when rejecting invalid connections
- Follows the same pattern as regular node connections
3. **Added `isSubgraphInputValidDrop()` method**:
- Provides validation for hover states
- Ensures consistent validation across the UI
Prior to this commit, subgraphNode inconsistently refers to either the
parent graph, or to indicate the current node is a subgraph.
This corrects the usage of subgraphNode to consistently refer to the
subgraph instance as defined in the constructor.
This solves a bug where graph serialization fails due to an incorrectly
reported infinite loop.
Port of https://github.com/Comfy-Org/litegraph.js/pull/1193
Subgraphs are loaded in order of creation. Under most circumstances,
this means newer subgraphs are loaded first. With nested subgraphs, this
means a subgraph node has it's inputs connected before it's inside is
loaded. When the inner subgraph is loaded, input-added events are
triggered even though inputs already exist on the subgraph node.
This is resolved by adding a check for if an input of the corresponding
name already exists when adding an input.
Port of https://github.com/Comfy-Org/litegraph.js/pull/1192
Litegraph is no longer a standalone npm package.
Dependencies are managed by frontend's package.json
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
No longer needed as litegraph is built as part of frontend, not as standalone library
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
These workflows were for managing litegraph as a standalone npm package.
No longer needed since litegraph is now a git subtree within the frontend.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Relocated .cursor/rules/unit-test.mdc from litegraph subtree to project root maintaining folder structure
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>