On adding output matchType, initialize type (#7161)

The output type of a matchType output is initialized to
COMFY_MATCHTYPE_V3, but is updated soon after to the value calculated
from input types. Under some difficult to reproduce circumstances, this
output type may be incorrectly evaluated in connections to other switch
nodes. Since the initial type is never a valid connection, this can
produce errors.

Instead, the output type of a matchtype node is initialized to allow
connections to anything to ensure that the subsequent restriction of
output types is guaranteed to be directional

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7161-On-adding-output-matchType-initialize-type-2bf6d73d3650819ab169ffe9a4ecfeb4)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Alexander Brown <drjkl@comfy.org>
This commit is contained in:
AustinMroz
2025-12-04 13:39:35 -08:00
committed by GitHub
parent f800c4091c
commit 45bcf4096c

View File

@@ -219,7 +219,9 @@ export const useLitegraphService = () => {
*/
function addOutputs(node: LGraphNode, outputs: OutputSpec[]) {
for (const output of outputs) {
const { name, type, is_list } = output
const { name, is_list } = output
// TODO: Fix the typing at the node spec level
const type = output.type === 'COMFY_MATCHTYPE_V3' ? '*' : output.type
const shapeOptions = is_list ? { shape: LiteGraph.GRID_SHAPE } : {}
const nameKey = `${nodeKey(node)}.outputs.${output.index}.name`
const typeKey = `dataTypes.${normalizeI18nKey(type)}`