mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix dnd on nodes
I had broken this earlier today
This commit is contained in:
parent
6c6d600cea
commit
2a7dee17be
@ -80,15 +80,14 @@ const ControlNetImagePreview = (props: Props) => {
|
|||||||
}
|
}
|
||||||
}, [controlImage, controlNetId]);
|
}, [controlImage, controlNetId]);
|
||||||
|
|
||||||
const droppableData = useMemo<TypesafeDroppableData | undefined>(() => {
|
const droppableData = useMemo<TypesafeDroppableData | undefined>(
|
||||||
if (controlNetId) {
|
() => ({
|
||||||
return {
|
id: controlNetId,
|
||||||
id: controlNetId,
|
actionType: 'SET_CONTROLNET_IMAGE',
|
||||||
actionType: 'SET_CONTROLNET_IMAGE',
|
context: { controlNetId },
|
||||||
context: { controlNetId },
|
}),
|
||||||
};
|
[controlNetId]
|
||||||
}
|
);
|
||||||
}, [controlNetId]);
|
|
||||||
|
|
||||||
const postUploadAction = useMemo<PostUploadAction>(
|
const postUploadAction = useMemo<PostUploadAction>(
|
||||||
() => ({ type: 'SET_CONTROLNET_IMAGE', controlNetId }),
|
() => ({ type: 'SET_CONTROLNET_IMAGE', controlNetId }),
|
||||||
|
@ -16,7 +16,6 @@ import {
|
|||||||
import IAIDndImage from 'common/components/IAIDndImage';
|
import IAIDndImage from 'common/components/IAIDndImage';
|
||||||
import { useGetImageDTOQuery } from 'services/api/endpoints/images';
|
import { useGetImageDTOQuery } from 'services/api/endpoints/images';
|
||||||
import { PostUploadAction } from 'services/api/thunks/image';
|
import { PostUploadAction } from 'services/api/thunks/image';
|
||||||
import { ImageDTO } from 'services/api/types';
|
|
||||||
import { FieldComponentProps } from './types';
|
import { FieldComponentProps } from './types';
|
||||||
|
|
||||||
const ImageInputFieldComponent = (
|
const ImageInputFieldComponent = (
|
||||||
@ -33,23 +32,6 @@ const ImageInputFieldComponent = (
|
|||||||
isSuccess,
|
isSuccess,
|
||||||
} = useGetImageDTOQuery(field.value?.image_name ?? skipToken);
|
} = 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(() => {
|
const handleReset = useCallback(() => {
|
||||||
dispatch(
|
dispatch(
|
||||||
fieldValueChanged({
|
fieldValueChanged({
|
||||||
@ -70,15 +52,14 @@ const ImageInputFieldComponent = (
|
|||||||
}
|
}
|
||||||
}, [field.name, imageDTO, nodeId]);
|
}, [field.name, imageDTO, nodeId]);
|
||||||
|
|
||||||
const droppableData = useMemo<TypesafeDroppableData | undefined>(() => {
|
const droppableData = useMemo<TypesafeDroppableData | undefined>(
|
||||||
if (imageDTO) {
|
() => ({
|
||||||
return {
|
id: `node-${nodeId}-${field.name}`,
|
||||||
id: `node-${nodeId}-${field.name}`,
|
actionType: 'SET_NODES_IMAGE',
|
||||||
actionType: 'SET_NODES_IMAGE',
|
context: { nodeId, fieldName: field.name },
|
||||||
context: { nodeId, fieldName: field.name },
|
}),
|
||||||
};
|
[field.name, nodeId]
|
||||||
}
|
);
|
||||||
}, [field.name, imageDTO, nodeId]);
|
|
||||||
|
|
||||||
const postUploadAction = useMemo<PostUploadAction>(
|
const postUploadAction = useMemo<PostUploadAction>(
|
||||||
() => ({
|
() => ({
|
||||||
|
Loading…
Reference in New Issue
Block a user