Skip to content

Commit ecb261b

Browse files
committed
Fix duplicate custom node installation in workflow import
When importing workflows with custom nodes that appear multiple times in the node index (e.g., ComfyUI-Impact-Pack), the same extension was being added to MissingNodes multiple times. This caused duplicate InstallExtensionStep objects to be created, leading to multiple git clone attempts for the same extension. The second clone would fail because the directory already exists. Added deduplication using a HashSet to track which extension titles have already been added to MissingNodes, ensuring each extension is only installed once.
1 parent dc91cc4 commit ecb261b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

StabilityMatrix.Avalonia/ViewModels/Dialogs/OpenArtWorkflowViewModel.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ private async Task<List<OpenArtCustomNode>> ParseNodes(List<string> nodes)
101101

102102
var installedNodesNames = new HashSet<string>();
103103
var nameToManifestNodes = new Dictionary<string, PackageExtension>();
104+
var addedMissingNodes = new HashSet<string>();
104105

105106
var packagePair = SelectedPackagePair;
106107

@@ -160,9 +161,11 @@ out var manifestExtension
160161
IsInstalled = installedNodesNames.Contains(node),
161162
};
162163

163-
// Add missing nodes to the list
164+
// Add missing nodes to the list (deduplicate by title)
164165
if (
165-
!currentSection.IsInstalled && nameToManifestNodes.TryGetValue(node, out var manifestNode)
166+
!currentSection.IsInstalled
167+
&& nameToManifestNodes.TryGetValue(node, out var manifestNode)
168+
&& addedMissingNodes.Add(manifestNode.Title)
166169
)
167170
{
168171
MissingNodes.Add(manifestNode);

0 commit comments

Comments
 (0)