mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix image deletion
This commit is contained in:
parent
aeaf3737aa
commit
c406be6f4f
@ -17,24 +17,24 @@ export const addRequestedImageDeletionListener = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { name, type } = image;
|
const { image_name, image_type } = image;
|
||||||
|
|
||||||
if (type !== 'uploads' && type !== 'results') {
|
if (image_type !== 'uploads' && image_type !== 'results') {
|
||||||
moduleLog.warn({ data: image }, `Invalid image type ${type}`);
|
moduleLog.warn({ data: image }, `Invalid image type ${image_type}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedImageName = getState().gallery.selectedImage?.name;
|
const selectedImageName = getState().gallery.selectedImage?.image_name;
|
||||||
|
|
||||||
if (selectedImageName === name) {
|
if (selectedImageName === image_name) {
|
||||||
const allIds = getState()[type].ids;
|
const allIds = getState()[image_type].ids;
|
||||||
const allEntities = getState()[type].entities;
|
const allEntities = getState()[image_type].entities;
|
||||||
|
|
||||||
const deletedImageIndex = allIds.findIndex(
|
const deletedImageIndex = allIds.findIndex(
|
||||||
(result) => result.toString() === name
|
(result) => result.toString() === image_name
|
||||||
);
|
);
|
||||||
|
|
||||||
const filteredIds = allIds.filter((id) => id.toString() !== name);
|
const filteredIds = allIds.filter((id) => id.toString() !== image_name);
|
||||||
|
|
||||||
const newSelectedImageIndex = clamp(
|
const newSelectedImageIndex = clamp(
|
||||||
deletedImageIndex,
|
deletedImageIndex,
|
||||||
@ -53,7 +53,7 @@ export const addRequestedImageDeletionListener = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(imageDeleted({ imageName: name, imageType: type }));
|
dispatch(imageDeleted({ imageName: image_name, imageType: image_type }));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user