mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): ensure invocation edges have a type
This commit is contained in:
parent
1c29b3bd85
commit
5553588147
@ -1,7 +1,6 @@
|
|||||||
import type { PayloadAction, UnknownAction } from '@reduxjs/toolkit';
|
import type { PayloadAction, UnknownAction } from '@reduxjs/toolkit';
|
||||||
import { createSlice, isAnyOf } from '@reduxjs/toolkit';
|
import { createSlice, isAnyOf } from '@reduxjs/toolkit';
|
||||||
import type { PersistConfig, RootState } from 'app/store/store';
|
import type { PersistConfig, RootState } from 'app/store/store';
|
||||||
import { deepClone } from 'common/util/deepClone';
|
|
||||||
import { workflowLoaded } from 'features/nodes/store/actions';
|
import { workflowLoaded } from 'features/nodes/store/actions';
|
||||||
import { SHARED_NODE_PROPERTIES } from 'features/nodes/types/constants';
|
import { SHARED_NODE_PROPERTIES } from 'features/nodes/types/constants';
|
||||||
import type {
|
import type {
|
||||||
@ -105,7 +104,8 @@ export const nodesSlice = createSlice({
|
|||||||
state.edges = applyEdgeChanges(edgeChanges, state.edges);
|
state.edges = applyEdgeChanges(edgeChanges, state.edges);
|
||||||
},
|
},
|
||||||
edgesChanged: (state, action: PayloadAction<EdgeChange[]>) => {
|
edgesChanged: (state, action: PayloadAction<EdgeChange[]>) => {
|
||||||
const changes = deepClone(action.payload);
|
const changes: EdgeChange[] = [];
|
||||||
|
// We may need to massage the edge changes or otherwise handle them
|
||||||
action.payload.forEach((change) => {
|
action.payload.forEach((change) => {
|
||||||
if (change.type === 'remove' || change.type === 'select') {
|
if (change.type === 'remove' || change.type === 'select') {
|
||||||
const edge = state.edges.find((e) => e.id === change.id);
|
const edge = state.edges.find((e) => e.id === change.id);
|
||||||
@ -124,6 +124,13 @@ export const nodesSlice = createSlice({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (change.type === 'add') {
|
||||||
|
if (!change.item.type) {
|
||||||
|
// We must add the edge type!
|
||||||
|
change.item.type = 'default';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
changes.push(change);
|
||||||
});
|
});
|
||||||
state.edges = applyEdgeChanges(changes, state.edges);
|
state.edges = applyEdgeChanges(changes, state.edges);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user