From 4e2d43c6083fb163704c1882ea695ed03ce20ea0 Mon Sep 17 00:00:00 2001 From: kun Date: Fri, 20 Sep 2024 13:26:42 +0800 Subject: [PATCH] fix: widget index --- .../web/src/stores/workflow/utils/data-transformer.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/web/apps/web/src/stores/workflow/utils/data-transformer.ts b/web/apps/web/src/stores/workflow/utils/data-transformer.ts index 7bd35f8a..a04332e6 100644 --- a/web/apps/web/src/stores/workflow/utils/data-transformer.ts +++ b/web/apps/web/src/stores/workflow/utils/data-transformer.ts @@ -216,19 +216,13 @@ export const genReactFlow: ( // widget节点 if (workflow.blocks) { - const widgetIndexMap = new Map(); if (isArray(workflow.blocks)) { workflow.blocks.forEach(block => { const id = block.name as NodeId; const type = NodeTypeEnum.widget; const widgetName = (block as any).widget_class_name; - let widgetIndex: number; - if (widgetIndexMap.get(widgetName)) { - widgetIndex = widgetIndexMap.get(widgetName) || 1; - } else { - widgetIndex = 1; - widgetIndexMap.set(widgetName, widgetIndex); - } + const widgetIndex = + nodes.filter(item => item.data.name === widgetName).length + 1; const idx = comfyui.nodes?.findIndex( (item: any) => `node_${item.id}` === block.name, );