Skip to content

Commit 7185363

Browse files
fix(ui): edge case where controladapters added counts could be off
We were: - Incrementing `addedControlNets` or `addedT2IAdapters` - Attempting to add it, but maybe failing and skipping Need to swap the order of operations to prevent misreporting of added cnet/t2i. I don't think this would ever actually cause problems.
1 parent ac08c31 commit 7185363

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

invokeai/frontend/web/src/features/nodes/util/graph/generation/addControlAdapters.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ export const addControlNets = async (
3636
};
3737

3838
for (const layer of validControlLayers) {
39-
result.addedControlNets++;
40-
4139
const getImageDTOResult = await withResultAsync(() => {
4240
const adapter = manager.adapters.controlLayers.get(layer.id);
4341
assert(adapter, 'Adapter not found');
@@ -50,6 +48,7 @@ export const addControlNets = async (
5048

5149
const imageDTO = getImageDTOResult.value;
5250
addControlNetToGraph(g, layer, imageDTO, collector);
51+
result.addedControlNets++;
5352
}
5453

5554
return result;
@@ -77,8 +76,6 @@ export const addT2IAdapters = async (
7776
};
7877

7978
for (const layer of validControlLayers) {
80-
result.addedT2IAdapters++;
81-
8279
const getImageDTOResult = await withResultAsync(() => {
8380
const adapter = manager.adapters.controlLayers.get(layer.id);
8481
assert(adapter, 'Adapter not found');
@@ -91,6 +88,7 @@ export const addT2IAdapters = async (
9188

9289
const imageDTO = getImageDTOResult.value;
9390
addT2IAdapterToGraph(g, layer, imageDTO, collector);
91+
result.addedT2IAdapters++;
9492
}
9593

9694
return result;

0 commit comments

Comments
 (0)