mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix image nodes losing image
This commit is contained in:
parent
6aebe1614d
commit
4a7a5234df
@ -21,7 +21,7 @@ const ImageInputFieldComponent = (
|
|||||||
|
|
||||||
const getImageByNameAndType = useGetImageByNameAndType();
|
const getImageByNameAndType = useGetImageByNameAndType();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const [url, setUrl] = useState<string>();
|
const [url, setUrl] = useState<string | undefined>(field.value?.image_url);
|
||||||
const { getUrl } = useGetUrl();
|
const { getUrl } = useGetUrl();
|
||||||
|
|
||||||
const handleDrop = useCallback(
|
const handleDrop = useCallback(
|
||||||
@ -39,16 +39,13 @@ const ImageInputFieldComponent = (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setUrl(image.url);
|
setUrl(image.image_url);
|
||||||
|
|
||||||
dispatch(
|
dispatch(
|
||||||
fieldValueChanged({
|
fieldValueChanged({
|
||||||
nodeId,
|
nodeId,
|
||||||
fieldName: field.name,
|
fieldName: field.name,
|
||||||
value: {
|
value: image,
|
||||||
image_name: name,
|
|
||||||
image_type: type,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
NodeChange,
|
NodeChange,
|
||||||
OnConnectStartParams,
|
OnConnectStartParams,
|
||||||
} from 'reactflow';
|
} from 'reactflow';
|
||||||
import { ImageField } from 'services/api';
|
import { ImageDTO } from 'services/api';
|
||||||
import { receivedOpenAPISchema } from 'services/thunks/schema';
|
import { receivedOpenAPISchema } from 'services/thunks/schema';
|
||||||
import { InvocationTemplate, InvocationValue } from '../types/types';
|
import { InvocationTemplate, InvocationValue } from '../types/types';
|
||||||
import { parseSchema } from '../util/parseSchema';
|
import { parseSchema } from '../util/parseSchema';
|
||||||
@ -65,13 +65,7 @@ const nodesSlice = createSlice({
|
|||||||
action: PayloadAction<{
|
action: PayloadAction<{
|
||||||
nodeId: string;
|
nodeId: string;
|
||||||
fieldName: string;
|
fieldName: string;
|
||||||
value:
|
value: string | number | boolean | ImageDTO | RgbaColor | undefined;
|
||||||
| string
|
|
||||||
| number
|
|
||||||
| boolean
|
|
||||||
| Pick<ImageField, 'image_name' | 'image_type'>
|
|
||||||
| RgbaColor
|
|
||||||
| undefined;
|
|
||||||
}>
|
}>
|
||||||
) => {
|
) => {
|
||||||
const { nodeId, fieldName, value } = action.payload;
|
const { nodeId, fieldName, value } = action.payload;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { OpenAPIV3 } from 'openapi-types';
|
import { OpenAPIV3 } from 'openapi-types';
|
||||||
import { RgbaColor } from 'react-colorful';
|
import { RgbaColor } from 'react-colorful';
|
||||||
import { ImageField } from 'services/api';
|
import { ImageDTO } from 'services/api';
|
||||||
import { AnyInvocationType } from 'services/events/types';
|
import { AnyInvocationType } from 'services/events/types';
|
||||||
|
|
||||||
export type InvocationValue = {
|
export type InvocationValue = {
|
||||||
@ -179,7 +179,7 @@ export type ConditioningInputFieldValue = FieldValueBase & {
|
|||||||
|
|
||||||
export type ImageInputFieldValue = FieldValueBase & {
|
export type ImageInputFieldValue = FieldValueBase & {
|
||||||
type: 'image';
|
type: 'image';
|
||||||
value?: Pick<ImageField, 'image_name' | 'image_type'>;
|
value?: ImageDTO;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ModelInputFieldValue = FieldValueBase & {
|
export type ModelInputFieldValue = FieldValueBase & {
|
||||||
@ -245,7 +245,7 @@ export type BooleanInputFieldTemplate = InputFieldTemplateBase & {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type ImageInputFieldTemplate = InputFieldTemplateBase & {
|
export type ImageInputFieldTemplate = InputFieldTemplateBase & {
|
||||||
default: Pick<ImageField, 'image_name' | 'image_type'>;
|
default: ImageDTO;
|
||||||
type: 'image';
|
type: 'image';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user