* Deep copy to clipboard, update nested ids on paste
The copyToClipboard function wasn't walking subgraphs and leaving nested
subgraphs unserialized. This has now been fixed.
This requires that equivalent support be added to _pasteFromClipboard to
update the ids of nested subgraphs which are pasted.
* Add extra advisory comments
* [bugfix] Fix widget disconnection issue in subgraphs
When disconnecting a node from a SubgraphInput, the target input's link
reference was not being cleared in LLink.disconnect(). This caused
widgets to remain greyed out because they still thought they were
connected (slot.link was not null).
The fix ensures that when a link is disconnected, the target node's
input slot is properly cleaned up by setting input.link = null.
Fixes#4922🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* [test] Add tests for LLink disconnect fix for widget issue
Add comprehensive tests for the LLink.disconnect() method to verify
that target input link references are properly cleared when disconnecting.
This prevents widgets from remaining greyed out after disconnection.
Tests cover:
- Basic disconnect functionality with link reference cleanup
- Edge cases with invalid target nodes
- Preventing interference between different connections
Related to #4922🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
When loading workflows, SubgraphNode would throw an error if an input
exists in the serialized data that doesn't exist in the current subgraph
definition. This can happen when:
- Subgraph definitions change after workflows are saved
- Workflows are shared between users with different subgraph versions
- Dynamic inputs were added that don't exist in the base definition
This change converts the hard error to a warning and continues processing,
allowing workflows to load even with mismatched subgraph configurations.
Fixes#4905
## 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>