fix(ui): invalid collect node error w/ control adapters

The graph builders used awaited functions within `Array.prototype.forEach` loops. This doesn't do what you'd think. This caused graphs to be enqueued before they were fully constructed.

 Changed to `for..of` loops to fix this.
This commit is contained in:
psychedelicious 2024-03-14 10:20:23 +11:00
parent ee3a1a95ef
commit db12ce95a8
3 changed files with 6 additions and 6 deletions

View File

@ -49,7 +49,7 @@ export const addControlNetToLinearGraph = async (
},
});
validControlNets.forEach(async (controlNet) => {
for (const controlNet of validControlNets) {
if (!controlNet.model) {
return;
}
@ -114,7 +114,7 @@ export const addControlNetToLinearGraph = async (
field: 'item',
},
});
});
}
upsertMetadata(graph, { controlnets: controlNetMetadata });
}
};

View File

@ -42,7 +42,7 @@ export const addIPAdapterToLinearGraph = async (
const ipAdapterMetdata: CoreMetadataInvocation['ipAdapters'] = [];
validIPAdapters.forEach(async (ipAdapter) => {
for (const ipAdapter of validIPAdapters) {
if (!ipAdapter.model) {
return;
}
@ -84,7 +84,7 @@ export const addIPAdapterToLinearGraph = async (
field: 'item',
},
});
});
}
upsertMetadata(graph, { ipAdapters: ipAdapterMetdata });
}

View File

@ -45,7 +45,7 @@ export const addT2IAdaptersToLinearGraph = async (
const t2iAdapterMetadata: CoreMetadataInvocation['t2iAdapters'] = [];
validT2IAdapters.forEach(async (t2iAdapter) => {
for (const t2iAdapter of validT2IAdapters) {
if (!t2iAdapter.model) {
return;
}
@ -107,7 +107,7 @@ export const addT2IAdaptersToLinearGraph = async (
field: 'item',
},
});
});
}
upsertMetadata(graph, { t2iAdapters: t2iAdapterMetadata });
}