fix(ui): fix workflow saving

'id' should not be omitted when building a workflow, it makes workflows always save as a copy
This commit is contained in:
psychedelicious 2023-12-09 15:57:06 +11:00
parent 08ef71a74e
commit 1af4260ab6
2 changed files with 7 additions and 3 deletions

View File

@ -1,9 +1,9 @@
import { enqueueRequested } from 'app/store/actions'; import { enqueueRequested } from 'app/store/actions';
import { buildNodesGraph } from 'features/nodes/util/graph/buildNodesGraph'; import { buildNodesGraph } from 'features/nodes/util/graph/buildNodesGraph';
import { buildWorkflow } from 'features/nodes/util/workflow/buildWorkflow';
import { queueApi } from 'services/api/endpoints/queue'; import { queueApi } from 'services/api/endpoints/queue';
import { BatchConfig } from 'services/api/types'; import { BatchConfig } from 'services/api/types';
import { startAppListening } from '..'; import { startAppListening } from '..';
import { buildWorkflow } from 'features/nodes/util/workflow/buildWorkflow';
export const addEnqueueRequestedNodes = () => { export const addEnqueueRequestedNodes = () => {
startAppListening({ startAppListening({
@ -19,6 +19,10 @@ export const addEnqueueRequestedNodes = () => {
edges, edges,
workflow, workflow,
}); });
// embedded workflows don't have an id
delete builtWorkflow.id;
const batchConfig: BatchConfig = { const batchConfig: BatchConfig = {
batch: { batch: {
graph, graph,

View File

@ -24,12 +24,12 @@ export const buildWorkflow: BuildWorkflowFunction = ({
edges, edges,
workflow, workflow,
}) => { }) => {
const clonedWorkflow = cloneDeep(workflow); const clonedWorkflow = omit(cloneDeep(workflow), 'isTouched');
const clonedNodes = cloneDeep(nodes); const clonedNodes = cloneDeep(nodes);
const clonedEdges = cloneDeep(edges); const clonedEdges = cloneDeep(edges);
const newWorkflow: WorkflowV2 = { const newWorkflow: WorkflowV2 = {
...omit(clonedWorkflow, 'isTouched', 'id'), ...clonedWorkflow,
nodes: [], nodes: [],
edges: [], edges: [],
}; };