fix(ui): fix node editor image fields

I had broken this when converting to rtk-query
This commit is contained in:
psychedelicious 2023-06-23 19:29:00 +10:00
parent e386b5dc53
commit e076231398
3 changed files with 9 additions and 10 deletions

View File

@ -26,11 +26,11 @@ const ImageInputFieldComponent = (
isLoading,
isError,
isSuccess,
} = useGetImageDTOQuery(field.value ?? skipToken);
} = useGetImageDTOQuery(field.value?.image_name ?? skipToken);
const handleDrop = useCallback(
(droppedImage: ImageDTO) => {
if (field.value === droppedImage.image_name) {
({ image_name }: ImageDTO) => {
if (field.value?.image_name === image_name) {
return;
}
@ -38,7 +38,7 @@ const ImageInputFieldComponent = (
fieldValueChanged({
nodeId,
fieldName: field.name,
value: droppedImage.image_name,
value: { image_name },
})
);
},

View File

@ -11,14 +11,13 @@ import {
NodeChange,
OnConnectStartParams,
} from 'reactflow';
import { ImageDTO } from 'services/api/types';
import { ImageField } from 'services/api/types';
import { receivedOpenAPISchema } from 'services/api/thunks/schema';
import { InvocationTemplate, InvocationValue } from '../types/types';
import { parseSchema } from '../util/parseSchema';
import { log } from 'app/logging/useLogger';
import { forEach, size } from 'lodash-es';
import { size } from 'lodash-es';
import { RgbaColor } from 'react-colorful';
import { imageUrlsReceived } from 'services/api/thunks/image';
import { RootState } from 'app/store/store';
export type NodesState = {
@ -66,7 +65,7 @@ const nodesSlice = createSlice({
action: PayloadAction<{
nodeId: string;
fieldName: string;
value: string | number | boolean | ImageDTO | RgbaColor | undefined;
value: string | number | boolean | ImageField | RgbaColor | undefined;
}>
) => {
const { nodeId, fieldName, value } = action.payload;

View File

@ -1,6 +1,6 @@
import { OpenAPIV3 } from 'openapi-types';
import { RgbaColor } from 'react-colorful';
import { Graph, ImageDTO } from 'services/api/types';
import { Graph, ImageDTO, ImageField } from 'services/api/types';
import { AnyInvocationType } from 'services/events/types';
import { O } from 'ts-toolbelt';
@ -214,7 +214,7 @@ export type VaeInputFieldValue = FieldValueBase & {
export type ImageInputFieldValue = FieldValueBase & {
type: 'image';
value?: string;
value?: ImageField;
};
export type ModelInputFieldValue = FieldValueBase & {