fix(ui): fix dnd on nodes

I had broken this earlier today
This commit is contained in:
psychedelicious 2023-07-05 19:06:40 +10:00
parent 6c6d600cea
commit 2a7dee17be
2 changed files with 16 additions and 36 deletions

View File

@ -80,15 +80,14 @@ const ControlNetImagePreview = (props: Props) => {
}
}, [controlImage, controlNetId]);
const droppableData = useMemo<TypesafeDroppableData | undefined>(() => {
if (controlNetId) {
return {
id: controlNetId,
actionType: 'SET_CONTROLNET_IMAGE',
context: { controlNetId },
};
}
}, [controlNetId]);
const droppableData = useMemo<TypesafeDroppableData | undefined>(
() => ({
id: controlNetId,
actionType: 'SET_CONTROLNET_IMAGE',
context: { controlNetId },
}),
[controlNetId]
);
const postUploadAction = useMemo<PostUploadAction>(
() => ({ type: 'SET_CONTROLNET_IMAGE', controlNetId }),

View File

@ -16,7 +16,6 @@ import {
import IAIDndImage from 'common/components/IAIDndImage';
import { useGetImageDTOQuery } from 'services/api/endpoints/images';
import { PostUploadAction } from 'services/api/thunks/image';
import { ImageDTO } from 'services/api/types';
import { FieldComponentProps } from './types';
const ImageInputFieldComponent = (
@ -33,23 +32,6 @@ const ImageInputFieldComponent = (
isSuccess,
} = useGetImageDTOQuery(field.value?.image_name ?? skipToken);
const handleDrop = useCallback(
({ image_name }: ImageDTO) => {
if (field.value?.image_name === image_name) {
return;
}
dispatch(
fieldValueChanged({
nodeId,
fieldName: field.name,
value: { image_name },
})
);
},
[dispatch, field.name, field.value, nodeId]
);
const handleReset = useCallback(() => {
dispatch(
fieldValueChanged({
@ -70,15 +52,14 @@ const ImageInputFieldComponent = (
}
}, [field.name, imageDTO, nodeId]);
const droppableData = useMemo<TypesafeDroppableData | undefined>(() => {
if (imageDTO) {
return {
id: `node-${nodeId}-${field.name}`,
actionType: 'SET_NODES_IMAGE',
context: { nodeId, fieldName: field.name },
};
}
}, [field.name, imageDTO, nodeId]);
const droppableData = useMemo<TypesafeDroppableData | undefined>(
() => ({
id: `node-${nodeId}-${field.name}`,
actionType: 'SET_NODES_IMAGE',
context: { nodeId, fieldName: field.name },
}),
[field.name, nodeId]
);
const postUploadAction = useMemo<PostUploadAction>(
() => ({