Skip to content

Commit 13a62a6

Browse files
fix(ui): fix node editor image fields
I had broken this when converting to rtk-query
1 parent 871e35b commit 13a62a6

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

invokeai/frontend/web/src/features/nodes/components/fields/ImageInputFieldComponent.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ const ImageInputFieldComponent = (
2626
isLoading,
2727
isError,
2828
isSuccess,
29-
} = useGetImageDTOQuery(field.value ?? skipToken);
29+
} = useGetImageDTOQuery(field.value?.image_name ?? skipToken);
3030

3131
const handleDrop = useCallback(
32-
(droppedImage: ImageDTO) => {
33-
if (field.value === droppedImage.image_name) {
32+
({ image_name }: ImageDTO) => {
33+
if (field.value?.image_name === image_name) {
3434
return;
3535
}
3636

3737
dispatch(
3838
fieldValueChanged({
3939
nodeId,
4040
fieldName: field.name,
41-
value: droppedImage.image_name,
41+
value: { image_name },
4242
})
4343
);
4444
},

invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ import {
1111
NodeChange,
1212
OnConnectStartParams,
1313
} from 'reactflow';
14-
import { ImageDTO } from 'services/api/types';
14+
import { ImageField } from 'services/api/types';
1515
import { receivedOpenAPISchema } from 'services/api/thunks/schema';
1616
import { InvocationTemplate, InvocationValue } from '../types/types';
1717
import { parseSchema } from '../util/parseSchema';
1818
import { log } from 'app/logging/useLogger';
19-
import { forEach, size } from 'lodash-es';
19+
import { size } from 'lodash-es';
2020
import { RgbaColor } from 'react-colorful';
21-
import { imageUrlsReceived } from 'services/api/thunks/image';
2221
import { RootState } from 'app/store/store';
2322

2423
export type NodesState = {
@@ -66,7 +65,7 @@ const nodesSlice = createSlice({
6665
action: PayloadAction<{
6766
nodeId: string;
6867
fieldName: string;
69-
value: string | number | boolean | ImageDTO | RgbaColor | undefined;
68+
value: string | number | boolean | ImageField | RgbaColor | undefined;
7069
}>
7170
) => {
7271
const { nodeId, fieldName, value } = action.payload;

invokeai/frontend/web/src/features/nodes/types/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { OpenAPIV3 } from 'openapi-types';
22
import { RgbaColor } from 'react-colorful';
3-
import { Graph, ImageDTO } from 'services/api/types';
3+
import { Graph, ImageDTO, ImageField } from 'services/api/types';
44
import { AnyInvocationType } from 'services/events/types';
55
import { O } from 'ts-toolbelt';
66

@@ -214,7 +214,7 @@ export type VaeInputFieldValue = FieldValueBase & {
214214

215215
export type ImageInputFieldValue = FieldValueBase & {
216216
type: 'image';
217-
value?: string;
217+
value?: ImageField;
218218
};
219219

220220
export type ModelInputFieldValue = FieldValueBase & {

0 commit comments

Comments
 (0)