LCOV - code coverage report
Current view: top level - src/core/graph/widgets - syncPromotedComboHostOptions.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 15 15
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import { promotedInputSource } from '@/core/graph/subgraph/promotedInputWidget'
       2              : import { resolveConcretePromotedWidget } from '@/core/graph/subgraph/resolveConcretePromotedWidget'
       3              : import type { LGraph } from '@/lib/litegraph/src/litegraph'
       4              : import { useWidgetValueStore } from '@/stores/widgetValueStore'
       5              : import { forEachNode } from '@/utils/graphTraversalUtil'
       6              : 
       7              : /** Copies each promoted combo source's current options onto its subgraph host. */
       8           16 : export function syncPromotedComboHostOptions(rootGraph: LGraph): void {
       9           16 :   const widgetValueStore = useWidgetValueStore()
      10           16 :   forEachNode(rootGraph, (node) => {
      11           69 :     if (!node.isSubgraphNode()) return
      12            4 :     for (const input of node.inputs) {
      13            4 :       if (!input.widgetId) continue
      14              : 
      15            4 :       const source = promotedInputSource(node, input)
      16            4 :       if (!source) continue
      17              : 
      18            4 :       const resolution = resolveConcretePromotedWidget(
      19              :         node,
      20              :         source.nodeId,
      21              :         source.widgetName
      22              :       )
      23            4 :       if (resolution.status !== 'resolved') continue
      24              : 
      25            4 :       const sourceWidget = resolution.resolved.widget
      26            4 :       if (sourceWidget.type !== 'combo') continue
      27              : 
      28            4 :       const state = widgetValueStore.getWidget(input.widgetId)
      29            4 :       if (!state) continue
      30              : 
      31            4 :       state.options = { ...sourceWidget.options }
      32              :     }
      33              :   })
      34              : }
        

Generated by: LCOV version 2.0-1