From 8014fc2f4f386ae7fc7d62fa34d6ed7c9d1e8278 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 30 Aug 2023 12:12:54 +1000 Subject: [PATCH] Revert "fix(ui): fix control image save button logic" This reverts commit d8ce20c06ffd8f60b9034a9aff27d46362dfe271. --- .../components/ControlNetImagePreview.tsx | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/invokeai/frontend/web/src/features/controlNet/components/ControlNetImagePreview.tsx b/invokeai/frontend/web/src/features/controlNet/components/ControlNetImagePreview.tsx index 4a26509f81..312d5a517b 100644 --- a/invokeai/frontend/web/src/features/controlNet/components/ControlNetImagePreview.tsx +++ b/invokeai/frontend/web/src/features/controlNet/components/ControlNetImagePreview.tsx @@ -15,7 +15,6 @@ import { useAddImageToBoardMutation, useChangeImageIsIntermediateMutation, useGetImageDTOQuery, - useRemoveImageFromBoardMutation, } from 'services/api/endpoints/images'; import { PostUploadAction } from 'services/api/types'; import IAIDndImageIcon from '../../../common/components/IAIDndImageIcon'; @@ -68,36 +67,23 @@ const ControlNetImagePreview = ({ isSmall, controlNet }: Props) => { const [changeIsIntermediate] = useChangeImageIsIntermediateMutation(); const [addToBoard] = useAddImageToBoardMutation(); - const [removeFromBoard] = useRemoveImageFromBoardMutation(); + const handleResetControlImage = useCallback(() => { dispatch(controlNetImageChanged({ controlNetId, controlImage: null })); }, [controlNetId, dispatch]); - const handleSaveControlImage = useCallback(async () => { + const handleSaveControlImage = useCallback(() => { if (!processedControlImage) { return; } - await changeIsIntermediate({ + changeIsIntermediate({ imageDTO: processedControlImage, is_intermediate: false, - }).unwrap(); + }); - if (autoAddBoardId !== 'none') { - addToBoard({ - imageDTO: processedControlImage, - board_id: autoAddBoardId, - }); - } else { - removeFromBoard({ imageDTO: processedControlImage }); - } - }, [ - processedControlImage, - changeIsIntermediate, - autoAddBoardId, - addToBoard, - removeFromBoard, - ]); + addToBoard({ imageDTO: processedControlImage, board_id: autoAddBoardId }); + }, [processedControlImage, autoAddBoardId, changeIsIntermediate, addToBoard]); const handleMouseEnter = useCallback(() => { setIsMouseOverImage(true);