fix(ui): merge conflicts in image deletion listener

This commit is contained in:
psychedelicious 2024-07-04 09:56:47 +10:00
parent 80e7e1293a
commit 0b5d20c9f0

View File

@ -40,8 +40,8 @@ const deleteNodesImages = (state: RootState, dispatch: AppDispatch, imageDTO: Im
}; };
const deleteControlAdapterImages = (state: RootState, dispatch: AppDispatch, imageDTO: ImageDTO) => { const deleteControlAdapterImages = (state: RootState, dispatch: AppDispatch, imageDTO: ImageDTO) => {
state.canvasV2.controlAdapters.forEach(({ id, image, processedImage }) => { state.canvasV2.controlAdapters.entities.forEach(({ id, imageObject, processedImageObject }) => {
if (image?.name === imageDTO.image_name || processedImage?.name === imageDTO.image_name) { if (imageObject?.image.name === imageDTO.image_name || processedImageObject?.image.name === imageDTO.image_name) {
dispatch(caImageChanged({ id, imageDTO: null })); dispatch(caImageChanged({ id, imageDTO: null }));
dispatch(caProcessedImageChanged({ id, imageDTO: null })); dispatch(caProcessedImageChanged({ id, imageDTO: null }));
} }
@ -49,15 +49,15 @@ const deleteControlAdapterImages = (state: RootState, dispatch: AppDispatch, ima
}; };
const deleteIPAdapterImages = (state: RootState, dispatch: AppDispatch, imageDTO: ImageDTO) => { const deleteIPAdapterImages = (state: RootState, dispatch: AppDispatch, imageDTO: ImageDTO) => {
state.canvasV2.ipAdapters.forEach(({ id, imageObject: image }) => { state.canvasV2.ipAdapters.entities.forEach(({ id, imageObject }) => {
if (image?.name === imageDTO.image_name) { if (imageObject?.image.name === imageDTO.image_name) {
dispatch(ipaImageChanged({ id, imageDTO: null })); dispatch(ipaImageChanged({ id, imageDTO: null }));
} }
}); });
}; };
const deleteLayerImages = (state: RootState, dispatch: AppDispatch, imageDTO: ImageDTO) => { const deleteLayerImages = (state: RootState, dispatch: AppDispatch, imageDTO: ImageDTO) => {
state.canvasV2.layers.forEach(({ id, objects }) => { state.canvasV2.layers.entities.forEach(({ id, objects }) => {
let shouldDelete = false; let shouldDelete = false;
for (const obj of objects) { for (const obj of objects) {
if (obj.type === 'image' && obj.image.name === imageDTO.image_name) { if (obj.type === 'image' && obj.image.name === imageDTO.image_name) {