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

View File

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