Fixes Canvas Auto Save to Gallery

This commit is contained in:
psychedelicious 2022-11-19 16:07:36 +11:00 committed by blessedcoolant
parent 2ab868314f
commit ae4a44de3e

View File

@ -98,7 +98,8 @@ const makeSocketIOListeners = (
*/ */
onGenerationResult: (data: InvokeAI.ImageResultResponse) => { onGenerationResult: (data: InvokeAI.ImageResultResponse) => {
try { try {
const { shouldLoopback, activeTab } = getState().options; const state = getState();
const { shouldLoopback, activeTab } = state.options;
const { boundingBox: _, generationMode, ...rest } = data; const { boundingBox: _, generationMode, ...rest } = data;
const newImage = { const newImage = {
@ -107,24 +108,31 @@ const makeSocketIOListeners = (
}; };
if (['txt2img', 'img2img'].includes(generationMode)) { if (['txt2img', 'img2img'].includes(generationMode)) {
newImage.category = 'result';
dispatch( dispatch(
addImage({ addImage({
category: 'result', category: 'result',
image: newImage, image: { ...newImage, category: 'result' },
}) })
); );
} }
if (generationMode === 'unifiedCanvas' && data.boundingBox) { if (generationMode === 'unifiedCanvas' && data.boundingBox) {
newImage.category = 'temp';
const { boundingBox } = data; const { boundingBox } = data;
dispatch( dispatch(
addImageToStagingArea({ addImageToStagingArea({
image: newImage, image: { ...newImage, category: 'temp' },
boundingBox, boundingBox,
}) })
); );
if (state.canvas.shouldAutoSave) {
dispatch(
addImage({
image: { ...newImage, category: 'result' },
category: 'result',
})
);
}
} }
if (shouldLoopback) { if (shouldLoopback) {