Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/services/nodeSearchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,18 @@ export class NodeSearchService {
name: 'Input Type',
invokeSequence: 'i',
getItemOptions: (node) =>
Object.values(node.inputs ?? []).map((input) => input.type),
Object.values(node.inputs ?? []).flatMap((input) =>
input.type.split(',')
),
Comment on lines +38 to +40
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Trim whitespace and filter empty strings when splitting input types.

The same whitespace and empty string issues from FuseFilter.matches apply here. If input types contain spaces after commas (e.g., 'IMAGE, MASK') or trailing commas (e.g., 'IMAGE,'), the split results will contain malformed values.

Apply this diff:

 getItemOptions: (node) =>
   Object.values(node.inputs ?? []).flatMap((input) =>
-    input.type.split(',')
+    input.type.split(',').map(t => t.trim()).filter(t => t.length > 0)
   ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Object.values(node.inputs ?? []).flatMap((input) =>
input.type.split(',')
),
Object.values(node.inputs ?? []).flatMap((input) =>
input.type.split(',').map(t => t.trim()).filter(t => t.length > 0)
),
🤖 Prompt for AI Agents
In src/services/nodeSearchService.ts around lines 38 to 40, the code splits
input.type by commas but doesn't trim whitespace or remove empty strings; update
the split logic to map each part through .trim() and filter out empty values
(e.g., after split, do parts.map(p => p.trim()).filter(Boolean)) so entries like
"IMAGE, MASK" or "IMAGE," produce clean tokens before flatMap/aggregation.

fuseOptions
})

this.outputTypeFilter = new FuseFilter<ComfyNodeDefImpl, string>(data, {
id: 'output',
name: 'Output Type',
invokeSequence: 'o',
getItemOptions: (node) => node.outputs.map((output) => output.type),
getItemOptions: (node) =>
node.outputs.flatMap((output) => output.type.split(',')),
Comment on lines +48 to +49
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Trim whitespace and filter empty strings when splitting output types.

Consistent with the input type handling, output types should also trim whitespace and filter empty strings after splitting.

Apply this diff:

 getItemOptions: (node) =>
-  node.outputs.flatMap((output) => output.type.split(',')),
+  node.outputs.flatMap((output) => output.type.split(',').map(t => t.trim()).filter(t => t.length > 0)),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
getItemOptions: (node) =>
node.outputs.flatMap((output) => output.type.split(',')),
getItemOptions: (node) =>
node.outputs.flatMap((output) => output.type.split(',').map(t => t.trim()).filter(t => t.length > 0)),
🤖 Prompt for AI Agents
In src/services/nodeSearchService.ts around lines 48 to 49, the getItemOptions
mapping splits output.type by ',' but does not trim whitespace or filter empty
strings; update the split handling to mirror input type processing by splitting
on ',', mapping each part through .trim(), and filtering out any empty strings
so returned options contain only non-empty, trimmed types.

fuseOptions
})

Expand Down
9 changes: 6 additions & 3 deletions src/utils/fuseUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ export class FuseFilter<T, O = string> {
return true
}
const options = this.getItemOptions(item)
return wildcard
? options.some((option) => option === wildcard)
: options.includes(value)
if (wildcard) return options.some((option) => option === wildcard)
if (typeof value !== 'string' || !value.includes(','))
return options.includes(value)
const values = value.split(',')
//Alas, typescript doesn't understand string satisfies O
return values.some((v) => options.includes(v as O))
}
}

Expand Down