Skip to content

Commit

Permalink
fix(ui): edge case where controladapters added counts could be off
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
psychedelicious committed Oct 10, 2024
1 parent ac08c31 commit 7185363
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export const addControlNets = async (
};

for (const layer of validControlLayers) {
result.addedControlNets++;

const getImageDTOResult = await withResultAsync(() => {
const adapter = manager.adapters.controlLayers.get(layer.id);
assert(adapter, 'Adapter not found');
Expand All @@ -50,6 +48,7 @@ export const addControlNets = async (

const imageDTO = getImageDTOResult.value;
addControlNetToGraph(g, layer, imageDTO, collector);
result.addedControlNets++;
}

return result;
Expand Down Expand Up @@ -77,8 +76,6 @@ export const addT2IAdapters = async (
};

for (const layer of validControlLayers) {
result.addedT2IAdapters++;

const getImageDTOResult = await withResultAsync(() => {
const adapter = manager.adapters.controlLayers.get(layer.id);
assert(adapter, 'Adapter not found');
Expand All @@ -91,6 +88,7 @@ export const addT2IAdapters = async (

const imageDTO = getImageDTOResult.value;
addT2IAdapterToGraph(g, layer, imageDTO, collector);
result.addedT2IAdapters++;
}

return result;
Expand Down

0 comments on commit 7185363

Please sign in to comment.