Add tests

Fix bug on reload with promote flag not set
This commit is contained in:
pythongosssss
2026-01-27 17:26:45 -08:00
parent 24cbf4f68c
commit e7e26ce28b
6 changed files with 525 additions and 18 deletions

View File

@@ -184,13 +184,24 @@ export function autoPromoteDynamicChildren(
node: LGraphNode,
parentWidget: IBaseWidget
) {
if (!parentWidget.promoted) return
const parents = getSubgraphParents(node)
if (!parents.length) return
// Check if the parent widget is actually promoted on any parent SubgraphNode.
// This is more reliable than checking parentWidget.promoted, which may not
// be set after workflow reload (the flag is only synced when navigating into
// the subgraph).
const nodeId = String(node.id)
const promotedOnParents = parents.filter((parent) =>
getProxyWidgets(parent).some(
([id, name]) => id === nodeId && name === parentWidget.name
)
)
if (!promotedOnParents.length) return
const childWidgets = getChildWidgets(node, parentWidget.name)
promoteWidgetsToProxy(node, childWidgets, parents)
promoteWidgetsToProxy(node, childWidgets, promotedOnParents)
}
/**