Repository navigation
Fix copy/clone disconnecting links on the original node - #799
Merged
Merged
Conversation
On ComfyUI frontend 1.53.1+ (after the ECS migration), slot links are resolved from the graph's link store by (graph, node id, slot) instead of `input.link`. A cloned node keeps the original's id, and RgthreeBaseNode.clone() attached the original graph to the clone as a workaround for ComfyUI_frontend#5037. As a result: - BaseAnyInputConnectedNode.clone() trimming extra inputs with removeInput() disconnected input slots 1+ of the ORIGINAL node (Fast Bypasser/Muter, Mute/Bypass Repeater/Relay, Random Unmuter, Node Collector, Fast Actions Button) on single-node copy, clone, duplicate, alt+drag clone and "Save Selected as Template". - DynamicContextNodeBase.clone() also cut the original's outputs 1+. - The graph-attached clone serialized the original's link ids. Trim the clone's slot arrays directly (they carry no links) and stop attaching the graph to clones, so clones behave like stock clones. Co-Authored-By: Claude Code <noreply@anthropic.com>
rgthree
approved these changes
Oct 28, 2026
rgthree
left a comment
Owner
There was a problem hiding this comment.
Looks straightforward. Thanks!
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.
Problem
On ComfyUI frontend 1.53.1 and later, copying or cloning a Fast Bypasser / Fast Muter / Mute / Bypass Repeater / Mute / Bypass Relay / Random Unmuter (any
BaseAnyInputConnectedNode) disconnects input slots 1+ of the original node. Only the first input survives.Repro (frontend 1.57.4):
Which operations trigger it:
canvasCurrentlyCopyingToClipboardWithMultipleNodespath skips trimming)Duplicate and "Save Selected as Template" go through the same
copyToClipboard()path as Ctrl+C, so they should behave the same (not tested separately).It does not happen on frontend 1.52.7.
Before / After
Ctrl+C, right-click → Clone, and Alt+drag clone on frontend 1.57.4:
link_disconnect_behavior.mp4
Verification workflow: link_disconnect_example.json
Root cause
LGraphNode.clone()keeps the original's id (node.id = this.id).RgthreeBaseNode.clone()assignscloned.graph = this.graph(the workaround for [Dev]: Litegraph Error thrown; Cannot remove input/output from a copied node. Comfy-Org/ComfyUI_frontend#5037).BaseAnyInputConnectedNode.clone()then trims extra inputs withremoveInput().Since the ECS migration (Comfy-Org/ComfyUI_frontend#14246, first released in 1.53.1),
removeInput()/disconnectOutput()/serialize()no longer readinput.link. Instead they resolve links from the graph's link store by(graph, node id, slot). A graph-attached clone with the original's id therefore resolves, and removes, the original node's links. Before 1.53.1 the lookup went throughinput.link, whichclone()nulls out, so the workaround was harmless.Side effects of the same root cause:
DynamicContextNodeBase.clone()(unreleased) also callsremoveOutput(), so it cuts the original's outputs 1+ as well, even on multi-node copy.Fix
BaseAnyInputConnectedNode.clone()andDynamicContextNodeBase.clone()trim the clone's slot arrays directly (splice(1)). A clone's slots carry no links, so nothing needs disconnecting. This works on every frontend version and needs no graph.RgthreeBaseNode.clone()no longer attaches the graph to the clone. These two overrides were the only reason for the #5037 workaround, so clones now behave like stock clones.src_weband the correspondingweboutput are both updated.Testing
Manual UI checks (frontend 1.57.4):
Manual UI checks (frontend 1.52.7, via
--front-end-version):🤖 Generated with Claude Code