Skip to content

Commit

Permalink
fix: widget index
Browse files Browse the repository at this point in the history
  • Loading branch information
ikun97 committed Sep 20, 2024
1 parent 516a028 commit 4e2d43c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions web/apps/web/src/stores/workflow/utils/data-transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,13 @@ export const genReactFlow: (

// widget节点
if (workflow.blocks) {
const widgetIndexMap = new Map<string, number>();
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,
);
Expand Down

0 comments on commit 4e2d43c

Please sign in to comment.